returns an empty asset to be used in an encoding situation.
the filekey, mimetype and adapter are already set for ffmpeg
490332
private function createNewCacheAssetForResolution($episode, $resolution) {
        $asset = $this->getContainer()->get('bprs.asset')->createAsset();
        $asset->setFilekey(
            sprintf('%s.%s',$asset->getFilekey(), $resolution['container'])
        );
        $asset->setAdapter(
            $this->getContainer()->getParameter(
                'oktolab_media.encoding_filesystem'
            )
        );
        $asset->setName($episode->getVideo()->getName());
        $asset->setMimetype($resolution['mimetype']);

        return $asset;
    }
532097
function mimeTypeFromFilename( filename ) {
	var ext = filename.split(".").pop().toLowerCase();
	return mime.lookup(filename) || "application/octet-stream";
}
878260
private Asset getInlineAsset(Resource ntResourceResource, Media media, String fileName) {
    return new InlineAsset(ntResourceResource, media, fileName, adaptable);
  }
1281743
public static IVideoStreamCodec getVideoCodec(IoBuffer data) {
        IVideoStreamCodec result = null;
        //get the codec identifying byte
        int codecId = data.get() & 0x0f;
        try {
            switch (codecId) {
                case 2: //sorenson 
                    result = (IVideoStreamCodec) Class.forName("org.red5.codec.SorensonVideo").newInstance();
                    break;
                case 3: //screen video
                    result = (IVideoStreamCodec) Class.forName("org.red5.codec.ScreenVideo").newInstance();
                    break;
                case 6: //screen video 2
                    result = (IVideoStreamCodec) Class.forName("org.red5.codec.ScreenVideo2").newInstance();
                    break;
                case 7: //avc/h.264 video
                    result = (IVideoStreamCodec) Class.forName("org.red5.codec.AVCVideo").newInstance();
                    break;
            }
        } catch (Exception ex) {
            log.error("Error creating codec instance", ex);
        }
        data.rewind();
        //if codec is not found do the old-style loop
        if (result == null) {
            for (IVideoStreamCodec storedCodec : codecs) {
                IVideoStreamCodec codec;
                // XXX: this is a bit of a hack to create new instances of the
                // configured video codec for each stream
                try {
                    codec = storedCodec.getClass().newInstance();
                } catch (Exception e) {
                    log.error("Could not create video codec instance", e);
                    continue;
                }
                if (codec.canHandleData(data)) {
                    result = codec;
                    break;
                }
            }
        }
        return result;
    }
910291
function getTypeFromFileExtension(url) {
	url = url.toLowerCase().split('?')[0];
	var _ext = url.substring(url.lastIndexOf('.') + 1);
	var _av = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(_ext) ? 'video/' : 'audio/';

	switch (_ext) {
		case 'mp4':
		case 'm4v':
		case 'm4a':
			return _av + 'mp4';
		case 'webm':
		case 'webma':
		case 'webmv':
			return _av + 'webm';
		case 'ogg':
		case 'oga':
		case 'ogv':
			return _av + 'ogg';
		case 'm3u8':
			return 'application/x-mpegurl';
		case 'ts':
			return _av + 'mp2t';
		default:
			return _av + _ext;
	}
}
527343
def get(self, key):
        
        upload = None
        files_states = self.backend.get(key)
        files = MultiValueDict()
        if files_states:
            for name, state in files_states.items():
                f = BytesIO()
                f.write(state['content'])

                # If the post is too large, we cannot use a
                # InMemoryUploadedFile instance.
                if state['size'] > settings.FILE_UPLOAD_MAX_MEMORY_SIZE:
                    upload = TemporaryUploadedFile(
                        state['name'],
                        state['content_type'],
                        state['size'],
                        state['charset'],
                    )
                    upload.file = f
                else:
                    f = BytesIO()
                    f.write(state['content'])
                    upload = InMemoryUploadedFile(
                        file=f,
                        field_name=name,
                        name=state['name'],
                        content_type=state['content_type'],
                        size=state['size'],
                        charset=state['charset'],
                    )
                files[name] = upload

                # Go to the first byte in the file for future use
                upload.file.seek(0)

        return files
463662
def get_codec(path):
    """"""
    if '.' not in path or path.rfind('/') > path.rfind('.'):
        return Codec

    for endings, codec_class in FILE_ENDINGS:
        if any(path.endswith(e) for e in endings):
            log.debug('Using {0} codec: {1}'.format(endings, path))
            return codec_class

    return NoCodec
556786
def _get_content_type(self, filename):
        
        mntype = mimetypes.guess_type(filename)[0]
        filename, fileExtension = os.path.splitext(filename)
        if mntype is None and\
            fileExtension.lower() == ".csv":
            mntype = "text/csv"
        elif mntype is None and \
            fileExtension.lower() == ".sd":
            mntype = "File/sd"
        elif mntype is None:
            #mntype = 'application/octet-stream'
            mntype= "File/%s" % fileExtension.replace('.', '')
        return mntype
