1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

FFmpeg: Replace long deprecated functions by current ones.

This commit is contained in:
benjamin.drung@gmail.com 2014-05-31 14:01:57 +00:00
parent 3416b2a8c1
commit 4d4580a042
5 changed files with 12 additions and 32 deletions

View File

@ -377,11 +377,7 @@ int import_ffmpeg_decode_frame(streamContext *sc, bool flushing)
}
sc->m_samplefmt = sc->m_codecCtx->sample_fmt;
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || (LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 4, 0))
sc->m_samplesize = av_get_bits_per_sample_fmt(sc->m_samplefmt) / 8;
#else
sc->m_samplesize = av_get_bytes_per_sample(sc->m_samplefmt);
#endif
int channels = sc->m_codecCtx->channels;
unsigned int newsize = sc->m_samplesize * frame->nb_samples * channels;
@ -859,7 +855,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
wxLogMessage(wxT("Importing symbols..."));
FFMPEG_INITDYN(avformat, av_register_all);
FFMPEG_INITDYN(avformat, av_find_stream_info);
FFMPEG_INITDYN(avformat, avformat_find_stream_info);
FFMPEG_INITDYN(avformat, av_read_frame);
FFMPEG_INITDYN(avformat, av_seek_frame);
FFMPEG_INITDYN(avformat, avformat_close_input);
@ -867,7 +863,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
FFMPEG_INITDYN(avformat, av_interleaved_write_frame);
FFMPEG_INITDYN(avformat, av_iformat_next);
FFMPEG_INITDYN(avformat, av_oformat_next);
FFMPEG_INITDYN(avformat, av_new_stream);
FFMPEG_INITDYN(avformat, avformat_new_stream);
FFMPEG_INITDYN(avformat, avformat_alloc_context);
FFMPEG_INITDYN(avformat, av_write_trailer);
FFMPEG_INITDYN(avformat, av_codec_get_tag);
@ -877,7 +873,6 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
FFMPEG_INITDYN(avformat, av_dict_set);
FFMPEG_INITDYN(avformat, avio_size);
FFMPEG_INITDYN(avformat, avio_alloc_context);
FFMPEG_INITALT(avformat, avio_read, get_buffer);
FFMPEG_INITALT(avformat, avio_seek, url_fseek);
FFMPEG_INITALT(avformat, av_guess_format, guess_format);
@ -900,8 +895,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
FFMPEG_INITDYN(avcodec, av_codec_next);
FFMPEG_INITDYN(avcodec, av_codec_is_encoder);
FFMPEG_INITDYN(avcodec, avcodec_fill_audio_frame);
FFMPEG_INITALT(avcodec, av_get_bits_per_sample_fmt, av_get_bits_per_sample_format);
FFMPEG_INITDYN(avcodec, av_get_bytes_per_sample);
FFMPEG_INITDYN(avutil, av_free);
FFMPEG_INITDYN(avutil, av_log_set_callback);

View File

@ -620,13 +620,7 @@ extern "C" {
);
FFMPEG_FUNCTION_WITH_RETURN(
int,
av_get_bits_per_sample_format,
(enum AVSampleFormat sample_fmt),
(sample_fmt)
);
FFMPEG_FUNCTION_WITH_RETURN(
int,
av_get_bits_per_sample_fmt,
av_get_bytes_per_sample,
(enum AVSampleFormat sample_fmt),
(sample_fmt)
);
@ -671,9 +665,9 @@ extern "C" {
);
FFMPEG_FUNCTION_WITH_RETURN(
int,
av_find_stream_info,
(AVFormatContext *ic),
(ic)
avformat_find_stream_info,
(AVFormatContext *ic, AVDictionary **options),
(ic, options)
);
FFMPEG_FUNCTION_WITH_RETURN(
int,
@ -718,9 +712,9 @@ extern "C" {
);
FFMPEG_FUNCTION_WITH_RETURN(
AVStream*,
av_new_stream,
(AVFormatContext *s, int id),
(s, id)
avformat_new_stream,
(AVFormatContext *s, const AVCodec *c),
(s, c)
);
FFMPEG_FUNCTION_WITH_RETURN(
AVFormatContext*,

View File

@ -276,11 +276,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
memcpy(mEncFormatCtx->filename, OSINPUT(mName), strlen(OSINPUT(mName))+1);
// 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 ((mEncAudioStream = av_new_stream(mEncFormatCtx, 1)) == NULL)
#else
if ((mEncAudioStream = avformat_new_stream(mEncFormatCtx, NULL)) == NULL)
#endif
{
wxLogError(wxT("FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."), mName.c_str());
return false;

View File

@ -369,14 +369,10 @@ bool FFmpegImportFileHandle::Init()
return false;
}
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 3, 0))
err = av_find_stream_info(mFormatContext);
#else
err = avformat_find_stream_info(mFormatContext, NULL);
#endif
if (err < 0)
{
wxLogError(wxT("FFmpeg : av_find_stream_info() failed for file %s"),mName.c_str());
wxLogError(wxT("FFmpeg: avformat_find_stream_info() failed for file %s"),mName.c_str());
return false;
}

View File

@ -197,7 +197,7 @@ bool ODFFmpegDecoder::SeekingAllowed()
goto test_failed;
}
err = av_find_stream_info(tempContext);
err = avformat_find_stream_info(tempContext, NULL);
if (err < 0)
{
goto test_failed;