1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Fix indentation (to multiple of three) and remove trailing spaces.

This commit is contained in:
benjamin.drung@gmail.com 2014-05-27 22:06:58 +00:00
parent cda7ade23a
commit b556d83c54
4 changed files with 240 additions and 241 deletions

View File

@ -71,8 +71,8 @@ bool LoadFFmpeg(bool showerror)
PickFFmpegLibs(); PickFFmpegLibs();
if (FFmpegLibsInst->ValidLibsLoaded()) if (FFmpegLibsInst->ValidLibsLoaded())
{ {
DropFFmpegLibs(); DropFFmpegLibs();
return true; return true;
} }
if (!FFmpegLibsInst->LoadLibs(NULL,showerror)) if (!FFmpegLibsInst->LoadLibs(NULL,showerror))
{ {
@ -155,7 +155,7 @@ void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl)
} }
#ifdef EXPERIMENTAL_OD_FFMPEG #ifdef EXPERIMENTAL_OD_FFMPEG
//if the decoding happens thru OD then this gets called from a non main thread, which means wxLogDebug //if the decoding happens thru OD then this gets called from a non main thread, which means wxLogDebug
//will crash. //will crash.
//TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print //TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print
if(!wxThread::IsMain()) if(!wxThread::IsMain())
printf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str()); printf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str());
@ -189,16 +189,16 @@ static int64_t ufile_seek(void *opaque, int64_t pos, int whence)
switch (whence & ~AVSEEK_FORCE) switch (whence & ~AVSEEK_FORCE)
{ {
case (SEEK_SET): case (SEEK_SET):
mode = wxFromStart; mode = wxFromStart;
break; break;
case (SEEK_CUR): case (SEEK_CUR):
mode = wxFromCurrent; mode = wxFromCurrent;
break; break;
case (SEEK_END): case (SEEK_END):
mode = wxFromEnd; mode = wxFromEnd;
break; break;
case (AVSEEK_SIZE): case (AVSEEK_SIZE):
return ((wxFile *) opaque)->Length(); return ((wxFile *) opaque)->Length();
} }
return ((wxFile *) opaque)->Seek(pos, mode); return ((wxFile *) opaque)->Seek(pos, mode);
@ -213,9 +213,9 @@ int ufile_close(AVIOContext *pb)
delete f; delete f;
} }
return 0; return 0;
} }
// Open a file with a (possibly) Unicode filename // Open a file with a (possibly) Unicode filename
int ufile_fopen(AVIOContext **s, const wxString & name, int flags) int ufile_fopen(AVIOContext **s, const wxString & name, int flags)
{ {
@ -276,7 +276,7 @@ int ufile_fopen_input(AVFormatContext **ic_ptr, wxString & name)
*ic_ptr = avformat_alloc_context(); *ic_ptr = avformat_alloc_context();
(*ic_ptr)->pb = pb; (*ic_ptr)->pb = pb;
// And finally, attempt to associate an input stream with the file // And finally, attempt to associate an input stream with the file
err = avformat_open_input(ic_ptr, filename, NULL, NULL); err = avformat_open_input(ic_ptr, filename, NULL, NULL);
if (err) { if (err) {
@ -335,7 +335,7 @@ streamContext *import_ffmpeg_read_next_frame(AVFormatContext* formatContext,
int import_ffmpeg_decode_frame(streamContext *sc, bool flushing) int import_ffmpeg_decode_frame(streamContext *sc, bool flushing)
{ {
int nBytesDecoded; int nBytesDecoded;
wxUint8 *pDecode = sc->m_pktDataPtr; wxUint8 *pDecode = sc->m_pktDataPtr;
int nDecodeSiz = sc->m_pktRemainingSiz; int nDecodeSiz = sc->m_pktRemainingSiz;
@ -363,13 +363,13 @@ int import_ffmpeg_decode_frame(streamContext *sc, bool flushing)
AVFrame *frame = av_frame_alloc(); AVFrame *frame = av_frame_alloc();
int got_output = 0; int got_output = 0;
nBytesDecoded = nBytesDecoded =
avcodec_decode_audio4(sc->m_codecCtx, avcodec_decode_audio4(sc->m_codecCtx,
frame, // out frame, // out
&got_output, // out &got_output, // out
&avpkt); // in &avpkt); // in
if (nBytesDecoded < 0) if (nBytesDecoded < 0)
{ {
// Decoding failed. Don't stop. // Decoding failed. Don't stop.
@ -404,15 +404,15 @@ int import_ffmpeg_decode_frame(streamContext *sc, bool flushing)
} }
} }
if (frame->data[1]) { if (frame->data[1]) {
for (int i = 0; i<frame->nb_samples; i++) { for (int i = 0; i<frame->nb_samples; i++) {
for (int ch = 0; ch<channels; ch++) { for (int ch = 0; ch<channels; ch++) {
memcpy(sc->m_decodedAudioSamples + sc->m_samplesize * (ch + channels*i), memcpy(sc->m_decodedAudioSamples + sc->m_samplesize * (ch + channels*i),
frame->extended_data[ch] + sc->m_samplesize*i, frame->extended_data[ch] + sc->m_samplesize*i,
sc->m_samplesize); sc->m_samplesize);
} }
} }
} else { } else {
memcpy(sc->m_decodedAudioSamples, frame->data[0], newsize); memcpy(sc->m_decodedAudioSamples, frame->data[0], newsize);
} }
av_frame_free(&frame); av_frame_free(&frame);
@ -518,7 +518,7 @@ public:
"Where would I find the file '%s'?" instead if you want. */ "Where would I find the file '%s'?" instead if you want. */
question.Printf(_("Where is '%s'?"), mName.c_str()); question.Printf(_("Where is '%s'?"), mName.c_str());
wxString path = FileSelector(question, wxString path = FileSelector(question,
mLibPath.GetPath(), mLibPath.GetPath(),
mLibPath.GetName(), mLibPath.GetName(),
wxT(""), wxT(""),
@ -605,7 +605,7 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
else { else {
path = GetLibAVFormatPath(); path = GetLibAVFormatPath();
name = GetLibAVFormatName(); name = GetLibAVFormatName();
wxLogMessage(wxT("mLibAVFormatPath is empty, starting with path '%s', name '%s'."), wxLogMessage(wxT("mLibAVFormatPath is empty, starting with path '%s', name '%s'."),
path.c_str(), name.c_str()); path.c_str(), name.c_str());
} }
@ -663,7 +663,7 @@ bool FFmpegLibs::LoadLibs(wxWindow * WXUNUSED(parent), bool showerr)
mLibAVFormatPath = path; mLibAVFormatPath = path;
} }
} }
#if defined(__WXMAC__) #if defined(__WXMAC__)
// If not successful, try loading it from legacy path // If not successful, try loading it from legacy path
if (!mLibsLoaded && !GetLibAVFormatPath().IsEmpty()) { if (!mLibsLoaded && !GetLibAVFormatPath().IsEmpty()) {
@ -697,16 +697,16 @@ bool FFmpegLibs::LoadLibs(wxWindow * WXUNUSED(parent), bool showerr)
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0); gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
if ((dontShowDlg == 0) && (showerr)) if ((dontShowDlg == 0) && (showerr))
{ {
dlg = new FFmpegNotFoundDialog(NULL); dlg = new FFmpegNotFoundDialog(NULL);
dlg->ShowModal(); dlg->ShowModal();
delete dlg; delete dlg;
} }
} }
*/ */
// Oh well, just give up // Oh well, just give up
if (!ValidLibsLoaded()) { if (!ValidLibsLoaded()) {
wxString msg = _("Failed to find compatible FFmpeg libraries."); wxString msg = _("Failed to find compatible FFmpeg libraries.");
if (showerr) if (showerr)
wxMessageBox(msg); wxMessageBox(msg);
wxLogError(msg); wxLogError(msg);
return false; return false;
@ -791,8 +791,8 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
if (actual.GetFullPath().IsSameAs(name.GetFullPath())) { if (actual.GetFullPath().IsSameAs(name.GetFullPath())) {
actual = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avcodec_version"))); actual = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avcodec_version")));
if (actual.GetFullPath().IsSameAs(name.GetFullPath())) { if (actual.GetFullPath().IsSameAs(name.GetFullPath())) {
util = avformat; util = avformat;
codec = avformat; codec = avformat;
} }
} }
@ -941,7 +941,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
//FFmpeg initialization //FFmpeg initialization
avcodec_register_all(); avcodec_register_all();
av_register_all(); av_register_all();
wxLogMessage(wxT("Retrieving FFmpeg library version numbers:")); wxLogMessage(wxT("Retrieving FFmpeg library version numbers:"));
int avfver = avformat_version(); int avfver = avformat_version();
int avcver = avcodec_version(); int avcver = avcodec_version();
@ -950,14 +950,14 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
mAVFormatVersion = wxString::Format(wxT("%d.%d.%d"),avfver >> 16 & 0xFF, avfver >> 8 & 0xFF, avfver & 0xFF); mAVFormatVersion = wxString::Format(wxT("%d.%d.%d"),avfver >> 16 & 0xFF, avfver >> 8 & 0xFF, avfver & 0xFF);
mAVUtilVersion = wxString::Format(wxT("%d.%d.%d"),avuver >> 16 & 0xFF, avuver >> 8 & 0xFF, avuver & 0xFF); mAVUtilVersion = wxString::Format(wxT("%d.%d.%d"),avuver >> 16 & 0xFF, avuver >> 8 & 0xFF, avuver & 0xFF);
wxLogMessage(wxT(" AVCodec version 0x%06x - %s (built against 0x%06x - %s)"), wxLogMessage(wxT(" AVCodec version 0x%06x - %s (built against 0x%06x - %s)"),
avcver, mAVCodecVersion.c_str(), LIBAVCODEC_VERSION_INT, avcver, mAVCodecVersion.c_str(), LIBAVCODEC_VERSION_INT,
wxString::FromUTF8(AV_STRINGIFY(LIBAVCODEC_VERSION)).c_str()); wxString::FromUTF8(AV_STRINGIFY(LIBAVCODEC_VERSION)).c_str());
wxLogMessage(wxT(" AVFormat version 0x%06x - %s (built against 0x%06x - %s)"), wxLogMessage(wxT(" AVFormat version 0x%06x - %s (built against 0x%06x - %s)"),
avfver, mAVFormatVersion.c_str(), LIBAVFORMAT_VERSION_INT, avfver, mAVFormatVersion.c_str(), LIBAVFORMAT_VERSION_INT,
wxString::FromUTF8(AV_STRINGIFY(LIBAVFORMAT_VERSION)).c_str()); wxString::FromUTF8(AV_STRINGIFY(LIBAVFORMAT_VERSION)).c_str());
wxLogMessage(wxT(" AVUtil version 0x%06x - %s (built against 0x%06x - %s)"), wxLogMessage(wxT(" AVUtil version 0x%06x - %s (built against 0x%06x - %s)"),
avuver,mAVUtilVersion.c_str(), LIBAVUTIL_VERSION_INT, avuver,mAVUtilVersion.c_str(), LIBAVUTIL_VERSION_INT,
wxString::FromUTF8(AV_STRINGIFY(LIBAVUTIL_VERSION)).c_str()); wxString::FromUTF8(AV_STRINGIFY(LIBAVUTIL_VERSION)).c_str());
int avcverdiff = (avcver >> 16 & 0xFF) - int(LIBAVCODEC_VERSION_MAJOR); int avcverdiff = (avcver >> 16 & 0xFF) - int(LIBAVCODEC_VERSION_MAJOR);

View File

@ -12,8 +12,8 @@
******************************************************************//** ******************************************************************//**
\class ExportFFmpeg \class ExportFFmpeg
\brief Controlling class for FFmpeg exporting. Creates the options \brief Controlling class for FFmpeg exporting. Creates the options
dialog of the appropriate type, adds tags and invokes the export dialog of the appropriate type, adds tags and invokes the export
function. function.
*//*******************************************************************/ *//*******************************************************************/
@ -97,14 +97,14 @@ public:
/// Format intialization /// Format intialization
bool Init(const char *shortname, AudacityProject *project, Tags *metadata, int subformat); bool Init(const char *shortname, AudacityProject *project, Tags *metadata, int subformat);
/// Codec intialization /// Codec intialization
bool InitCodecs(AudacityProject *project); bool InitCodecs(AudacityProject *project);
/// Writes metadata /// Writes metadata
bool AddTags(Tags *metadata); bool AddTags(Tags *metadata);
/// Sets individual metadata values /// Sets individual metadata values
void SetMetadata(Tags *tags, const char *name, const wxChar *tag); void SetMetadata(Tags *tags, const char *name, const wxChar *tag);
/// Encodes audio /// Encodes audio
@ -177,7 +177,7 @@ ExportFFmpeg::ExportFFmpeg()
#define MAX_AUDIO_PACKET_SIZE (128 * 1024) #define MAX_AUDIO_PACKET_SIZE (128 * 1024)
mEncAudioFifoOutBuf = NULL; // buffer to read _out_ of the FIFO into mEncAudioFifoOutBuf = NULL; // buffer to read _out_ of the FIFO into
mEncAudioFifoOutBufSiz = 0; mEncAudioFifoOutBufSiz = 0;
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 0, 0) #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 0, 0)
mEncAudioFifo = &mEncAudioFifoBuffer; mEncAudioFifo = &mEncAudioFifoBuffer;
#endif #endif
@ -282,7 +282,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
// Initialise the output format context. // Initialise the output format context.
mEncFormatCtx->oformat = mEncFormatDesc; mEncFormatCtx->oformat = mEncFormatDesc;
memcpy(mEncFormatCtx->filename, OSINPUT(mName), strlen(OSINPUT(mName))+1); memcpy(mEncFormatCtx->filename, OSINPUT(mName), strlen(OSINPUT(mName))+1);
// At the moment Audacity can export only one audio stream // At the moment Audacity can export only one audio stream
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 10, 0)) #if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 10, 0))
if ((mEncAudioStream = av_new_stream(mEncFormatCtx, 1)) == NULL) if ((mEncAudioStream = av_new_stream(mEncFormatCtx, 1)) == NULL)
@ -341,9 +341,9 @@ bool ExportFFmpeg::CheckSampleRate(int rate, int lowrate, int highrate, const in
static int set_dict_int(AVDictionary **dict, const char *key, int val) static int set_dict_int(AVDictionary **dict, const char *key, int val)
{ {
char val_str[256]; char val_str[256];
snprintf(val_str, sizeof(val_str), "%d", val); snprintf(val_str, sizeof(val_str), "%d", val);
return av_dict_set(dict, key, val_str, 0); return av_dict_set(dict, key, val_str, 0);
} }
bool ExportFFmpeg::InitCodecs(AudacityProject *project) bool ExportFFmpeg::InitCodecs(AudacityProject *project)
@ -353,7 +353,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Configure the audio stream's codec context. // Configure the audio stream's codec context.
mEncAudioCodecCtx = mEncAudioStream->codec; mEncAudioCodecCtx = mEncAudioStream->codec;
mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid; mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid;
mEncAudioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO; mEncAudioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
mEncAudioCodecCtx->codec_tag = av_codec_get_tag((const AVCodecTag **)mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id); mEncAudioCodecCtx->codec_tag = av_codec_get_tag((const AVCodecTag **)mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id);
@ -404,7 +404,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
mEncAudioCodecCtx->cutoff = gPrefs->Read(wxT("/FileFormats/FFmpegCutOff"),(long)0); mEncAudioCodecCtx->cutoff = gPrefs->Read(wxT("/FileFormats/FFmpegCutOff"),(long)0);
mEncAudioCodecCtx->flags2 = 0; mEncAudioCodecCtx->flags2 = 0;
if (gPrefs->Read(wxT("/FileFormats/FFmpegBitReservoir"),true)) if (gPrefs->Read(wxT("/FileFormats/FFmpegBitReservoir"),true))
av_dict_set(&options, "reservoir", "1", 0); av_dict_set(&options, "reservoir", "1", 0);
if (gPrefs->Read(wxT("/FileFormats/FFmpegVariableBlockLen"),true)) mEncAudioCodecCtx->flags2 |= 0x0004; //WMA only? if (gPrefs->Read(wxT("/FileFormats/FFmpegVariableBlockLen"),true)) mEncAudioCodecCtx->flags2 |= 0x0004; //WMA only?
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0)
mEncAudioCodecCtx->use_lpc = gPrefs->Read(wxT("/FileFormats/FFmpegUseLPC"),true); mEncAudioCodecCtx->use_lpc = gPrefs->Read(wxT("/FileFormats/FFmpegUseLPC"),true);
@ -497,12 +497,12 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
default_frame_size = mEncAudioCodecCtx->frame_size; default_frame_size = mEncAudioCodecCtx->frame_size;
if (default_frame_size == 0) if (default_frame_size == 0)
default_frame_size = 1024; // arbitrary non zero value; default_frame_size = 1024; // arbitrary non zero value;
wxLogDebug(wxT("FFmpeg : Audio Output Codec Frame Size: %d samples."), mEncAudioCodecCtx->frame_size); wxLogDebug(wxT("FFmpeg : Audio Output Codec Frame Size: %d samples."), mEncAudioCodecCtx->frame_size);
// The encoder may require a minimum number of raw audio samples for each encoding but we can't // The encoder may require a minimum number of raw audio samples for each encoding but we can't
// guarantee we'll get this minimum each time an audio frame is decoded from the input file so // guarantee we'll get this minimum each time an audio frame is decoded from the input file so
// we use a FIFO to store up incoming raw samples until we have enough for one call to the codec. // we use a FIFO to store up incoming raw samples until we have enough for one call to the codec.
#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(49, 15, 0) #if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(49, 15, 0)
mEncAudioFifo = av_fifo_alloc(1024); mEncAudioFifo = av_fifo_alloc(1024);
@ -614,7 +614,7 @@ bool ExportFFmpeg::Finalize()
} }
// Flush the audio FIFO first if necessary. It won't contain a _full_ audio frame because // Flush the audio FIFO first if necessary. It won't contain a _full_ audio frame because
// if it did we'd have pulled it from the FIFO during the last encodeAudioFrame() call - // if it did we'd have pulled it from the FIFO during the last encodeAudioFrame() call -
// the encoder must support short/incomplete frames for this to work. // the encoder must support short/incomplete frames for this to work.
if (nFifoBytes > 0) if (nFifoBytes > 0)
{ {
@ -640,7 +640,7 @@ bool ExportFFmpeg::Finalize()
if (codec->capabilities & (CODEC_CAP_SMALL_LAST_FRAME|CODEC_CAP_VARIABLE_FRAME_SIZE)) if (codec->capabilities & (CODEC_CAP_SMALL_LAST_FRAME|CODEC_CAP_VARIABLE_FRAME_SIZE))
frame_size = nFifoBytes / (mEncAudioCodecCtx->channels * sizeof(int16_t)); frame_size = nFifoBytes / (mEncAudioCodecCtx->channels * sizeof(int16_t));
wxLogDebug(wxT("FFmpeg : Audio FIFO still contains %d bytes, writing %d sample frame ..."), wxLogDebug(wxT("FFmpeg : Audio FIFO still contains %d bytes, writing %d sample frame ..."),
nFifoBytes, frame_size); nFifoBytes, frame_size);
// Pull the bytes out from the FIFO and feed them to the encoder. // Pull the bytes out from the FIFO and feed them to the encoder.
@ -659,7 +659,7 @@ bool ExportFFmpeg::Finalize()
if (nEncodedBytes <= 0) if (nEncodedBytes <= 0)
nEncodedBytes = encode_audio(mEncAudioCodecCtx, &pkt, NULL, 0); nEncodedBytes = encode_audio(mEncAudioCodecCtx, &pkt, NULL, 0);
if (nEncodedBytes <= 0) if (nEncodedBytes <= 0)
break; break;
pkt.stream_index = mEncAudioStream->index; pkt.stream_index = mEncAudioStream->index;
@ -790,9 +790,9 @@ int ExportFFmpeg::Export(AudacityProject *project,
wxLogError(wxT("Attempted to export %d channels, but max. channels = %d"),channels,ExportFFmpegOptions::fmts[mSubFormat].maxchannels); wxLogError(wxT("Attempted to export %d channels, but max. channels = %d"),channels,ExportFFmpegOptions::fmts[mSubFormat].maxchannels);
wxMessageBox( wxMessageBox(
wxString::Format( wxString::Format(
_("Attempted to export %d channels, but maximum number of channels for selected output format is %d"), _("Attempted to export %d channels, but maximum number of channels for selected output format is %d"),
channels, channels,
ExportFFmpegOptions::fmts[mSubFormat].maxchannels), ExportFFmpegOptions::fmts[mSubFormat].maxchannels),
_("Error")); _("Error"));
return false; return false;
} }
@ -801,7 +801,7 @@ int ExportFFmpeg::Export(AudacityProject *project,
bool ret = true; bool ret = true;
if (mSubFormat >= FMT_LAST) return false; if (mSubFormat >= FMT_LAST) return false;
wxString shortname(ExportFFmpegOptions::fmts[mSubFormat].shortname); wxString shortname(ExportFFmpegOptions::fmts[mSubFormat].shortname);
if (mSubFormat == FMT_OTHER) if (mSubFormat == FMT_OTHER)
shortname = gPrefs->Read(wxT("/FileFormats/FFmpegFormat"),wxT("matroska")); shortname = gPrefs->Read(wxT("/FileFormats/FFmpegFormat"),wxT("matroska"));

View File

@ -163,8 +163,8 @@ ExportFFmpegAC3Options::ExportFFmpegAC3Options(wxWindow *parent)
PopulateOrExchange(S); PopulateOrExchange(S);
} }
/// ///
/// ///
void ExportFFmpegAC3Options::PopulateOrExchange(ShuttleGui & S) void ExportFFmpegAC3Options::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartHorizontalLay(wxEXPAND, 0); S.StartHorizontalLay(wxEXPAND, 0);
@ -173,7 +173,7 @@ void ExportFFmpegAC3Options::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartTwoColumn(); S.StartTwoColumn();
{ {
S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/AC3BitRate"), S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/AC3BitRate"),
160000, mBitRateNames, mBitRateLabels); 160000, mBitRateNames, mBitRateLabels);
} }
S.EndTwoColumn(); S.EndTwoColumn();
@ -192,8 +192,8 @@ void ExportFFmpegAC3Options::PopulateOrExchange(ShuttleGui & S)
return; return;
} }
/// ///
/// ///
void ExportFFmpegAC3Options::OnOK(wxCommandEvent& WXUNUSED(event)) void ExportFFmpegAC3Options::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
ShuttleGui S(this, eIsSavingToPrefs); ShuttleGui S(this, eIsSavingToPrefs);
@ -221,8 +221,8 @@ ExportFFmpegAACOptions::ExportFFmpegAACOptions(wxWindow *parent)
PopulateOrExchange(S); PopulateOrExchange(S);
} }
/// ///
/// ///
void ExportFFmpegAACOptions::PopulateOrExchange(ShuttleGui & S) void ExportFFmpegAACOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartStatic(_("AAC Export Setup"), 1); S.StartStatic(_("AAC Export Setup"), 1);
@ -245,8 +245,8 @@ void ExportFFmpegAACOptions::PopulateOrExchange(ShuttleGui & S)
return; return;
} }
/// ///
/// ///
void ExportFFmpegAACOptions::OnOK(wxCommandEvent& WXUNUSED(event)) void ExportFFmpegAACOptions::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
ShuttleGui S(this, eIsSavingToPrefs); ShuttleGui S(this, eIsSavingToPrefs);
@ -286,8 +286,8 @@ ExportFFmpegAMRNBOptions::ExportFFmpegAMRNBOptions(wxWindow *parent)
PopulateOrExchange(S); PopulateOrExchange(S);
} }
/// ///
/// ///
void ExportFFmpegAMRNBOptions::PopulateOrExchange(ShuttleGui & S) void ExportFFmpegAMRNBOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartHorizontalLay(wxEXPAND, 0); S.StartHorizontalLay(wxEXPAND, 0);
@ -296,7 +296,7 @@ void ExportFFmpegAMRNBOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartTwoColumn(); S.StartTwoColumn();
{ {
S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/AMRNBBitRate"), S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/AMRNBBitRate"),
12200, mBitRateNames, mBitRateLabels); 12200, mBitRateNames, mBitRateLabels);
} }
S.EndTwoColumn(); S.EndTwoColumn();
@ -315,8 +315,8 @@ void ExportFFmpegAMRNBOptions::PopulateOrExchange(ShuttleGui & S)
return; return;
} }
/// ///
/// ///
void ExportFFmpegAMRNBOptions::OnOK(wxCommandEvent& WXUNUSED(event)) void ExportFFmpegAMRNBOptions::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
ShuttleGui S(this, eIsSavingToPrefs); ShuttleGui S(this, eIsSavingToPrefs);
@ -358,8 +358,8 @@ ExportFFmpegWMAOptions::ExportFFmpegWMAOptions(wxWindow *parent)
PopulateOrExchange(S); PopulateOrExchange(S);
} }
/// ///
/// ///
void ExportFFmpegWMAOptions::PopulateOrExchange(ShuttleGui & S) void ExportFFmpegWMAOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartHorizontalLay(wxEXPAND, 0); S.StartHorizontalLay(wxEXPAND, 0);
@ -368,7 +368,7 @@ void ExportFFmpegWMAOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartTwoColumn(); S.StartTwoColumn();
{ {
S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/WMABitRate"), S.TieChoice(_("Bit Rate:"), wxT("/FileFormats/WMABitRate"),
96000, mBitRateNames, mBitRateLabels); 96000, mBitRateNames, mBitRateLabels);
} }
S.EndTwoColumn(); S.EndTwoColumn();
@ -387,8 +387,8 @@ void ExportFFmpegWMAOptions::PopulateOrExchange(ShuttleGui & S)
return; return;
} }
/// ///
/// ///
void ExportFFmpegWMAOptions::OnOK(wxCommandEvent& WXUNUSED(event)) void ExportFFmpegWMAOptions::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
ShuttleGui S(this, eIsSavingToPrefs); ShuttleGui S(this, eIsSavingToPrefs);
@ -458,7 +458,7 @@ wxArrayString *FFmpegPresets::GetPresetList()
{ {
FFmpegPreset *preset = *iter; FFmpegPreset *preset = *iter;
list->Add(*preset->mPresetName); list->Add(*preset->mPresetName);
} }
return list; return list;
} }
@ -542,7 +542,7 @@ void FFmpegPresets::SavePreset(ExportFFmpegOptions *parent, wxString &name)
// Spin control // Spin control
case FEBitrateID: case FEBitrateID:
case FEQualityID: case FEQualityID:
case FESampleRateID: case FESampleRateID:
case FECutoffID: case FECutoffID:
case FEFrameSizeID: case FEFrameSizeID:
case FEBufSizeID: case FEBufSizeID:
@ -625,7 +625,7 @@ void FFmpegPresets::LoadPreset(ExportFFmpegOptions *parent, wxString &name)
case FELPCCoeffsID: case FELPCCoeffsID:
case FEMinPredID: case FEMinPredID:
case FEMaxPredID: case FEMaxPredID:
case FEMinPartOrderID: case FEMinPartOrderID:
case FEMaxPartOrderID: case FEMaxPartOrderID:
case FEMuxRateID: case FEMuxRateID:
case FEPacketSizeID: case FEPacketSizeID:
@ -793,7 +793,7 @@ END_EVENT_TABLE()
/// Format-codec compatibility list /// Format-codec compatibility list
/// Must end with NULL entry /// Must end with NULL entry
CompatibilityEntry ExportFFmpegOptions::CompatibilityList[] = CompatibilityEntry ExportFFmpegOptions::CompatibilityList[] =
{ {
{ wxT("adts"), CODEC_ID_AAC }, { wxT("adts"), CODEC_ID_AAC },
@ -1137,7 +1137,7 @@ const int ExportFFmpegOptions::iAACSampleRates[] = { 7350, 8000, 11025, 12000, 1
/// "any" - any format /// "any" - any format
/// CODEC_ID_NONE - any codec /// CODEC_ID_NONE - any codec
/// This list must end with {FALSE,FFmpegExportCtrlID(0),CODEC_ID_NONE,NULL} /// This list must end with {FALSE,FFmpegExportCtrlID(0),CODEC_ID_NONE,NULL}
ApplicableFor ExportFFmpegOptions::apptable[] = ApplicableFor ExportFFmpegOptions::apptable[] =
{ {
{TRUE,FEQualityID,CODEC_ID_AAC,"any"}, {TRUE,FEQualityID,CODEC_ID_AAC,"any"},
{TRUE,FEQualityID,CODEC_ID_MP3,"any"}, {TRUE,FEQualityID,CODEC_ID_MP3,"any"},
@ -1309,157 +1309,156 @@ void ExportFFmpegOptions::FetchCodecList()
mShownCodecLongNames = mCodecLongNames; mShownCodecLongNames = mCodecLongNames;
} }
/// ///
/// ///
void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S) void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
{ {
S.StartVerticalLay(1); S.StartVerticalLay(1);
S.StartMultiColumn(1, wxEXPAND); S.StartMultiColumn(1, wxEXPAND);
{ {
S.SetStretchyRow(3); S.SetStretchyRow(3);
S.StartMultiColumn(7, wxEXPAND); S.StartMultiColumn(7, wxEXPAND);
{ {
S.SetStretchyCol(1); S.SetStretchyCol(1);
mPresetCombo = S.Id(FEPresetID).AddCombo(_("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames); mPresetCombo = S.Id(FEPresetID).AddCombo(_("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames);
mLoadPreset = S.Id(FELoadPresetID).AddButton(_("Load Preset")); mLoadPreset = S.Id(FELoadPresetID).AddButton(_("Load Preset"));
mSavePreset = S.Id(FESavePresetID).AddButton(_("Save Preset")); mSavePreset = S.Id(FESavePresetID).AddButton(_("Save Preset"));
mDeletePreset = S.Id(FEDeletePresetID).AddButton(_("Delete Preset")); mDeletePreset = S.Id(FEDeletePresetID).AddButton(_("Delete Preset"));
mImportPresets = S.Id(FEImportPresetsID).AddButton(_("Import Presets")); mImportPresets = S.Id(FEImportPresetsID).AddButton(_("Import Presets"));
mExportPresets = S.Id(FEExportPresetsID).AddButton(_("Export Presets")); mExportPresets = S.Id(FEExportPresetsID).AddButton(_("Export Presets"));
} }
S.EndMultiColumn(); S.EndMultiColumn();
S.StartMultiColumn(4, wxALIGN_LEFT); S.StartMultiColumn(4, wxALIGN_LEFT);
{ {
S.SetStretchyCol(1); S.SetStretchyCol(1);
S.SetStretchyCol(3); S.SetStretchyCol(3);
S.Id(FEFormatLabelID).AddFixedText(_("Format:")); S.Id(FEFormatLabelID).AddFixedText(_("Format:"));
mFormatName = S.Id(FEFormatNameID).AddVariableText(wxT("")); mFormatName = S.Id(FEFormatNameID).AddVariableText(wxT(""));
S.Id(FECodecLabelID).AddFixedText(_("Codec:")); S.Id(FECodecLabelID).AddFixedText(_("Codec:"));
mCodecName = S.Id(FECodecNameID).AddVariableText(wxT("")); mCodecName = S.Id(FECodecNameID).AddVariableText(wxT(""));
} }
S.EndMultiColumn(); S.EndMultiColumn();
S.AddVariableText(_("Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs."), false); S.AddVariableText(_("Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs."), false);
S.StartMultiColumn(2, wxEXPAND); S.StartMultiColumn(2, wxEXPAND);
{ {
S.StartMultiColumn(2, wxEXPAND); S.StartMultiColumn(2, wxEXPAND);
{ {
S.SetStretchyRow(1); S.SetStretchyRow(1);
S.Id(FEAllFormatsID).AddButton(_("Show All Formats")); S.Id(FEAllFormatsID).AddButton(_("Show All Formats"));
S.Id(FEAllCodecsID).AddButton(_("Show All Codecs")); S.Id(FEAllCodecsID).AddButton(_("Show All Codecs"));
mFormatList = S.Id(FEFormatID).AddListBox(&mFormatNames); mFormatList = S.Id(FEFormatID).AddListBox(&mFormatNames);
mFormatList->DeselectAll(); mFormatList->DeselectAll();
mCodecList = S.Id(FECodecID).AddListBox(&mCodecNames); mCodecList = S.Id(FECodecID).AddListBox(&mCodecNames);
mCodecList->DeselectAll(); mCodecList->DeselectAll();
} }
S.EndMultiColumn(); S.EndMultiColumn();
S.StartVerticalLay(); S.StartVerticalLay();
{ {
// S.StartScroller( ); //S.StartScroller( );
S.SetBorder( 3 ); S.SetBorder( 3 );
S.StartStatic(_("General Options"), 0); S.StartStatic(_("General Options"), 0);
{ {
S.StartMultiColumn(8, wxEXPAND); S.StartMultiColumn(8, wxEXPAND);
{ {
mLanguageText = S.Id(FELanguageID).TieTextBox(_("Language:"), wxT("/FileFormats/FFmpegLanguage"), wxEmptyString, 9); mLanguageText = S.Id(FELanguageID).TieTextBox(_("Language:"), wxT("/FileFormats/FFmpegLanguage"), wxEmptyString, 9);
mLanguageText->SetToolTip(_("ISO 639 3-letter language code\nOptional\nempty - automatic")); mLanguageText->SetToolTip(_("ISO 639 3-letter language code\nOptional\nempty - automatic"));
S.AddSpace( 20,0 ); S.AddSpace( 20,0 );
S.AddVariableText(_("Bit Reservoir")); S.AddVariableText(_("Bit Reservoir"));
S.Id(FEBitReservoirID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegBitReservoir"), true); S.Id(FEBitReservoirID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegBitReservoir"), true);
S.AddSpace( 20,0 ); S.AddSpace( 20,0 );
S.AddVariableText(_("VBL")); S.AddVariableText(_("VBL"));
S.Id(FEVariableBlockLenID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegVariableBlockLen"), true); S.Id(FEVariableBlockLenID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegVariableBlockLen"), true);
} }
S.EndMultiColumn(); S.EndMultiColumn();
S.StartMultiColumn(4, wxALIGN_LEFT); S.StartMultiColumn(4, wxALIGN_LEFT);
{ {
mTag = S.Id(FETagID).TieTextBox(_("Tag:"), wxT("/FileFormats/FFmpegTag"), wxEmptyString, 4); mTag = S.Id(FETagID).TieTextBox(_("Tag:"), wxT("/FileFormats/FFmpegTag"), wxEmptyString, 4);
mTag->SetToolTip(_("Codec tag (FOURCC)\nOptional\nempty - automatic")); mTag->SetToolTip(_("Codec tag (FOURCC)\nOptional\nempty - automatic"));
mBitrateSpin = S.Id(FEBitrateID).TieSpinCtrl(_("Bit Rate:"), wxT("/FileFormats/FFmpegBitRate"), 0, 1000000, 0); mBitrateSpin = S.Id(FEBitrateID).TieSpinCtrl(_("Bit Rate:"), wxT("/FileFormats/FFmpegBitRate"), 0, 1000000, 0);
mBitrateSpin->SetToolTip(_("Bit Rate (bits/second) - influences the resulting file size and quality\nSome codecs may only accept specific values (128k, 192k, 256k etc)\n0 - automatic\nRecommended - 192000")); mBitrateSpin->SetToolTip(_("Bit Rate (bits/second) - influences the resulting file size and quality\nSome codecs may only accept specific values (128k, 192k, 256k etc)\n0 - automatic\nRecommended - 192000"));
mQualitySpin = S.Id(FEQualityID).TieSpinCtrl(_("Quality:"), wxT("/FileFormats/FFmpegQuality"), 0, 500, -1); mQualitySpin = S.Id(FEQualityID).TieSpinCtrl(_("Quality:"), wxT("/FileFormats/FFmpegQuality"), 0, 500, -1);
mQualitySpin->SetToolTip(_("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)")); mQualitySpin->SetToolTip(_("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)"));
mSampleRateSpin = S.Id(FESampleRateID).TieSpinCtrl(_("Sample Rate:"), wxT("/FileFormats/FFmpegSampleRate"), 0, 200000, 0); mSampleRateSpin = S.Id(FESampleRateID).TieSpinCtrl(_("Sample Rate:"), wxT("/FileFormats/FFmpegSampleRate"), 0, 200000, 0);
mSampleRateSpin->SetToolTip(_("Sample rate (Hz)\n0 - don't change sample rate")); mSampleRateSpin->SetToolTip(_("Sample rate (Hz)\n0 - don't change sample rate"));
mCutoffSpin = S.Id(FECutoffID).TieSpinCtrl(_("Cutoff:"), wxT("/FileFormats/FFmpegCutOff"), 0, 10000000, 0); mCutoffSpin = S.Id(FECutoffID).TieSpinCtrl(_("Cutoff:"), wxT("/FileFormats/FFmpegCutOff"), 0, 10000000, 0);
mCutoffSpin->SetToolTip(_("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic")); mCutoffSpin->SetToolTip(_("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic"));
mProfileChoice = S.Id(FEProfileID).TieChoice(_("Profile:"), wxT("/FileFormats/FFmpegAACProfile"), mProfileChoice = S.Id(FEProfileID).TieChoice(_("Profile:"), wxT("/FileFormats/FFmpegAACProfile"),
mProfileLabels[0], mProfileNames, mProfileLabels); mProfileLabels[0], mProfileNames, mProfileLabels);
mProfileChoice->SetSizeHints( 100,-1); mProfileChoice->SetSizeHints( 100,-1);
mProfileChoice->SetToolTip(_("AAC Profile\nLow Complexity -default\nMost players won't play anything other than LC")); mProfileChoice->SetToolTip(_("AAC Profile\nLow Complexity -default\nMost players won't play anything other than LC"));
} }
S.EndMultiColumn(); S.EndMultiColumn();
} }
S.EndStatic(); S.EndStatic();
S.StartStatic(_("FLAC options"),0); S.StartStatic(_("FLAC options"),0);
{ {
S.StartMultiColumn(4, wxALIGN_LEFT); S.StartMultiColumn(4, wxALIGN_LEFT);
{ {
mCompressionLevelSpin = S.Id(FECompLevelID).TieSpinCtrl(_("Compression:"), wxT("/FileFormats/FFmpegCompLevel"), 0, 10, -1); mCompressionLevelSpin = S.Id(FECompLevelID).TieSpinCtrl(_("Compression:"), wxT("/FileFormats/FFmpegCompLevel"), 0, 10, -1);
mCompressionLevelSpin->SetToolTip(_("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)")); mCompressionLevelSpin->SetToolTip(_("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)"));
mFrameSizeSpin = S.Id(FEFrameSizeID).TieSpinCtrl(_("Frame:"), wxT("/FileFormats/FFmpegFrameSize"), 0, 65535, 0); mFrameSizeSpin = S.Id(FEFrameSizeID).TieSpinCtrl(_("Frame:"), wxT("/FileFormats/FFmpegFrameSize"), 0, 65535, 0);
mFrameSizeSpin->SetToolTip(_("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535")); mFrameSizeSpin->SetToolTip(_("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535"));
mLPCCoeffsPrecisionSpin = S.Id(FELPCCoeffsID).TieSpinCtrl(_("LPC"), wxT("/FileFormats/FFmpegLPCCoefPrec"), 0, 15, 0); mLPCCoeffsPrecisionSpin = S.Id(FELPCCoeffsID).TieSpinCtrl(_("LPC"), wxT("/FileFormats/FFmpegLPCCoefPrec"), 0, 15, 0);
mLPCCoeffsPrecisionSpin->SetToolTip(_("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15")); mLPCCoeffsPrecisionSpin->SetToolTip(_("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15"));
mPredictionOrderMethodChoice = S.Id(FEPredOrderID).TieChoice(_("PdO Method:"), wxT("/FileFormats/FFmpegPredOrderMethod"), mPredictionOrderMethodChoice = S.Id(FEPredOrderID).TieChoice(_("PdO Method:"), wxT("/FileFormats/FFmpegPredOrderMethod"),
mPredictionOrderMethodLabels[4], mPredictionOrderMethodNames, mPredictionOrderMethodLabels); mPredictionOrderMethodLabels[4], mPredictionOrderMethodNames, mPredictionOrderMethodLabels);
mPredictionOrderMethodChoice->SetSizeHints( 100,-1); mPredictionOrderMethodChoice->SetSizeHints( 100,-1);
mPredictionOrderMethodChoice->SetToolTip(_("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default")); mPredictionOrderMethodChoice->SetToolTip(_("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"));
mMinPredictionOrderSpin = S.Id(FEMinPredID).TieSpinCtrl(_("Min. PdO"), wxT("/FileFormats/FFmpegMinPredOrder"), -1, 32, -1); mMinPredictionOrderSpin = S.Id(FEMinPredID).TieSpinCtrl(_("Min. PdO"), wxT("/FileFormats/FFmpegMinPredOrder"), -1, 32, -1);
mMinPredictionOrderSpin->SetToolTip(_("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)")); mMinPredictionOrderSpin->SetToolTip(_("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"));
mMaxPredictionOrderSpin = S.Id(FEMaxPredID).TieSpinCtrl(_("Max. PdO"), wxT("/FileFormats/FFmpegMaxPredOrder"), -1, 32, -1); mMaxPredictionOrderSpin = S.Id(FEMaxPredID).TieSpinCtrl(_("Max. PdO"), wxT("/FileFormats/FFmpegMaxPredOrder"), -1, 32, -1);
mMaxPredictionOrderSpin->SetToolTip(_("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)")); mMaxPredictionOrderSpin->SetToolTip(_("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"));
mMinPartitionOrderSpin = S.Id(FEMinPartOrderID).TieSpinCtrl(_("Min. PtO"), wxT("/FileFormats/FFmpegMinPartOrder"), -1, 8, -1); mMinPartitionOrderSpin = S.Id(FEMinPartOrderID).TieSpinCtrl(_("Min. PtO"), wxT("/FileFormats/FFmpegMinPartOrder"), -1, 8, -1);
mMinPartitionOrderSpin->SetToolTip(_("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8")); mMinPartitionOrderSpin->SetToolTip(_("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"));
mMaxPartitionOrderSpin = S.Id(FEMaxPartOrderID).TieSpinCtrl(_("Max. PtO"), wxT("/FileFormats/FFmpegMaxPredOrder"), -1, 8, -1); mMaxPartitionOrderSpin = S.Id(FEMaxPartOrderID).TieSpinCtrl(_("Max. PtO"), wxT("/FileFormats/FFmpegMaxPredOrder"), -1, 8, -1);
mMaxPartitionOrderSpin->SetToolTip(_("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8")); mMaxPartitionOrderSpin->SetToolTip(_("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"));
S.AddVariableText(_("Use LPC")); S.AddVariableText(_("Use LPC"));
S.Id(FEUseLPCID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegUseLPC"), true); S.Id(FEUseLPCID).TieCheckBox(wxEmptyString, wxT("/FileFormats/FFmpegUseLPC"), true);
}
} S.EndMultiColumn();
S.EndMultiColumn(); }
} S.EndStatic();
S.EndStatic(); S.StartStatic(_("MPEG container options"),0);
S.StartStatic(_("MPEG container options"),0); {
{ S.StartMultiColumn(4, wxALIGN_LEFT);
S.StartMultiColumn(4, wxALIGN_LEFT); {
{ /* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
/* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs 'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG
'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG it has a hard to predict effect on the degree of compression */
it has a hard to predict effect on the degree of compression */ mMuxRate = S.Id(FEMuxRateID).TieSpinCtrl(_("Mux Rate:"), wxT("/FileFormats/FFmpegMuxRate"), 0, 10000000, 0);
mMuxRate = S.Id(FEMuxRateID).TieSpinCtrl(_("Mux Rate:"), wxT("/FileFormats/FFmpegMuxRate"), 0, 10000000, 0); mMuxRate->SetToolTip(_("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"));
mMuxRate->SetToolTip(_("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"));
/* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
compression. It measures how big a chunk of audio is compressed in one piece. */ compression. It measures how big a chunk of audio is compressed in one piece. */
mPacketSize = S.Id(FEPacketSizeID).TieSpinCtrl(_("Packet Size:"), wxT("/FileFormats/FFmpegPacketSize"), 0, 10000000, 0); mPacketSize = S.Id(FEPacketSizeID).TieSpinCtrl(_("Packet Size:"), wxT("/FileFormats/FFmpegPacketSize"), 0, 10000000, 0);
mPacketSize->SetToolTip(_("Packet size\nOptional\n0 - default")); mPacketSize->SetToolTip(_("Packet size\nOptional\n0 - default"));
} }
S.EndMultiColumn(); S.EndMultiColumn();
} }
S.EndStatic(); S.EndStatic();
// S.EndScroller(); //S.EndScroller();
S.SetBorder( 5 ); S.SetBorder( 5 );
S.AddStandardButtons(); S.AddStandardButtons();
} }
S.EndVerticalLay(); S.EndVerticalLay();
} }
S.EndMultiColumn(); S.EndMultiColumn();
} }
S.EndMultiColumn(); S.EndMultiColumn();
S.EndVerticalLay(); S.EndVerticalLay();

View File

@ -37,7 +37,7 @@ Licensed under the GNU General Public License v2 or later
//TODO: remove non-audio extensions //TODO: remove non-audio extensions
#if defined(USE_FFMPEG) #if defined(USE_FFMPEG)
static const wxChar *exts[] = static const wxChar *exts[] =
{ {
wxT("4xm"), wxT("4xm"),
wxT("MTV"), wxT("MTV"),
wxT("roq"), wxT("roq"),
@ -171,7 +171,7 @@ public:
FFmpegImportPlugin(): FFmpegImportPlugin():
ImportPlugin(wxArrayString(WXSIZEOF(exts),exts)) ImportPlugin(wxArrayString(WXSIZEOF(exts),exts))
{ {
} }
~FFmpegImportPlugin() { } ~FFmpegImportPlugin() { }
@ -210,23 +210,23 @@ public:
///! Reads next audio frame ///! Reads next audio frame
///\return pointer to the stream context structure to which the frame belongs to or NULL on error, or 1 if stream is not to be imported. ///\return pointer to the stream context structure to which the frame belongs to or NULL on error, or 1 if stream is not to be imported.
streamContext* ReadNextFrame(); streamContext* ReadNextFrame();
///! Decodes the frame ///! Decodes the frame
///\param sc - stream context (from ReadNextFrame) ///\param sc - stream context (from ReadNextFrame)
///\param flushing - true if flushing (no more frames left), false otherwise ///\param flushing - true if flushing (no more frames left), false otherwise
///\return 0 on success, -1 if it can't decode any further ///\return 0 on success, -1 if it can't decode any further
int DecodeFrame(streamContext *sc, bool flushing); int DecodeFrame(streamContext *sc, bool flushing);
///! Writes decoded data into WaveTracks. Called by DecodeFrame ///! Writes decoded data into WaveTracks. Called by DecodeFrame
///\param sc - stream context ///\param sc - stream context
///\return 0 on success, 1 on error or interruption ///\return 0 on success, 1 on error or interruption
int WriteData(streamContext *sc); int WriteData(streamContext *sc);
///! Writes extracted metadata to tags object ///! Writes extracted metadata to tags object
///\param avf - file context ///\param avf - file context
///\ tags - Audacity tags object ///\ tags - Audacity tags object
void WriteMetadata(Tags *tags); void WriteMetadata(Tags *tags);
///! Retrieves metadata from FFmpeg and converts to wxString ///! Retrieves metadata from FFmpeg and converts to wxString
///\param avf - file context ///\param avf - file context
///\ tags - Audacity tags object ///\ tags - Audacity tags object
@ -240,7 +240,7 @@ public:
{ {
return mNumStreams; return mNumStreams;
} }
///! Called by Import.cpp ///! Called by Import.cpp
///\return array of strings - descriptions of the streams ///\return array of strings - descriptions of the streams
wxArrayString *GetStreamInfo() wxArrayString *GetStreamInfo()
@ -263,7 +263,7 @@ private:
int mNumStreams; //!< mNumstreams is less or equal to mFormatContext->nb_streams int mNumStreams; //!< mNumstreams is less or equal to mFormatContext->nb_streams
streamContext **mScs; //!< Array of pointers to stream contexts. Length is mNumStreams. streamContext **mScs; //!< Array of pointers to stream contexts. Length is mNumStreams.
wxArrayString *mStreamInfo; //!< Array of stream descriptions. Length is mNumStreams wxArrayString *mStreamInfo; //!< Array of stream descriptions. Length is mNumStreams
wxInt64 mProgressPos; //!< Current timestamp, file position or whatever is used as first argument for Update() wxInt64 mProgressPos; //!< Current timestamp, file position or whatever is used as first argument for Update()
wxInt64 mProgressLen; //!< Duration, total length or whatever is used as second argument for Update() wxInt64 mProgressLen; //!< Duration, total length or whatever is used as second argument for Update()
@ -317,7 +317,7 @@ ImportFileHandle *FFmpegImportPlugin::Open(wxString filename)
dlg = new FFmpegNotFoundDialog(NULL); dlg = new FFmpegNotFoundDialog(NULL);
dlg->ShowModal(); dlg->ShowModal();
delete dlg; delete dlg;
} }
} }
} }
if (!FFmpegLibsInst->ValidLibsLoaded()) if (!FFmpegLibsInst->ValidLibsLoaded())
@ -326,7 +326,7 @@ ImportFileHandle *FFmpegImportPlugin::Open(wxString filename)
return NULL; return NULL;
} }
// Open the file for import // Open the file for import
bool success = handle->Init(); bool success = handle->Init();
if (!success) { if (!success) {
delete handle; delete handle;
@ -429,14 +429,14 @@ bool FFmpegImportFileHandle::InitCodecs()
wxString strinfo; wxString strinfo;
int duration = 0; int duration = 0;
if (sc->m_stream->duration > 0) if (sc->m_stream->duration > 0)
duration = sc->m_stream->duration * sc->m_stream->time_base.num / sc->m_stream->time_base.den; duration = sc->m_stream->duration * sc->m_stream->time_base.num / sc->m_stream->time_base.den;
else else
duration = mFormatContext->duration / AV_TIME_BASE; duration = mFormatContext->duration / AV_TIME_BASE;
wxString bitrate = wxT(""); wxString bitrate = wxT("");
if (sc->m_codecCtx->bit_rate > 0) if (sc->m_codecCtx->bit_rate > 0)
bitrate.Printf(wxT("%d"),sc->m_codecCtx->bit_rate); bitrate.Printf(wxT("%d"),sc->m_codecCtx->bit_rate);
else else
bitrate.Printf(wxT("?")); bitrate.Printf(wxT("?"));
AVDictionaryEntry *tag = av_dict_get(sc->m_stream->metadata, "language", NULL, 0); AVDictionaryEntry *tag = av_dict_get(sc->m_stream->metadata, "language", NULL, 0);
wxString lang; wxString lang;
@ -580,24 +580,24 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
sampleDuration = ((sampleCount)mFormatContext->duration *mScs[s]->m_stream->codec->sample_rate) / AV_TIME_BASE; sampleDuration = ((sampleCount)mFormatContext->duration *mScs[s]->m_stream->codec->sample_rate) / AV_TIME_BASE;
// printf(" OD duration samples %qi, sr %d, secs %d\n",sampleDuration, (int)mScs[s]->m_stream->codec->sample_rate,(int)sampleDuration/mScs[s]->m_stream->codec->sample_rate); // printf(" OD duration samples %qi, sr %d, secs %d\n",sampleDuration, (int)mScs[s]->m_stream->codec->sample_rate,(int)sampleDuration/mScs[s]->m_stream->codec->sample_rate);
//for each wavetrack within the stream add coded blockfiles //for each wavetrack within the stream add coded blockfiles
for (int c = 0; c < mScs[s]->m_stream->codec->channels; c++) { for (int c = 0; c < mScs[s]->m_stream->codec->channels; c++) {
WaveTrack *t = mChannels[s][c]; WaveTrack *t = mChannels[s][c];
odTask->AddWaveTrack(t); odTask->AddWaveTrack(t);
sampleCount maxBlockSize = t->GetMaxBlockSize(); sampleCount maxBlockSize = t->GetMaxBlockSize();
//use the maximum blockfile size to divide the sections (about 11secs per blockfile at 44.1khz) //use the maximum blockfile size to divide the sections (about 11secs per blockfile at 44.1khz)
for (sampleCount i = 0; i < sampleDuration; i += maxBlockSize) { for (sampleCount i = 0; i < sampleDuration; i += maxBlockSize) {
sampleCount blockLen = maxBlockSize; sampleCount blockLen = maxBlockSize;
if (i + blockLen > sampleDuration) if (i + blockLen > sampleDuration)
blockLen = sampleDuration - i; blockLen = sampleDuration - i;
t->AppendCoded(mFilename, i, blockLen, c,ODTask::eODFFMPEG); t->AppendCoded(mFilename, i, blockLen, c,ODTask::eODFFMPEG);
// This only works well for single streams since we assume // This only works well for single streams since we assume
// each stream is of the same duration and channels // each stream is of the same duration and channels
res = mProgress->Update(i+sampleDuration*c+ sampleDuration*mScs[s]->m_stream->codec->channels*s, res = mProgress->Update(i+sampleDuration*c+ sampleDuration*mScs[s]->m_stream->codec->channels*s,
sampleDuration*mScs[s]->m_stream->codec->channels*mNumStreams); sampleDuration*mScs[s]->m_stream->codec->channels*mNumStreams);
if (res != eProgressSuccess) if (res != eProgressSuccess)
break; break;
@ -640,7 +640,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
{ {
av_free_packet(&sc->m_pkt); av_free_packet(&sc->m_pkt);
sc->m_pktValid = 0; sc->m_pktValid = 0;
} }
} }
} }
@ -657,7 +657,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
{ {
av_free_packet(&mScs[i]->m_pkt); av_free_packet(&mScs[i]->m_pkt);
mScs[i]->m_pktValid = 0; mScs[i]->m_pktValid = 0;
} }
} }
} }
} }
@ -759,22 +759,22 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
case AV_SAMPLE_FMT_U8P: case AV_SAMPLE_FMT_U8P:
((int16_t *)tmp[chn])[index] = (int16_t) (*(uint8_t *)in - 0x80) << 8; ((int16_t *)tmp[chn])[index] = (int16_t) (*(uint8_t *)in - 0x80) << 8;
break; break;
case AV_SAMPLE_FMT_S16: case AV_SAMPLE_FMT_S16:
case AV_SAMPLE_FMT_S16P: case AV_SAMPLE_FMT_S16P:
((int16_t *)tmp[chn])[index] = (int16_t) *(int16_t *)in; ((int16_t *)tmp[chn])[index] = (int16_t) *(int16_t *)in;
break; break;
case AV_SAMPLE_FMT_S32: case AV_SAMPLE_FMT_S32:
case AV_SAMPLE_FMT_S32P: case AV_SAMPLE_FMT_S32P:
((float *)tmp[chn])[index] = (float) *(int32_t *)in * (1.0 / (1 << 31)); ((float *)tmp[chn])[index] = (float) *(int32_t *)in * (1.0 / (1 << 31));
break; break;
case AV_SAMPLE_FMT_FLT: case AV_SAMPLE_FMT_FLT:
case AV_SAMPLE_FMT_FLTP: case AV_SAMPLE_FMT_FLTP:
((float *)tmp[chn])[index] = (float) *(float *)in; ((float *)tmp[chn])[index] = (float) *(float *)in;
break; break;
case AV_SAMPLE_FMT_DBL: case AV_SAMPLE_FMT_DBL:
case AV_SAMPLE_FMT_DBLP: case AV_SAMPLE_FMT_DBLP:
((float *)tmp[chn])[index] = (float) *(double *)in; ((float *)tmp[chn])[index] = (float) *(double *)in;
@ -800,7 +800,7 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
} }
free(tmp); free(tmp);
// Try to update the progress indicator (and see if user wants to cancel) // Try to update the progress indicator (and see if user wants to cancel)
int updateResult = eProgressSuccess; int updateResult = eProgressSuccess;
int64_t filesize = avio_size(mFormatContext->pb); int64_t filesize = avio_size(mFormatContext->pb);