Skip to content

Commit

Permalink
obs-studio: update to 31.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Kaiyang Wu <[email protected]>
  • Loading branch information
OriginCode committed Dec 20, 2024
1 parent fa9ffb6 commit 2edc836
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 109 deletions.
4 changes: 2 additions & 2 deletions app-multimedia/obs-studio/autobuild/defines
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ CMAKE_AFTER=(
-DENABLE_AJA=OFF
-DENABLE_NEW_MPEGTS_OUTPUT=OFF
-DENABLE_SCRIPTING_LUA=OFF
-DBUILD_BROWSER=OFF
-DENABLE_BROWSER=OFF
-DENABLE_QSV11=OFF
)
CMAKE_AFTER__WEB_PLUGIN=(
-DBUILD_BROWSER=ON
-DENABLE_BROWSER=ON
-DCEF_ROOT_DIR="${SRCDIR}/cef"
)
CMAKE_AFTER__INTEL_QSV=(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From 5d6d29d1ace3b4e89fdf0bd3a4d80b9edb5c8cd2 Mon Sep 17 00:00:00 2001
From: Kaiyang Wu <[email protected]>
Date: Wed, 18 Dec 2024 19:26:23 -0800
Subject: [PATCH 1/3] cmake: Add executable permission to CEF binary and
libraries

Signed-off-by: Kaiyang Wu <[email protected]>
---
cmake/linux/helpers.cmake | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cmake/linux/helpers.cmake b/cmake/linux/helpers.cmake
index fe4249685..1e8b28d0c 100644
--- a/cmake/linux/helpers.cmake
+++ b/cmake/linux/helpers.cmake
@@ -190,11 +190,6 @@ function(set_target_properties_obs target)
install(
FILES
"${imported_location}"
- "${cef_location}/chrome-sandbox"
- "${cef_location}/libEGL.so"
- "${cef_location}/libGLESv2.so"
- "${cef_location}/libvk_swiftshader.so"
- "${cef_location}/libvulkan.so.1"
"${cef_location}/snapshot_blob.bin"
"${cef_location}/v8_context_snapshot.bin"
"${cef_location}/vk_swiftshader_icd.json"
@@ -206,6 +201,17 @@ function(set_target_properties_obs target)
COMPONENT Runtime
)

+ install(
+ PROGRAMS
+ "${cef_location}/chrome-sandbox"
+ "${cef_location}/libEGL.so"
+ "${cef_location}/libGLESv2.so"
+ "${cef_location}/libvk_swiftshader.so"
+ "${cef_location}/libvulkan.so.1"
+ DESTINATION "${OBS_PLUGIN_DESTINATION}"
+ COMPONENT Runtime
+ )
+
install(
DIRECTORY "${cef_root_location}/Resources/locales"
DESTINATION "${OBS_PLUGIN_DESTINATION}"
--
2.47.1

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From 463fabeda1ef8cc31e7c6f2cd25d6194bc717dca Mon Sep 17 00:00:00 2001
From 28d9509dea76e271a5dc1b58c310f4d6c45a9cfc Mon Sep 17 00:00:00 2001
From: tytan652 <[email protected]>
Date: Mon, 11 Nov 2024 19:47:03 +0100
Subject: [PATCH] obs-ffmpeg: Fix deprecation with FFmpeg 7.1
Subject: [PATCH 2/3] obs-ffmpeg: Fix deprecation with FFmpeg 7.1

---
.../obs-ffmpeg/obs-ffmpeg-audio-encoders.c | 23 ++++++++---
plugins/obs-ffmpeg/obs-ffmpeg-output.c | 41 ++++++++++++-------
2 files changed, 45 insertions(+), 19 deletions(-)
.../obs-ffmpeg/obs-ffmpeg-audio-encoders.c | 23 +++++++++---
plugins/obs-ffmpeg/obs-ffmpeg-output.c | 36 +++++++++++++------
2 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c b/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c
index 49ee82dae..0cb0e9113 100644
index baa39072b..4258be19d 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c
@@ -290,11 +290,24 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder,
@@ -236,11 +236,24 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, const char

enc->context->sample_rate = audio_output_get_sample_rate(audio);

Expand All @@ -39,7 +39,7 @@ index 49ee82dae..0cb0e9113 100644
while (*fmt != AV_SAMPLE_FMT_NONE) {
if (*fmt == sample_format) {
enc->context->sample_fmt = *fmt;
@@ -305,15 +318,15 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder,
@@ -251,15 +264,15 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, const char

/* Fall back to default if requested format was not found. */
if (enc->context->sample_fmt == AV_SAMPLE_FMT_NONE)
Expand All @@ -59,33 +59,32 @@ index 49ee82dae..0cb0e9113 100644
int closest = 0;

diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c
index 899f5e2d0..94eb66141 100644
index 28a0dda03..9615abee7 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c
@@ -189,6 +189,7 @@ static bool create_video_stream(struct ffmpeg_data *data)
@@ -170,6 +170,7 @@ static bool create_video_stream(struct ffmpeg_data *data)
enum AVPixelFormat closest_format;
AVCodecContext *context;
struct obs_video_info ovi;
+ const enum AVPixelFormat *pix_fmts = NULL;

if (!obs_get_video_info(&ovi)) {
ffmpeg_log_error(LOG_WARNING, data, "No active video");
@@ -200,14 +201,6 @@ static bool create_video_stream(struct ffmpeg_data *data)
@@ -180,13 +181,6 @@ static bool create_video_stream(struct ffmpeg_data *data)
data->config.video_encoder))
return false;

- closest_format = data->config.format;
- if (data->vcodec->pix_fmts) {
- const int has_alpha = closest_format == AV_PIX_FMT_BGRA;
- closest_format = avcodec_find_best_pix_fmt_of_list(
- data->vcodec->pix_fmts, closest_format, has_alpha,
- NULL);
- closest_format =
- avcodec_find_best_pix_fmt_of_list(data->vcodec->pix_fmts, closest_format, has_alpha, NULL);
- }
-
context = avcodec_alloc_context3(data->vcodec);
context->bit_rate = (int64_t)data->config.video_bitrate * 1000;
context->width = data->config.scale_width;
@@ -215,15 +208,28 @@ static bool create_video_stream(struct ffmpeg_data *data)
@@ -194,14 +188,28 @@ static bool create_video_stream(struct ffmpeg_data *data)
context->time_base = (AVRational){ovi.fps_den, ovi.fps_num};
context->framerate = (AVRational){ovi.fps_num, ovi.fps_den};
context->gop_size = data->config.gop_size;
Expand All @@ -94,8 +93,7 @@ index 899f5e2d0..94eb66141 100644
context->color_primaries = data->config.color_primaries;
context->color_trc = data->config.color_trc;
context->colorspace = data->config.colorspace;
- context->chroma_sample_location = determine_chroma_location(
- closest_format, data->config.colorspace);
- context->chroma_sample_location = determine_chroma_location(closest_format, data->config.colorspace);
context->thread_count = 0;

+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
Expand All @@ -117,22 +115,19 @@ index 899f5e2d0..94eb66141 100644
data->video->time_base = context->time_base;
data->video->avg_frame_rate = (AVRational){ovi.fps_num, ovi.fps_den};

@@ -361,6 +367,7 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx)
@@ -305,6 +313,7 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx)
AVStream *stream;
struct obs_audio_info aoi;
int channels;
+ const enum AVSampleFormat *sample_fmts = NULL;

if (!obs_get_audio_info(&aoi)) {
ffmpeg_log_error(LOG_WARNING, data, "No active audio");
@@ -392,9 +399,15 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx)
@@ -324,7 +333,14 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx)
if (aoi.speakers == SPEAKERS_4POINT1)
context->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT1;
#endif
- context->sample_fmt = data->acodec->sample_fmts
- ? data->acodec->sample_fmts[0]
- : AV_SAMPLE_FMT_FLTP;
+

