[x264-devel] Enhance nalu_process

Jason Garrett-Glaser git at videolan.org
Wed Sep 5 21:07:21 CEST 2012


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Tue Aug  7 12:43:26 2012 -0700| [de725e98eb87198542aae5b8c5ebab4f6c06446e] | committer: Jason Garrett-Glaser

Enhance nalu_process
Add the input frame opaque pointer to the arguments.
This makes it easier to use with multiple simultaneous x264 encodes.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=de725e98eb87198542aae5b8c5ebab4f6c06446e
---

 encoder/encoder.c |    2 +-
 x264.h            |   11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index a274497..944b8cf 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -1533,7 +1533,7 @@ static int x264_nal_end( x264_t *h )
      * While undefined padding wouldn't actually affect the output, it makes valgrind unhappy. */
     memset( end, 0xff, 32 );
     if( h->param.nalu_process )
-        h->param.nalu_process( h, nal );
+        h->param.nalu_process( h, nal, h->fenc->opaque );
     h->out.i_nal++;
 
     return x264_nal_check_buffer( h );
diff --git a/x264.h b/x264.h
index 088fefe..7648c96 100644
--- a/x264.h
+++ b/x264.h
@@ -41,7 +41,7 @@
 
 #include "x264_config.h"
 
-#define X264_BUILD 126
+#define X264_BUILD 127
 
 /* Application developers planning to link against a shared library version of
  * libx264 from a Microsoft Visual Studio or similar development environment
@@ -502,8 +502,13 @@ typedef struct x264_param_t
      * the calling application is expected to acquire all output NALs through the callback.
      *
      * It is generally sensible to combine this callback with a use of slice-max-mbs or
-     * slice-max-size. */
-    void (*nalu_process) ( x264_t *h, x264_nal_t *nal );
+     * slice-max-size.
+     *
+     * The opaque pointer is the opaque pointer from the input frame associated with this
+     * NAL unit. This helps distinguish between nalu_process calls from different sources,
+     * e.g. if doing multiple encodes in one process.
+     */
+    void (*nalu_process) ( x264_t *h, x264_nal_t *nal, void *opaque );
 } x264_param_t;
 
 void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal );



More information about the x264-devel mailing list