]> git.sesse.net Git - x264/commitdiff
Enhance nalu_process
authorFiona Glaser <fiona@x264.com>
Tue, 7 Aug 2012 19:43:26 +0000 (12:43 -0700)
committerFiona Glaser <fiona@x264.com>
Wed, 5 Sep 2012 18:59:46 +0000 (11:59 -0700)
Add the input frame opaque pointer to the arguments.
This makes it easier to use with multiple simultaneous x264 encodes.

encoder/encoder.c
x264.h

index 5db3f579473ea1f108fabf4a1f1e17e85fc3fc89..6f652a15481dcc08f477c3d41e45d8f450a6cdf7 100644 (file)
@@ -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 940591b8cacd90eca0e532adebecba2f0a8a924f..5af716d692933cbf2892ea046d1e6c6707fa6788 100644 (file)
--- 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 );