mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-16 16:20:50 +02:00
FFmpeg: Replace long deprecated functions by current ones.
This commit is contained in:
parent
3416b2a8c1
commit
4d4580a042
@ -377,11 +377,7 @@ int import_ffmpeg_decode_frame(streamContext *sc, bool flushing)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sc->m_samplefmt = sc->m_codecCtx->sample_fmt;
|
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);
|
sc->m_samplesize = av_get_bytes_per_sample(sc->m_samplefmt);
|
||||||
#endif
|
|
||||||
|
|
||||||
int channels = sc->m_codecCtx->channels;
|
int channels = sc->m_codecCtx->channels;
|
||||||
unsigned int newsize = sc->m_samplesize * frame->nb_samples * 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..."));
|
wxLogMessage(wxT("Importing symbols..."));
|
||||||
FFMPEG_INITDYN(avformat, av_register_all);
|
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_read_frame);
|
||||||
FFMPEG_INITDYN(avformat, av_seek_frame);
|
FFMPEG_INITDYN(avformat, av_seek_frame);
|
||||||
FFMPEG_INITDYN(avformat, avformat_close_input);
|
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_interleaved_write_frame);
|
||||||
FFMPEG_INITDYN(avformat, av_iformat_next);
|
FFMPEG_INITDYN(avformat, av_iformat_next);
|
||||||
FFMPEG_INITDYN(avformat, av_oformat_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, avformat_alloc_context);
|
||||||
FFMPEG_INITDYN(avformat, av_write_trailer);
|
FFMPEG_INITDYN(avformat, av_write_trailer);
|
||||||
FFMPEG_INITDYN(avformat, av_codec_get_tag);
|
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, av_dict_set);
|
||||||
FFMPEG_INITDYN(avformat, avio_size);
|
FFMPEG_INITDYN(avformat, avio_size);
|
||||||
FFMPEG_INITDYN(avformat, avio_alloc_context);
|
FFMPEG_INITDYN(avformat, avio_alloc_context);
|
||||||
|
|
||||||
FFMPEG_INITALT(avformat, avio_read, get_buffer);
|
FFMPEG_INITALT(avformat, avio_read, get_buffer);
|
||||||
FFMPEG_INITALT(avformat, avio_seek, url_fseek);
|
FFMPEG_INITALT(avformat, avio_seek, url_fseek);
|
||||||
FFMPEG_INITALT(avformat, av_guess_format, guess_format);
|
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_next);
|
||||||
FFMPEG_INITDYN(avcodec, av_codec_is_encoder);
|
FFMPEG_INITDYN(avcodec, av_codec_is_encoder);
|
||||||
FFMPEG_INITDYN(avcodec, avcodec_fill_audio_frame);
|
FFMPEG_INITDYN(avcodec, avcodec_fill_audio_frame);
|
||||||
|
FFMPEG_INITDYN(avcodec, av_get_bytes_per_sample);
|
||||||
FFMPEG_INITALT(avcodec, av_get_bits_per_sample_fmt, av_get_bits_per_sample_format);
|
|
||||||
|
|
||||||
FFMPEG_INITDYN(avutil, av_free);
|
FFMPEG_INITDYN(avutil, av_free);
|
||||||
FFMPEG_INITDYN(avutil, av_log_set_callback);
|
FFMPEG_INITDYN(avutil, av_log_set_callback);
|
||||||
|
20
src/FFmpeg.h
20
src/FFmpeg.h
@ -620,13 +620,7 @@ extern "C" {
|
|||||||
);
|
);
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
FFMPEG_FUNCTION_WITH_RETURN(
|
||||||
int,
|
int,
|
||||||
av_get_bits_per_sample_format,
|
av_get_bytes_per_sample,
|
||||||
(enum AVSampleFormat sample_fmt),
|
|
||||||
(sample_fmt)
|
|
||||||
);
|
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
|
||||||
int,
|
|
||||||
av_get_bits_per_sample_fmt,
|
|
||||||
(enum AVSampleFormat sample_fmt),
|
(enum AVSampleFormat sample_fmt),
|
||||||
(sample_fmt)
|
(sample_fmt)
|
||||||
);
|
);
|
||||||
@ -671,9 +665,9 @@ extern "C" {
|
|||||||
);
|
);
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
FFMPEG_FUNCTION_WITH_RETURN(
|
||||||
int,
|
int,
|
||||||
av_find_stream_info,
|
avformat_find_stream_info,
|
||||||
(AVFormatContext *ic),
|
(AVFormatContext *ic, AVDictionary **options),
|
||||||
(ic)
|
(ic, options)
|
||||||
);
|
);
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
FFMPEG_FUNCTION_WITH_RETURN(
|
||||||
int,
|
int,
|
||||||
@ -718,9 +712,9 @@ extern "C" {
|
|||||||
);
|
);
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
FFMPEG_FUNCTION_WITH_RETURN(
|
||||||
AVStream*,
|
AVStream*,
|
||||||
av_new_stream,
|
avformat_new_stream,
|
||||||
(AVFormatContext *s, int id),
|
(AVFormatContext *s, const AVCodec *c),
|
||||||
(s, id)
|
(s, c)
|
||||||
);
|
);
|
||||||
FFMPEG_FUNCTION_WITH_RETURN(
|
FFMPEG_FUNCTION_WITH_RETURN(
|
||||||
AVFormatContext*,
|
AVFormatContext*,
|
||||||
|
@ -276,11 +276,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
|
|||||||
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 ((mEncAudioStream = av_new_stream(mEncFormatCtx, 1)) == NULL)
|
|
||||||
#else
|
|
||||||
if ((mEncAudioStream = avformat_new_stream(mEncFormatCtx, NULL)) == NULL)
|
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());
|
wxLogError(wxT("FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."), mName.c_str());
|
||||||
return false;
|
return false;
|
||||||
|
@ -369,14 +369,10 @@ bool FFmpegImportFileHandle::Init()
|
|||||||
return false;
|
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);
|
err = avformat_find_stream_info(mFormatContext, NULL);
|
||||||
#endif
|
|
||||||
if (err < 0)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ bool ODFFmpegDecoder::SeekingAllowed()
|
|||||||
goto test_failed;
|
goto test_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = av_find_stream_info(tempContext);
|
err = avformat_find_stream_info(tempContext, NULL);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
goto test_failed;
|
goto test_failed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user