iter2 step2: GLib/GStreamer compat shim, build succeeds
Vendored gsth265parser + nalutils + gstbitreader + gstbytereader (the
Step 1 commit) compile cleanly against libc + libv4l2 only after
adding 1 compat translation unit + 5 stub headers, no edits to the
vendored .c/.h files themselves.
src/h265_parser/gst_compat.{h,c} — new files (MIT, original work):
- GLib type aliases (gboolean, gchar, gint*, guint*, gsize, gpointer)
- Memory helpers (g_malloc/g_free as #define free, g_memdup2 inline)
- Asserts as no-op + parser-return-code-propagation
- All GST_DEBUG/INFO/WARNING/ERROR/LOG/FIXME as no-ops (the parser
is heavy on debug logging; we compile it all out)
- GArray implementation (~100 LOC, just enough for gsth265parser.c's
24 call sites)
- GList full struct with .data/.next/.prev so callers compile;
list-manipulation functions abort() — dead code paths only
- Byte-order read/write macros (GST_READ_UINT8/16/24/32/64_LE/BE,
GST_WRITE_UINT8/16/24/32_BE) — aarch64 LE inlines
- g_once_init_enter/leave as simple gate
- G_MAXUINT*, G_MAXINT*, G_MINxxx, G_GNUC_* attribute macros, etc.
- Opaque GstBuffer/GstMemory/GstMapInfo + abort-stub functions for
the encoder-side SEI-insertion paths the libva backend never invokes
- gst_util_ceil_log2 real impl (used by slice-header parser; dead
for our SPS-only call path but cheaper to implement than stub)
src/h265_parser/gst/{gst.h,base/base-prelude.h,base/gstbitwriter.h,
codecparsers/codecparsers-prelude.h,glib-compat-private.h} — 5 new
stub headers (MIT). All include gst_compat.h. gstbitwriter.h adds
abort-stub functions for the bit-writer API (used by nalutils.c's NAL
emulation-prevention encoder path — dead code for the parse-only
libva backend).
src/meson.build — added the 5 new .c source files and 10 new .h
headers; added include_directories('h265_parser') to the include path
so the vendored files' '#include <gst/base/...>' style references
resolve to the stub headers + actual vendored files in the local
tree.
Build verified: ninja -C build produces v4l2_request_drv_video.so
(682 KB, up from 485 KB pre-vendor — the +200 KB is the vendored
parser code). nm shows gst_h265_parse_sps, gst_h265_parse_sps_ext,
gst_h265_parser_identify_nalu, and the other functions we need for
Step 4 are present in the binary.
Two #warning messages from gsth265parser.h about API stability are
upstream-intentional and harmless ('The H.265 parsing library is
unstable API and may change in future').
This commit completes Step 2 of ampere-kernel-decoders iter2 Phase 6.
Backend remains functionally identical to pre-iter2 — the new code
compiles + links but is not yet called from h265_set_controls (that's
Step 4). Existing 5 codecs continue to work as before.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+28
-3
@@ -51,7 +51,16 @@ sources = [
|
||||
'vp8.c',
|
||||
'vp9.c',
|
||||
'codec.c',
|
||||
'nv15.c'
|
||||
'nv15.c',
|
||||
|
||||
# Vendored GStreamer 1.28.2 H.265 parser + utilities (LGPL v2.1+,
|
||||
# see src/h265_parser/gst_compat.h for sourcing notes + per-iter2
|
||||
# adaptation strategy).
|
||||
'h265_parser/gst_compat.c',
|
||||
'h265_parser/gst/base/gstbitreader.c',
|
||||
'h265_parser/gst/base/gstbytereader.c',
|
||||
'h265_parser/gst/codecparsers/nalutils.c',
|
||||
'h265_parser/gst/codecparsers/gsth265parser.c'
|
||||
]
|
||||
|
||||
headers = [
|
||||
@@ -78,11 +87,27 @@ headers = [
|
||||
'vp8.h',
|
||||
'vp9.h',
|
||||
'codec.h',
|
||||
'nv15.h'
|
||||
'nv15.h',
|
||||
|
||||
# Vendored GStreamer + project shim headers (see sources above).
|
||||
'h265_parser/gst_compat.h',
|
||||
'h265_parser/gst/gst.h',
|
||||
'h265_parser/gst/glib-compat-private.h',
|
||||
'h265_parser/gst/base/base-prelude.h',
|
||||
'h265_parser/gst/base/gstbitreader.h',
|
||||
'h265_parser/gst/base/gstbytereader.h',
|
||||
'h265_parser/gst/base/gstbitwriter.h',
|
||||
'h265_parser/gst/codecparsers/codecparsers-prelude.h',
|
||||
'h265_parser/gst/codecparsers/gsth265parser.h',
|
||||
'h265_parser/gst/codecparsers/nalutils.h'
|
||||
]
|
||||
|
||||
includes = [
|
||||
include_directories('../include')
|
||||
include_directories('../include'),
|
||||
# Vendored GStreamer parser tree — the parser's #include <gst/base/...>
|
||||
# style references resolve here via stub headers that redirect to
|
||||
# gst_compat.h.
|
||||
include_directories('h265_parser')
|
||||
]
|
||||
|
||||
cflags = [
|
||||
|
||||
Reference in New Issue
Block a user