mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-30 00:18:45 +01:00
FFmpeg: use Codec name instead if codec_id integer to identify codec
This allows selecting the intended codec when there are multiple with the same codec_id Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Benjamin Drung <bdrung@debian.org>
This commit is contained in:
@@ -423,7 +423,9 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
|
|||||||
set_dict_int(&options, "prediction_order_method", gPrefs->Read(wxT("/FileFormats/FFmpegPredOrderMethod"),(long)0));
|
set_dict_int(&options, "prediction_order_method", gPrefs->Read(wxT("/FileFormats/FFmpegPredOrderMethod"),(long)0));
|
||||||
set_dict_int(&options, "muxrate", gPrefs->Read(wxT("/FileFormats/FFmpegMuxRate"),(long)0));
|
set_dict_int(&options, "muxrate", gPrefs->Read(wxT("/FileFormats/FFmpegMuxRate"),(long)0));
|
||||||
mEncFormatCtx->packet_size = gPrefs->Read(wxT("/FileFormats/FFmpegPacketSize"),(long)0);
|
mEncFormatCtx->packet_size = gPrefs->Read(wxT("/FileFormats/FFmpegPacketSize"),(long)0);
|
||||||
mEncAudioCodecCtx->codec_id = (AVCodecID)gPrefs->Read(wxT("/FileFormats/FFmpegCodec"), mEncFormatDesc->audio_codec);
|
codec = avcodec_find_encoder_by_name(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
|
||||||
|
if (!codec)
|
||||||
|
mEncAudioCodecCtx->codec_id = mEncFormatDesc->audio_codec;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1261,7 +1261,7 @@ ExportFFmpegOptions::ExportFFmpegOptions(wxWindow *parent)
|
|||||||
DoOnFormatList();
|
DoOnFormatList();
|
||||||
|
|
||||||
//Select the codec that was selected last time this dialog was closed
|
//Select the codec that was selected last time this dialog was closed
|
||||||
AVCodec *codec = avcodec_find_encoder((AVCodecID)gPrefs->Read(wxT("/FileFormats/FFmpegCodec"),(long)CODEC_ID_NONE));
|
AVCodec *codec = avcodec_find_encoder_by_name(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
|
||||||
if (codec != NULL) mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->name)));
|
if (codec != NULL) mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->name)));
|
||||||
DoOnCodecList();
|
DoOnCodecList();
|
||||||
}
|
}
|
||||||
@@ -1908,7 +1908,7 @@ void ExportFFmpegOptions::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
int selcdc = mCodecList->GetSelection();
|
int selcdc = mCodecList->GetSelection();
|
||||||
int selfmt = mFormatList->GetSelection();
|
int selfmt = mFormatList->GetSelection();
|
||||||
if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),(long)avcodec_find_encoder_by_name(mCodecList->GetString(selcdc).ToUTF8())->id);
|
if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),mCodecList->GetString(selcdc));
|
||||||
if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
|
if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
ShuttleGui S(this, eIsSavingToPrefs);
|
ShuttleGui S(this, eIsSavingToPrefs);
|
||||||
|
|||||||
Reference in New Issue
Block a user