From e63f25b44ed1bfd2ccd0ff1e7f1f453c6ba08179 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Sat, 6 May 2006 17:12:23 +0000 Subject: [PATCH] --sps-id, to allow concatenating streams with different settings. git-svn-id: svn://svn.videolan.org/x264/trunk@518 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/encoder.c | 6 ++++-- x264.c | 9 ++++++++- x264.h | 4 +++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 88f1bf0f..4849168f 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -434,6 +434,8 @@ static int x264_validate_parameters( x264_t *h ) if( h->param.rc.f_complexity_blur < 0 ) h->param.rc.f_complexity_blur = 0; + h->param.i_sps_id &= 31; + /* ensure the booleans are 0 or 1 so they can be used in math */ #define BOOLIFY(x) h->param.x = !!h->param.x BOOLIFY( b_cabac ); @@ -530,10 +532,10 @@ x264_t *x264_encoder_open ( x264_param_t *param ) h->i_idr_pic_id = 0; h->sps = &h->sps_array[0]; - x264_sps_init( h->sps, 0, &h->param ); + x264_sps_init( h->sps, h->param.i_sps_id, &h->param ); h->pps = &h->pps_array[0]; - x264_pps_init( h->pps, 0, &h->param, h->sps); + x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps); x264_validate_levels( h ); diff --git a/x264.c b/x264.c index 4d894ad1..4a75fcbe 100644 --- a/x264.c +++ b/x264.c @@ -275,6 +275,7 @@ static void Help( x264_param_t *defaults ) " -v, --verbose Print stats for each frame\n" " --progress Show a progress indicator while encoding\n" " --visualize Show MB types overlayed on the encoded video\n" + " --sps-id Set SPS and PPS id numbers [%d]\n" " --aud Use access unit delimiters\n" "\n", X264_BUILD, X264_VERSION, @@ -324,7 +325,8 @@ static void Help( x264_param_t *defaults ) strtable_lookup( colorprim_str, defaults->vui.i_colorprim ), strtable_lookup( transfer_str, defaults->vui.i_transfer ), strtable_lookup( colmatrix_str, defaults->vui.i_colmatrix ), - defaults->vui.i_chroma_loc + defaults->vui.i_chroma_loc, + defaults->i_sps_id ); } @@ -449,6 +451,7 @@ static int Parse( int argc, char **argv, #define OPT_NR 319 #define OPT_THREAD_INPUT 320 #define OPT_NO_DCT_DECIMATE 321 +#define OPT_SPS_ID 322 static struct option long_options[] = { @@ -512,6 +515,7 @@ static int Parse( int argc, char **argv, { "verbose", no_argument, NULL, 'v' }, { "progress",no_argument, NULL, OPT_PROGRESS }, { "visualize",no_argument, NULL, OPT_VISUALIZE }, + { "sps-id", required_argument, NULL, OPT_SPS_ID }, { "aud", no_argument, NULL, OPT_AUD }, { "nr", required_argument, NULL, OPT_NR }, { "cqm", required_argument, NULL, OPT_CQM }, @@ -808,6 +812,9 @@ static int Parse( int argc, char **argv, case 'v': param->i_log_level = X264_LOG_DEBUG; break; + case OPT_SPS_ID: + param->i_sps_id = atoi(optarg); + break; case OPT_AUD: param->b_aud = 1; break; diff --git a/x264.h b/x264.h index 45c52da4..07fa4877 100644 --- a/x264.h +++ b/x264.h @@ -35,7 +35,7 @@ #include -#define X264_BUILD 46 +#define X264_BUILD 47 /* x264_t: * opaque handler for decoder and encoder */ @@ -243,8 +243,10 @@ typedef struct char *psz_zones; /* alternate method of specifying zones */ } rc; + /* Muxing parameters */ int b_aud; /* generate access unit delimiters */ int b_repeat_headers; /* put SPS/PPS before each keyframe */ + int i_sps_id; /* SPS and PPS id number */ } x264_param_t; typedef struct { -- 2.40.0