ExportFFmpeg::ExportFFmpeg() : ExportPlugin() { mEncFormatCtx = NULL; // libavformat's context for our output file mEncFormatDesc = NULL; // describes our output file to libavformat mEncAudioStream = NULL; // the output audio stream (may remain NULL) mEncAudioCodecCtx = NULL; // the encoder for the output audio stream mEncAudioEncodedBuf = NULL; // buffer to hold frames encoded by the encoder #define MAX_AUDIO_PACKET_SIZE (128 * 1024) mEncAudioEncodedBufSiz = 4*MAX_AUDIO_PACKET_SIZE; mEncAudioFifoOutBuf = NULL; // buffer to read _out_ of the FIFO into mSampleRate = 0; mSupportsUTF8 = true; PickFFmpegLibs(); // DropFFmpegLibs() call is in ExportFFmpeg::Destroy() int newfmt; // Adds export types from the export type list for (newfmt = 0; newfmt < FMT_LAST; newfmt++) { wxString shortname(ExportFFmpegOptions::fmts[newfmt].shortname); //Don't hide export types when there's no av-libs, and don't hide FMT_OTHER if (newfmt < FMT_OTHER && FFmpegLibsInst->ValidLibsLoaded()) { // Format/Codec support is compiled in? AVOutputFormat *avoformat = FFmpegLibsInst->guess_format(shortname.mb_str(), NULL, NULL); AVCodec *avcodec = FFmpegLibsInst->avcodec_find_encoder(ExportFFmpegOptions::fmts[newfmt].codecid); if (avoformat == NULL || avcodec == NULL) { ExportFFmpegOptions::fmts[newfmt].compiledIn = false; continue; } } int fmtindex = AddFormat() - 1; SetFormat(ExportFFmpegOptions::fmts[newfmt].name,fmtindex); AddExtension(ExportFFmpegOptions::fmts[newfmt].extension,fmtindex); // For some types add other extensions switch(newfmt) { case FMT_M4A: AddExtension(wxString(wxT("3gp")),fmtindex); AddExtension(wxString(wxT("m4r")),fmtindex); AddExtension(wxString(wxT("mp4")),fmtindex); break; case FMT_WMA2: AddExtension(wxString(wxT("asf")),fmtindex); AddExtension(wxString(wxT("wmv")),fmtindex); break; default: break; } SetMaxChannels(ExportFFmpegOptions::fmts[newfmt].maxchannels,fmtindex); SetCanMetaData(ExportFFmpegOptions::fmts[newfmt].canmetadata,fmtindex); SetDescription(ExportFFmpegOptions::fmts[newfmt].description,fmtindex); } }
ExportFLAC::ExportFLAC() : ExportPlugin() { AddFormat(); SetFormat(wxT("FLAC"),0); AddExtension(wxT("flac"),0); SetMaxChannels(FLAC__MAX_CHANNELS,0); SetCanMetaData(true,0); SetDescription(_("FLAC Files"),0); }
ExportMP2::ExportMP2() : ExportPlugin() { AddFormat(); SetFormat(wxT("MP2"),0); AddExtension(wxT("mp2"),0); SetMaxChannels(2,0); SetCanMetaData(true,0); SetDescription(_("MP2 Files"),0); }
ExportOGG::ExportOGG() : ExportPlugin() { AddFormat(); SetFormat(wxT("OGG"),0); AddExtension(wxT("ogg"),0); SetMaxChannels(255,0); SetCanMetaData(true,0); SetDescription(_("Ogg Vorbis Files"),0); }
ExportFFmpeg::ExportFFmpeg() : ExportPlugin() { mEncFormatDesc = NULL; // describes our output file to libavformat mEncAudioStream = NULL; // the output audio stream (may remain NULL) #define MAX_AUDIO_PACKET_SIZE (128 * 1024) mEncAudioFifoOutBufSiz = 0; mSampleRate = 0; mSupportsUTF8 = true; PickFFmpegLibs(); // DropFFmpegLibs() call is in ExportFFmpeg destructor int avfver = FFmpegLibsInst->ValidLibsLoaded() ? avformat_version() : 0; int newfmt; // Adds export types from the export type list for (newfmt = 0; newfmt < FMT_LAST; newfmt++) { wxString shortname(ExportFFmpegOptions::fmts[newfmt].shortname); //Don't hide export types when there's no av-libs, and don't hide FMT_OTHER if (newfmt < FMT_OTHER && FFmpegLibsInst->ValidLibsLoaded()) { // Format/Codec support is compiled in? AVOutputFormat *avoformat = av_guess_format(shortname.mb_str(), NULL, NULL); AVCodec *avcodec = avcodec_find_encoder(ExportFFmpegOptions::fmts[newfmt].codecid); if (avoformat == NULL || avcodec == NULL) { ExportFFmpegOptions::fmts[newfmt].compiledIn = false; continue; } } int fmtindex = AddFormat() - 1; SetFormat(ExportFFmpegOptions::fmts[newfmt].name,fmtindex); AddExtension(ExportFFmpegOptions::fmts[newfmt].extension,fmtindex); // For some types add other extensions switch(newfmt) { case FMT_M4A: AddExtension(wxString(wxT("3gp")),fmtindex); AddExtension(wxString(wxT("m4r")),fmtindex); AddExtension(wxString(wxT("mp4")),fmtindex); break; case FMT_WMA2: AddExtension(wxString(wxT("asf")),fmtindex); AddExtension(wxString(wxT("wmv")),fmtindex); break; default: break; } SetMaxChannels(ExportFFmpegOptions::fmts[newfmt].maxchannels,fmtindex); SetDescription(ExportFFmpegOptions::fmts[newfmt].description,fmtindex); int canmeta = ExportFFmpegOptions::fmts[newfmt].canmetadata; if (canmeta && (canmeta == AV_VERSION_INT(-1,-1,-1) || canmeta <= avfver)) { SetCanMetaData(true,fmtindex); } else { SetCanMetaData(false,fmtindex); } } }