Update of /cvsroot/audacity/audacity-src/src/export
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12599/src/export
Modified Files:
ExportFFmpeg.cpp ExportFFmpegDialogs.h
Log Message:
FFmpeg exporter: do not expose export types for which there is no support
compiled in.
Index: ExportFFmpegDialogs.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportFFmpegDialogs.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ExportFFmpegDialogs.h 15 Oct 2008 02:06:26 -0000 1.7
+++ ExportFFmpegDialogs.h 3 Feb 2009 18:53:11 -0000 1.8
@@ -45,17 +45,18 @@
bool canutf8; //!< true if format supports metadata in UTF-8,
false otherwise
const wxChar *description; //!< format description (will be shown in export
dialog)
CodecID codecid; //!< codec ID (see libavcodec/avcodec.h)
+ bool compiledIn; //!< support for this codec/format is compiled
in (checked at runtime)
};
/// List of export types
static ExposedFormat fmts[] =
{
- {FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, true ,true
,_("M4A (AAC) Files (FFmpeg)"), CODEC_ID_AAC},
- {FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7,
false,false,_("AC3 Files (FFmpeg)"), CODEC_ID_AC3},
- {FMT_AMRNB, wxT("AMRNB"), wxT("amr"), wxT("amr"), 1,
false,false,_("AMR (narrow band) Files (FFmpeg)"), CODEC_ID_AMR_NB},
- {FMT_AMRWB, wxT("AMRWB"), wxT("amr"), wxT("amr"), 1,
false,false,_("AMR (wide band) Files (FFmpeg)"), CODEC_ID_AMR_WB},
- {FMT_WMA2, wxT("WMA"), wxT("wma"), wxT("asf"), 2, true
,false,_("WMA (version 2) Files (FFmpeg)"), CODEC_ID_WMAV2},
- {FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, true ,true
,_("Custom FFmpeg Export"), CODEC_ID_NONE}
+ {FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, true ,true
,_("M4A (AAC) Files (FFmpeg)"), CODEC_ID_AAC, true},
+ {FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7,
false,false,_("AC3 Files (FFmpeg)"), CODEC_ID_AC3, true},
+ {FMT_AMRNB, wxT("AMRNB"), wxT("amr"), wxT("amr"), 1,
false,false,_("AMR (narrow band) Files (FFmpeg)"), CODEC_ID_AMR_NB, true},
+ {FMT_AMRWB, wxT("AMRWB"), wxT("amr"), wxT("amr"), 1,
false,false,_("AMR (wide band) Files (FFmpeg)"), CODEC_ID_AMR_WB, true},
+ {FMT_WMA2, wxT("WMA"), wxT("wma"), wxT("asf"), 2, true
,false,_("WMA (version 2) Files (FFmpeg)"), CODEC_ID_WMAV2, true},
+ {FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, true ,true
,_("Custom FFmpeg Export"), CODEC_ID_NONE, true}
};
/// Describes format-codec compatibility
Index: ExportFFmpeg.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportFFmpeg.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- ExportFFmpeg.cpp 2 Feb 2009 17:11:04 -0000 1.49
+++ ExportFFmpeg.cpp 3 Feb 2009 18:53:11 -0000 1.50
@@ -150,6 +150,18 @@
// Adds export types from the export type list
for (newfmt = 0; newfmt < FMT_LAST; newfmt++)
{
+ wxString shortname(fmts[newfmt].shortname);
+ if (newfmt < FMT_OTHER)
+ {
+ // Format/Codec support is compiled in
+ AVOutputFormat *avoformat =
FFmpegLibsInst->guess_format(shortname.mb_str(), NULL, NULL);
+ AVCodec *avcodec =
FFmpegLibsInst->avcodec_find_encoder(fmts[newfmt].codecid);
+ if (avoformat == NULL || avcodec == NULL)
+ {
+ fmts[newfmt].compiledIn = false;
+ continue;
+ }
+ }
int fmtindex = AddFormat() - 1;
SetFormat(fmts[newfmt].name,fmtindex);
AddExtension(fmts[newfmt].extension,fmtindex);
@@ -607,14 +619,24 @@
if (!CheckFFmpegPresence())
return false;
mChannels = channels;
- if (channels > fmts[subformat].maxchannels)
+ // subformat index may not correspond directly to fmts[] index, convert it
+ mSubFormat = -1;
+ for (int i = 0; i <= FMT_OTHER; i++)
{
- wxLogMessage(wxT("Attempted to export %d channels, but max. channels =
%d"),channels,fmts[subformat].maxchannels);
- wxMessageBox(wxString::Format(_("Attempted to export %d channels, but
max. channels for selected output format is
%d"),channels,fmts[subformat].maxchannels),_("Error"));
+ if (fmts[i].compiledIn) mSubFormat++;
+ if (mSubFormat == subformat || i == FMT_OTHER)
+ {
+ mSubFormat = i;
+ break;
+ }
+ }
+ if (channels > fmts[mSubFormat].maxchannels)
+ {
+ wxLogMessage(wxT("Attempted to export %d channels, but max. channels =
%d"),channels,fmts[mSubFormat].maxchannels);
+ wxMessageBox(wxString::Format(_("Attempted to export %d channels, but
max. channels for selected output format is
%d"),channels,fmts[mSubFormat].maxchannels),_("Error"));
return false;
}
mName = fName;
- mSubFormat = subformat;
TrackList *tracks = project->GetTracks();
bool ret = true;
@@ -779,37 +801,48 @@
{
if (!CheckFFmpegPresence())
return false;
- if (format == FMT_M4A)
+ // subformat index may not correspond directly to fmts[] index, convert it
+ mSubFormat = -1;
+ for (int i = 0; i <= FMT_OTHER; i++)
+ {
+ if (fmts[i].compiledIn) mSubFormat++;
+ if (mSubFormat == format || i == FMT_OTHER)
+ {
+ mSubFormat = i;
+ break;
+ }
+ }
+ if (mSubFormat == FMT_M4A)
{
ExportFFmpegAACOptions od(parent);
od.ShowModal();
return true;
}
- else if (format == FMT_AC3)
+ else if (mSubFormat == FMT_AC3)
{
ExportFFmpegAC3Options od(parent);
od.ShowModal();
return true;
}
- else if (format == FMT_AMRNB)
+ else if (mSubFormat == FMT_AMRNB)
{
ExportFFmpegAMRNBOptions od(parent);
od.ShowModal();
return true;
}
- else if (format == FMT_AMRWB)
+ else if (mSubFormat == FMT_AMRWB)
{
ExportFFmpegAMRWBOptions od(parent);
od.ShowModal();
return true;
}
- else if (format == FMT_WMA2)
+ else if (mSubFormat == FMT_WMA2)
{
ExportFFmpegWMAOptions od(parent);
od.ShowModal();
return true;
}
- else if (format == FMT_OTHER)
+ else if (mSubFormat == FMT_OTHER)
{
ExportFFmpegOptions od(parent);
od.ShowModal();
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs