Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement support for AMD AMF codecs #163

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
!CMakeLists.txt
!.clang-format
!docker/gstreamer.control
!docker/startup.sh
!docker/startup.sh
!docker/gstreamer/
5 changes: 5 additions & 0 deletions docker/gpu-drivers.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ RUN apt-get update -y && \
$REQUIRED_PACKAGES && \
rm -rf /var/lib/apt/lists/*

# Mount the host distribution compatible AMF runtime here later
COPY <<-EOT /etc/ld.so.conf.d/amdgpu-pro.conf
/opt/amdgpu-pro/lib/x86_64-linux-gnu
EOT

# Adding missing libnvrtc.so and libnvrtc-bulletins.so for Nvidia
# https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/LICENSE.txt
RUN <<_ADD_NVRTC
Expand Down
9 changes: 8 additions & 1 deletion docker/gstreamer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Provides: gstreamer, libgstreamer1.0-0
Description: Manually built from git
EOT

COPY docker/gstreamer/*.patch $SOURCE_PATH/

RUN <<_GSTREAMER_INSTALL
#!/bin/bash
set -e
Expand All @@ -39,7 +41,7 @@ RUN <<_GSTREAMER_INSTALL
libmfx-dev libvpl-dev libmfx-tools libunwind8 libcap2-bin \
libx11-dev libxfixes-dev libxdamage-dev libwayland-dev libpulse-dev libglib2.0-dev \
libopenjp2-7-dev liblcms2-dev libcairo2-dev libcairo-gobject2 libwebp7 librsvg2-dev libaom-dev \
libharfbuzz-dev libpango1.0-dev
libharfbuzz-dev libpango1.0-dev libudev-dev curl
"
apt-get update -y
apt-get install -y --no-install-recommends $DEV_PACKAGES
Expand All @@ -48,6 +50,10 @@ RUN <<_GSTREAMER_INSTALL
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git $SOURCE_PATH/gstreamer
cd ${SOURCE_PATH}/gstreamer
git checkout $GSTREAMER_SHA_COMMIT
patch -Np1 -i $SOURCE_PATH/gst-mr-8269.patch
patch -Np1 -i $SOURCE_PATH/gst-amf-headers.patch
patch -Np1 -i $SOURCE_PATH/gst-amf-av1-usage.patch
patch -Np1 -i $SOURCE_PATH/gst-amf-linux.patch
git submodule update --recursive --remote
Comment on lines +54 to 57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the patches be applied after doing git submodule update?

# see the list of possible options here: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/meson_options.txt \
meson setup \
Expand Down Expand Up @@ -77,6 +83,7 @@ RUN <<_GSTREAMER_INSTALL
-Dgst-plugins-bad:qsv=enabled \
-Dgst-plugins-bad:aom=enabled \
-Dgst-plugin-bad:nvcodec=enabled \
-Dgst-plugins-bad:amfcodec=enabled \
-Dvaapi=enabled \
build
meson compile -C build
Expand Down
31 changes: 31 additions & 0 deletions docker/gstreamer/gst-amf-av1-usage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/subprojects/gst-plugins-bad/sys/amfcodec/gstamfav1enc.cpp b/subprojects/gst-plugins-bad/sys/amfcodec/gstamfav1enc.cpp
index 6280cc05e7..482c1f7f98 100644
--- a/subprojects/gst-plugins-bad/sys/amfcodec/gstamfav1enc.cpp
+++ b/subprojects/gst-plugins-bad/sys/amfcodec/gstamfav1enc.cpp
@@ -98,12 +98,26 @@ gst_amf_av1_enc_usage_get_type (void)
*/
{AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING, "Transcoding", "transcoding"},

+ /**
+ * GstAmfAv1EncUsage::ultra-low-latency:
+ *
+ * Ultra Low Latency usage
+ */
+ {AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY, "Ultra Low Latency", "ultra-low-latency"},
+
/**
* GstAmfAv1EncUsage::low-latency:
*
* Low Latency usage
*/
{AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY, "Low Latency", "low-latency"},
+
+ /**
+ * GstAmfAv1EncUsage::webcam:
+ *
+ * Webcam usage
+ */
+ {AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM, "Webcam", "webcam"},
{0, nullptr, nullptr}
};

2,299 changes: 2,299 additions & 0 deletions docker/gstreamer/gst-amf-headers.patch

Large diffs are not rendered by default.

Loading