libobs/media-io: Add ifdef for newer FFmpeg functions
The AVCodecParameters weren't introduced until avcodec version 57.48.101 (FFmpeg version 3.1), so this will make sure to still use the older avcodec_copy_context if the detected FFmpeg version is earlier.
This commit is contained in:
parent
0d6204c8af
commit
3114a240b4
@ -92,12 +92,16 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
||||
AVCodecParameters *par = avcodec_parameters_alloc();
|
||||
ret = avcodec_parameters_from_context(par, in_stream->codec);
|
||||
if (ret == 0)
|
||||
ret = avcodec_parameters_to_context(out_stream->codec,
|
||||
par);
|
||||
avcodec_parameters_free(&par);
|
||||
#else
|
||||
ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
|
||||
#endif
|
||||
|
||||
if (ret < 0) {
|
||||
blog(LOG_ERROR, "media_remux: Failed to copy context");
|
||||
|
Loading…
x
Reference in New Issue
Block a user