910350
function () {
        var contentEncoding = this.headers.get(CONTENT_ENCODING),
            body = this.stream || this.body,
            source;

        if (contentEncoding) {
            source = HEADER;
        }

        // if the encoding is not found, we check
        else if (body) { // @todo add detection for deflate
            // eslint-disable-next-line lodash/prefer-matches
            if (body[0] === 0x1F && body[1] === 0x8B && body[2] === 0x8) {
                contentEncoding = GZIP;
            }

            if (contentEncoding) {
                source = BODY;
            }
        }

        return {
            format: contentEncoding,
            source: source
        };
    }
261480
def _get(self, key):
        
        buf = BytesIO()

        self._get_file(key, buf)

        return buf.getvalue()
288236
function () {
            var filePath = this.getFileName();
            if (!this.__fileContentsCache && filePath) {
                // Leave the stage early when 'Unknown' is passed
                // this would otherwise raise an exception when
                // open_basedir is enabled.
                if (filePath === "Unknown") {
                    return null;
                }

                // Return null if the file doesn't actually exist.
                if (!fs.existsSync(filePath)) {
                    if (process.env.NVM_DIR && process.versions.node) {
                        filePath = path.join(process.env.NVM_DIR, 'src/node-v' + process.versions.node, 'lib', filePath);
                        if (!fs.existsSync(filePath)) {
                            return null;
                        }
                    } else {
                        return null;
                    }
                }

                this.__fileContentsCache = fs.readFileSync(filePath, 'utf-8');
            }

            return this.__fileContentsCache;
        }
372693
def in_noninjected_file(self, file_path, content):
        
        if os.path.exists(file_path):
            file_content = codecs.open(file_path, encoding="utf-8").read()
            file_content = self.wrapper_match.sub(u"", file_content)
        else:
            file_content = ""
        return file_content.find(content) != -1
1002216
@Override
    public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream audioInputStream) {
        AudioFormat sourceFormat = audioInputStream.getFormat();
        AudioFormat targetFormat = new AudioFormat(
                targetEncoding,
                AudioSystem.NOT_SPECIFIED, // sample rate
                AudioSystem.NOT_SPECIFIED, // sample size in bits
                AudioSystem.NOT_SPECIFIED, // channels
                AudioSystem.NOT_SPECIFIED, // frame size
                AudioSystem.NOT_SPECIFIED, // frame rate
                sourceFormat.isBigEndian());  // big endian
        LOG.log(Level.FINE, "TFormatConversionProvider.getAudioInputStream(AudioFormat.Encoding, AudioInputStream):");
        LOG.log(Level.FINE, "trying to convert to {0}", targetFormat);
        return getAudioInputStream(targetFormat, audioInputStream);
    }
513069
function _gpfGetMimeType (fileExtension) {
    var mimeType = _gpfMimeTypesFromExtension[fileExtension.toLowerCase()];
    if (undefined === mimeType) {
        // Default
        mimeType = "application/octet-stream";
    }
    return mimeType;
}
637470
private String getMimeTypeFromFileExtension(String srcFile)
  {
    String srcFileLowCase = srcFile.toLowerCase();

    for (FileCompressionType compressionType : FileCompressionType.values())
    {
      if (srcFileLowCase.endsWith(compressionType.fileExtension))
      {
        return compressionType.mimeType + "/" +
               compressionType.mimeSubTypes.get(0);
      }
    }

    return null;
  }
518324
private byte[] getUploadFileContent(RequestElements requestElements) throws FMSException {
		Attachable attachable = (Attachable) requestElements.getEntity();
		InputStream docContent = requestElements.getUploadRequestElements().getDocContent();
		
		// gets the mime value form the filename
		String mime = getMime(attachable.getFileName(), ".");
		// if null then gets the mime value from content-type of the file
		mime = (mime != null) ? mime : getMime(attachable.getContentType(), "/");
		if (isImageType(mime)) {
			return getImageContent(docContent, mime);
		} else {
			return getContent(docContent);
		}
	}
81903
function () {

			var images = {};
			var blobs = {};

			if ( 'Video' in fbxTree.Objects ) {

				var videoNodes = fbxTree.Objects.Video;

				for ( var nodeID in videoNodes ) {

					var videoNode = videoNodes[ nodeID ];

					var id = parseInt( nodeID );

					images[ id ] = videoNode.RelativeFilename || videoNode.Filename;

					// raw image data is in videoNode.Content
					if ( 'Content' in videoNode ) {

						var arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 );
						var base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' );

						if ( arrayBufferContent || base64Content ) {

							var image = this.parseImage( videoNodes[ nodeID ] );

							blobs[ videoNode.RelativeFilename || videoNode.Filename ] = image;

						}

					}

				}

			}

			for ( var id in images ) {

				var filename = images[ id ];

				if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ];
				else images[ id ] = images[ id ].split( '\\' ).pop();

			}

			return images;

		}