[vlc-commits] [Git][videolan/vlc][master] aom: encoder: set extradata from sequence header and config record

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 29 14:03:53 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
80fd99dd by Tristan Matthews at 2024-11-29T13:34:57+00:00
aom: encoder: set extradata from sequence header and config record

Fixes #21234

- - - - -


3 changed files:

- modules/codec/Makefile.am
- modules/codec/aom.c
- modules/codec/meson.build


Changes:

=====================================
modules/codec/Makefile.am
=====================================
@@ -576,7 +576,8 @@ endif
 codec_LTLIBRARIES += libvpx_alpha_plugin.la
 
 libaom_plugin_la_SOURCES = codec/aom.c \
-                           packetizer/iso_color_tables.h
+                           packetizer/iso_color_tables.h \
+                           packetizer/av1_obu.c packetizer/av1_obu.h
 libaom_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
 libaom_plugin_la_CFLAGS = $(AM_CFLAGS) $(AOM_CFLAGS) $(CPPFLAGS_aom)
 libaom_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'


=====================================
modules/codec/aom.c
=====================================
@@ -43,6 +43,7 @@
 #endif
 
 #include "../packetizer/iso_color_tables.h"
+#include "../packetizer/av1_obu.h"
 
 #ifndef AOM_USAGE_GOOD_QUALITY
 # define AOM_USAGE_GOOD_QUALITY 0
@@ -586,6 +587,41 @@ static int OpenEncoder(vlc_object_t *p_this)
     };
     p_enc->ops = &ops;
 
+    /* "The caller owns the memory associated with this buffer, and must free the
+       'buf' member of the aom_fixed_buf_t as well as the aom_fixed_buf_t pointer.
+       Memory returned must be freed via call to free()." */
+    aom_fixed_buf_t *p_headers = aom_codec_get_global_headers(ctx);
+
+    if (p_headers) {
+
+        av1_OBU_sequence_header_t *p_sequence_header = AV1_OBU_parse_sequence_header(p_headers->buf, p_headers->sz);
+        if (!p_sequence_header) {
+            free(p_headers->buf);
+            free(p_headers);
+            goto error;
+        }
+
+        p_enc->fmt_out.i_extra =
+                AV1_create_DecoderConfigurationRecord((uint8_t **)&p_enc->fmt_out.p_extra,
+                                                      p_sequence_header,
+                                                      1,
+                                                      (const uint8_t **)&p_headers->buf,
+                                                      &p_headers->sz);
+
+        /* Free everything regardless of whether or not the config record parsing succeeded. */
+        free(p_headers->buf);
+        free(p_headers);
+        AV1_release_sequence_header(p_sequence_header);
+
+        if (!p_enc->fmt_out.i_extra) {
+            msg_Err(p_enc, "Could not create decoder configuration record");
+            goto error;
+        }
+
+    } else {
+        goto error;
+    }
+
     return VLC_SUCCESS;
 
 error:


=====================================
modules/codec/meson.build
=====================================
@@ -840,7 +840,7 @@ vlc_modules += {
 aom_dep = dependency('aom', required: get_option('aom'))
 vlc_modules += {
     'name' : 'aom',
-    'sources' : files('aom.c'),
+    'sources' : files('aom.c', '../packetizer/av1_obu.c'),
     'dependencies' : [aom_dep],
     'enabled' : aom_dep.found(),
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80fd99dd023d7c77935a76d7774715e8b7e01f4d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80fd99dd023d7c77935a76d7774715e8b7e01f4d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list