- context->sample_fmt = data->acodec->sample_fmts ? data->acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
+ sample_fmts = data->acodec->sample_fmts;
+#else
Expand All @@ -145,5 +140,5 @@ index 899f5e2d0..94eb66141 100644
stream->time_base = context->time_base;

--
2.47.0
2.47.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
From 4879e78948ebb66113724cd44ee41c238bad6fc3 Mon Sep 17 00:00:00 2001
From: tytan652 <[email protected]>
Date: Wed, 11 Dec 2024 08:45:40 +0100
Subject: [PATCH 3/3] libobs-opengl: Avoid trying to allocate 0 byte on Linux

---
libobs-opengl/gl-egl-common.c | 51 +++++++++++++++++++----------------
1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/libobs-opengl/gl-egl-common.c b/libobs-opengl/gl-egl-common.c
index 8854e9d0c..f6f696f69 100644
--- a/libobs-opengl/gl-egl-common.c
+++ b/libobs-opengl/gl-egl-common.c
@@ -297,26 +297,28 @@ static inline bool is_implicit_dmabuf_modifiers_supported(void)
static inline bool query_dmabuf_formats(EGLDisplay egl_display, EGLint **formats, EGLint *num_formats)
{
EGLint max_formats = 0;
- EGLint *format_list = NULL;

if (!glad_eglQueryDmaBufFormatsEXT(egl_display, 0, NULL, &max_formats)) {
blog(LOG_ERROR, "Cannot query the number of formats: %s", gl_egl_error_to_string(eglGetError()));
return false;
}

- format_list = bzalloc(max_formats * sizeof(EGLint));
- if (!format_list) {
- blog(LOG_ERROR, "Unable to allocate memory");
- return false;
- }
+ if (max_formats != 0) {
+ EGLint *format_list = bzalloc(max_formats * sizeof(EGLint));
+ if (!format_list) {
+ blog(LOG_ERROR, "Unable to allocate memory");
+ return false;
+ }

- if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) {
- blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError()));
- bfree(format_list);
- return false;
+ if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) {
+ blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError()));
+ bfree(format_list);
+ return false;
+ }
+
+ *formats = format_list;
}

