From de725e98eb87198542aae5b8c5ebab4f6c06446e Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Tue, 7 Aug 2012 12:43:26 -0700 Subject: [PATCH] Enhance nalu_process Add the input frame opaque pointer to the arguments. This makes it easier to use with multiple simultaneous x264 encodes. --- 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 a2744977..944b8cf9 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 088fefee..7648c963 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 ); -- 2.47.3