0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

libobs: Remove compatibility with FFmpeg < 6.1

This commit is contained in:
derrod 2024-08-18 09:07:26 +02:00 committed by Ryan Foster
parent 2613b6a6f4
commit f07004c3b7
4 changed files with 2 additions and 71 deletions

View File

@ -6,13 +6,7 @@ include(cmake/obs-version.cmake)
find_package(Threads REQUIRED)
if(OS_WINDOWS OR OS_MACOS)
set(ffmpeg_version 6)
else()
set(ffmpeg_version 4.4)
endif()
find_package(FFmpeg ${ffmpeg_version} REQUIRED avformat avutil swscale swresample OPTIONAL_COMPONENTS avcodec)
find_package(FFmpeg 6.1 REQUIRED avformat avutil swscale swresample OPTIONAL_COMPONENTS avcodec)
find_package(ZLIB REQUIRED)
find_package(Uthash REQUIRED)

View File

@ -22,16 +22,10 @@
#include "../util/platform.h"
#include <libavformat/avformat.h>
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 20, 100)
#include <libavcodec/version.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifndef FF_API_BUFFER_SIZE_T
#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
#endif
struct media_remux_job {
int64_t in_size;
AVFormatContext *ifmt_ctx, *ofmt_ctx;
@ -91,43 +85,6 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
return false;
}
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(60, 31, 102)
#if FF_API_BUFFER_SIZE_T
int content_size;
#else
size_t content_size;
#endif
const uint8_t *const content_src = av_stream_get_side_data(
in_stream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
&content_size);
if (content_src) {
uint8_t *const content_dst = av_stream_new_side_data(
out_stream, AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
content_size);
if (content_dst)
memcpy(content_dst, content_src, content_size);
}
#if FF_API_BUFFER_SIZE_T
int mastering_size;
#else
size_t mastering_size;
#endif
const uint8_t *const mastering_src = av_stream_get_side_data(
in_stream, AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
&mastering_size);
if (mastering_src) {
uint8_t *const mastering_dst = av_stream_new_side_data(
out_stream,
AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
mastering_size);
if (mastering_dst) {
memcpy(mastering_dst, mastering_src,
mastering_size);
}
}
#endif
ret = avcodec_parameters_copy(out_stream->codecpar,
in_stream->codecpar);
@ -154,17 +111,7 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
}
if (in_stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 24, 100)
out_stream->codecpar->channel_layout =
av_get_default_channel_layout(
in_stream->codecpar->channels);
/* The avutil default channel layout for 5 channels is
* 5.0, which OBS does not support. Manually set 5
* channels to 4.1. */
if (in_stream->codecpar->channels == 5)
out_stream->codecpar->channel_layout =
av_get_channel_layout("4.1");
#else
av_channel_layout_default(
&out_stream->codecpar->ch_layout,
in_stream->codecpar->ch_layout.nb_channels);
@ -175,7 +122,6 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
out_stream->codecpar->ch_layout =
(AVChannelLayout)
AV_CHANNEL_LAYOUT_4POINT1;
#endif
}
}

View File

@ -68,20 +68,16 @@ get_ffmpeg_video_format(enum video_format format)
return AV_PIX_FMT_YUVA422P;
case VIDEO_FORMAT_YUVA:
return AV_PIX_FMT_YUVA444P;
#if LIBAVUTIL_BUILD >= AV_VERSION_INT(56, 31, 100)
case VIDEO_FORMAT_YA2L:
return AV_PIX_FMT_YUVA444P12LE;
#endif
case VIDEO_FORMAT_I010:
return AV_PIX_FMT_YUV420P10LE;
case VIDEO_FORMAT_P010:
return AV_PIX_FMT_P010LE;
#if LIBAVUTIL_BUILD >= AV_VERSION_INT(57, 17, 100)
case VIDEO_FORMAT_P216:
return AV_PIX_FMT_P216LE;
case VIDEO_FORMAT_P416:
return AV_PIX_FMT_P416LE;
#endif
case VIDEO_FORMAT_NONE:
case VIDEO_FORMAT_AYUV:
default:

View File

@ -12,9 +12,4 @@
(LIBAVCODEC_VERSION_MICRO >= 100 && \
LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e)))
#if LIBAVCODEC_VERSION_MAJOR < 60
#define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED
#define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED
#endif
#define INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE