Skip to content

Commit

Permalink
handle more potential options (#24)
Browse files Browse the repository at this point in the history
Expose more GstElement properties.
This bumps required GStreamer version to 1.20.
  • Loading branch information
fzwoch authored Jan 4, 2024
1 parent 21b0a45 commit 9547064
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 29 deletions.
19 changes: 2 additions & 17 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build x86_64
run: |
meson setup --buildtype=release -Dlibobs=disabled -Dc_args=-I/obs -Dc_link_args='-Wl,--unresolved-symbols=ignore-all -static-libgcc' x86_64
meson compile -C x86_64
- name: Generate aarch64 cross file
run: |
echo "[binaries]" > aarch64.txt
echo "c = 'aarch64-linux-gnu-gcc'" >> aarch64.txt
echo "strip = 'aarch64-linux-gnu-strip'" >> aarch64.txt
echo "pkgconfig = 'aarch64-linux-gnu-pkg-config'" >> aarch64.txt
echo "" >> aarch64.txt
echo "[host_machine]" >> aarch64.txt
echo "system = 'linux'" >> aarch64.txt
echo "cpu_family = 'aarch64'" >> aarch64.txt
echo "cpu = 'aarch64'" >> aarch64.txt
echo "endian = 'little'" >> aarch64.txt
- name: Build aarch64
run: |
meson setup --cross-file=aarch64.txt --buildtype=release -Dlibobs=disabled -Dc_args=-I/obs -Dc_link_args='-Wl,--unresolved-symbols=ignore-all -static-libgcc' aarch64
meson compile -C aarch64
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: obs-vaapi
path: |
x86_64/*.so
aarch64/*.so
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@
# along with obs-vaapi. If not, see <http://www.gnu.org/licenses/>.
#

FROM debian:bullseye

RUN dpkg --add-architecture arm64
FROM debian:bookworm

RUN apt update \
&& apt install -y \
git ninja-build meson wget dpkg-dev \
gcc libsimde-dev libgstreamer-plugins-base1.0-dev libpci-dev \
gcc-aarch64-linux-gnu libsimde-dev:arm64 libgstreamer-plugins-base1.0-dev:arm64 libpci-dev:arm64 \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/obsproject/obs-studio/archive/refs/tags/28.0.0.tar.gz \
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ library('obs-vaapi',
),
dependencies : [
dependency('libobs', version : '>=28.0.0', required : get_option('libobs')),
dependency('gstreamer-1.0'),
dependency('gstreamer-1.0', version : '>=1.20'),
dependency('gstreamer-app-1.0'),
dependency('gstreamer-video-1.0'),
dependency('libpci'),
Expand Down
40 changes: 33 additions & 7 deletions obs-vaapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ static void *create(obs_data_t *settings, obs_encoder_t *encoder)

vaapiencoder = gst_element_factory_make(
obs_encoder_get_id(encoder) + strlen("obs-va-"), NULL);
} else {
} else if (g_str_has_prefix(obs_encoder_get_id(encoder),
"obs-vaapi-")) {
g_setenv("GST_VAAPI_DRM_DEVICE",
obs_data_get_string(settings, "device"), TRUE);

Expand Down Expand Up @@ -322,8 +323,9 @@ static void *create(obs_data_t *settings, obs_encoder_t *encoder)
const char *name = obs_property_name(property);
switch (obs_property_get_type(property)) {
case OBS_PROPERTY_TEXT:
g_object_set(vaapiencoder, name,
obs_data_get_string(settings, name), NULL);
gst_util_set_object_arg(G_OBJECT(vaapiencoder), name,
obs_data_get_string(settings,
name));
blog(LOG_INFO, "[obs-vaapi] %s: %s", name,
obs_data_get_string(settings, name));
break;
Expand Down Expand Up @@ -532,7 +534,7 @@ static void get_defaults2(obs_data_t *settings, void *type_data)
if (g_str_has_prefix(type_data, "obs-va-")) {
encoder = gst_element_factory_make(
type_data + strlen("obs-va-"), NULL);
} else {
} else if (g_str_has_prefix(type_data, "obs-vaapi-")) {
encoder = gst_element_factory_make(
type_data + strlen("obs-vaapi-"), NULL);

Expand Down Expand Up @@ -621,7 +623,19 @@ static void get_defaults2(obs_data_t *settings, void *type_data)
}
}
} else if (GST_IS_PARAM_SPEC_ARRAY_LIST(param)) {
// not implemented
obs_data_set_default_string(
settings, param->name,
gst_value_serialize(&value));
} else if (G_VALUE_TYPE(&value) == GST_TYPE_STRUCTURE) {
const GstStructure *s =
gst_value_get_structure(&value);
if (s != NULL) {
gchar *str = gst_structure_serialize(
s, GST_SERIALIZE_FLAG_NONE);
obs_data_set_default_string(
settings, param->name, str);
g_free(str);
}
} else {
blog(LOG_WARNING,
"[obs-vaapi] unhandled property: %s",
Expand Down Expand Up @@ -686,7 +700,7 @@ static obs_properties_t *get_properties2(void *data, void *type_data)
if (g_str_has_prefix(type_data, "obs-va-")) {
encoder = gst_element_factory_make(
type_data + strlen("obs-va-"), NULL);
} else {
} else if (g_str_has_prefix(type_data, "obs-vaapi-")) {
encoder = gst_element_factory_make(
type_data + strlen("obs-vaapi-"), NULL);

Expand Down Expand Up @@ -810,7 +824,19 @@ static obs_properties_t *get_properties2(void *data, void *type_data)
property,
g_param_spec_get_blurb(param));
} else if (GST_IS_PARAM_SPEC_ARRAY_LIST(param)) {
// not implemented
property = obs_properties_add_text(
properties, param->name, param->name,
OBS_TEXT_DEFAULT);
obs_property_set_long_description(
property,
g_param_spec_get_blurb(param));
} else if (G_VALUE_TYPE(&value) == GST_TYPE_STRUCTURE) {
property = obs_properties_add_text(
properties, param->name, param->name,
OBS_TEXT_DEFAULT);
obs_property_set_long_description(
property,
g_param_spec_get_blurb(param));
} else {
blog(LOG_WARNING,
"[obs-vaapi] unhandled property: %s",
Expand Down

0 comments on commit 9547064

Please sign in to comment.