/** * Create and return new video codec applicable for byte buffer data * * @param data Byte buffer data * @return Video codec */ public IVideoStreamCodec getVideoCodec(ByteBuffer data) { IVideoStreamCodec 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; } log.info("Trying codec " + codec); if (codec.canHandleData(data)) { result = codec; break; } } // No codec for this video data return result; }
/** {@inheritDoc} */ public String getVideoCodecName() { if (videoCodec == null) { return null; } return videoCodec.getName(); }