- *formats = format_list;
*num_formats = max_formats;
return true;
}
@@ -353,21 +355,24 @@ static inline bool query_dmabuf_modifiers(EGLDisplay egl_display, EGLint drm_for
return false;
}

- EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR));
- EGLBoolean *external_only = NULL;
- if (!modifier_list) {
- blog(LOG_ERROR, "Unable to allocate memory");
- return false;
- }
+ if (max_modifiers != 0) {
+ EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR));
+ EGLBoolean *external_only = NULL;
+ if (!modifier_list) {
+ blog(LOG_ERROR, "Unable to allocate memory");
+ return false;
+ }

- if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list, external_only,
- &max_modifiers)) {
- blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError()));
- bfree(modifier_list);
- return false;
+ if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list,
+ external_only, &max_modifiers)) {
+ blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError()));
+ bfree(modifier_list);
+ return false;
+ }
+
+ *modifiers = modifier_list;
}

- *modifiers = modifier_list;
*n_modifiers = (EGLuint64KHR)max_modifiers;
return true;
}
--
2.47.1

14 changes: 8 additions & 6 deletions app-multimedia/obs-studio/spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
VER=30.2.3
REL=2
VER=31.0.0
# __OBS_CEF_VER: Find the build version on https://cef-builds.spotifycdn.com/index.html#linux64
# FIXME: 126.x has https://github.com/chromiumembedded/cef/issues/3616#issuecomment-2158624330
__OBS_CEF_VER="125.0.22+gc410c95+chromium-125.0.6422.142"
# Check https://github.com/obsproject/obs-studio/wiki/Build-Instructions-For-Linux#obs-browser
# for upstream required CEF version for reference.
__OBS_CEF_VER="127.3.5+g114ea2a+chromium-127.0.6533.120"
SRCS="git::commit=tags/$VER;rename=obs-studio::https://github.com/obsproject/obs-studio"
SRCS__AMD64="${SRCS} \
tbl::rename=cef.tar.bz2::https://cef-builds.spotifycdn.com/cef_binary_${__OBS_CEF_VER}_linux64_minimal.tar.bz2"
SRCS__ARM64="${SRCS} \
tbl::rename=cef.tar.bz2::https://cef-builds.spotifycdn.com/cef_binary_${__OBS_CEF_VER}_linuxarm64_minimal.tar.bz2"
CHKSUMS="SKIP"
CHKSUMS__AMD64="$CHKSUMS sha256::9c99e4346bf4e07c81201186e67ef1f35d6204cde14957579a22dd55a49fdfda"
CHKSUMS__ARM64="$CHKSUMS sha256::65e99652b4cd57f29d818bc7aa27f3be119a8ce0c69e59b1ea01af59583d0594"
CHKSUMS__AMD64="SKIP \
sha256::e7b13b6d92a95625a7a3d5b801a6928cbf41e2ec6afab0d7028bb5b6c88e0d48"
CHKSUMS__ARM64="SKIP \
sha256::b3c751f7bac03b49825306e96273d6c98dedf26a2fab4e4785964a965859741b"
SUBDIR="obs-studio"
CHKUPDATE="anitya::id=7239"

0 comments on commit 2edc836

Please sign in to comment.