x264_mc_weight_w8_msa( p_dst, *p_dst_stride,
p_dst, *p_dst_stride,
pWeight, i_h4w );
- for( i_cnt = i_h4w; i_cnt < i_height ; i_cnt++ )
+ for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint64_t temp0;
v16i8 zero = {0};
pWeight, i_h4w );
p_src1 = src1_org + i_h4w * i_src_stride;
- for( i_cnt = i_h4w; i_cnt < i_height ; i_cnt++ )
+ for( i_cnt = i_h4w; i_cnt < i_height; i_cnt++ )
{
uint64_t u_temp0;
v16i8 zero = {0};
h->mb.i_partition = partition_col[0];
}
}
- int i_mb_4x4 = b_interlaced ? 4 * (h->mb.i_b4_stride*mb_y + mb_x) : h->mb.i_b4_xy ;
- int i_mb_8x8 = b_interlaced ? 2 * (h->mb.i_b8_stride*mb_y + mb_x) : h->mb.i_b8_xy ;
+ int i_mb_4x4 = b_interlaced ? 4 * (h->mb.i_b4_stride*mb_y + mb_x) : h->mb.i_b4_xy;
+ int i_mb_8x8 = b_interlaced ? 2 * (h->mb.i_b8_stride*mb_y + mb_x) : h->mb.i_b8_xy;
int8_t *l1ref0 = &h->fref[1][0]->ref[0][i_mb_8x8];
int8_t *l1ref1 = &h->fref[1][0]->ref[1][i_mb_8x8];
vec_u32_t multEvenvA, multOddvA;
vec_u16_t mfvA;
vec_u16_t biasvA;
- vec_s16_t one = vec_splat_s16(1);;
+ vec_s16_t one = vec_splat_s16(1);
vec_s16_t nz = zero_s16v;
vector bool short mskB;
vec_u32_t multEvenvA, multOddvA;
vec_u16_t mfvA;
vec_u16_t biasvA;
- vec_s16_t one = vec_splat_s16(1);;
+ vec_s16_t one = vec_splat_s16(1);
vec_s16_t nz = zero_s16v;
vector bool short mskB;
x264_cabac_encode_bypass( cb, 0 ); // sign
}
- for( int i = last-1 ; i >= 0; i-- )
+ for( int i = last-1; i >= 0; i-- )
{
if( l[i] )
{
}
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
{
- for( int i = (p == 0 && h->mb.i_skip_intra) ? 3 : 0 ; i < 4; i++ )
+ for( int i = (p == 0 && h->mb.i_skip_intra) ? 3 : 0; i < 4; i++ )
{
int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[4*i]];
x264_mb_encode_i8x8( h, p, i, i_qp, i_mode, NULL, 1 );
}
for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp )
{
- for( int i = (p == 0 && h->mb.i_skip_intra) ? 15 : 0 ; i < 16; i++ )
+ for( int i = (p == 0 && h->mb.i_skip_intra) ? 15 : 0; i < 16; i++ )
{
pixel *p_dst = &h->mb.pic.p_fdec[p][block_idx_xy_fdec[i]];
int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[i]];
while( *option && (strlen( *option ) != length || strncmp( opt, *option, length )) )
option++;
- RETURN_IF_ERROR( !*option, "Invalid option '%.*s'\n", length, opt )
+ RETURN_IF_ERROR( !*option, "Invalid option '%.*s'\n", length, opt );
found_named = 1;
length += strcspn( opt + length, "," );
}
else
{
- RETURN_IF_ERROR( opt_count >= options_count, "Too many options given\n" )
- RETURN_IF_ERROR( found_named, "Ordered option given after named\n" )
+ RETURN_IF_ERROR( opt_count >= options_count, "Too many options given\n" );
+ RETURN_IF_ERROR( found_named, "Ordered option given after named\n" );
size += strlen( options[opt_count] ) + 1;
}
opt_count++;
int offset = 2 * (opt_count+1) * sizeof(char*);
size += offset + (opt - opt_str);
char **opts = calloc( 1, size );
- RETURN_IF_ERROR( !opts, "malloc failed\n" )
+ RETURN_IF_ERROR( !opts, "malloc failed\n" );
#define insert_opt( src, length )\
do {\
for( int i = 0; i < 4; i++ )
{
char *opt = x264_get_option( optlist[i], opts );
- FAIL_IF_ERROR( !opt, "%s crop value not specified\n", optlist[i] )
+ FAIL_IF_ERROR( !opt, "%s crop value not specified\n", optlist[i] );
h->dims[i] = x264_otoi( opt, -1 );
- FAIL_IF_ERROR( h->dims[i] < 0, "%s crop value `%s' is less than 0\n", optlist[i], opt )
+ FAIL_IF_ERROR( h->dims[i] < 0, "%s crop value `%s' is less than 0\n", optlist[i], opt );
int dim_mod = i&1 ? (h->csp->mod_height << info->interlaced) : h->csp->mod_width;
- FAIL_IF_ERROR( h->dims[i] % dim_mod, "%s crop value `%s' is not a multiple of %d\n", optlist[i], opt, dim_mod )
+ FAIL_IF_ERROR( h->dims[i] % dim_mod, "%s crop value `%s' is not a multiple of %d\n", optlist[i], opt, dim_mod );
}
return 0;
}
static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x264_param_t *param, char *opt_string )
{
- FAIL_IF_ERROR( x264_cli_csp_is_invalid( info->csp ), "invalid csp %d\n", info->csp )
+ FAIL_IF_ERROR( x264_cli_csp_is_invalid( info->csp ), "invalid csp %d\n", info->csp );
crop_hnd_t *h = calloc( 1, sizeof(crop_hnd_t) );
if( !h )
return -1;
h->dims[2] = info->width - h->dims[0] - h->dims[2];
h->dims[3] = info->height - h->dims[1] - h->dims[3];
- FAIL_IF_ERROR( h->dims[2] <= 0 || h->dims[3] <= 0, "invalid output resolution %dx%d\n", h->dims[2], h->dims[3] )
+ FAIL_IF_ERROR( h->dims[2] <= 0 || h->dims[3] <= 0, "invalid output resolution %dx%d\n", h->dims[2], h->dims[3] );
if( info->width != h->dims[2] || info->height != h->dims[3] )
x264_cli_log( NAME, X264_LOG_INFO, "cropping to %dx%d\n", h->dims[2], h->dims[3] );
ret = 1;
}
- FAIL_IF_ERROR( bit_depth != X264_BIT_DEPTH, "this build supports only bit depth %d\n", X264_BIT_DEPTH )
- FAIL_IF_ERROR( ret, "unsupported bit depth conversion.\n" )
+ FAIL_IF_ERROR( bit_depth != X264_BIT_DEPTH, "this build supports only bit depth %d\n", X264_BIT_DEPTH );
+ FAIL_IF_ERROR( ret, "unsupported bit depth conversion.\n" );
/* only add the filter to the chain if it's needed */
if( change_fmt || bit_depth != 8 * x264_cli_csp_depth_factor( csp ) )
{
- FAIL_IF_ERROR( !depth_filter_csp_is_supported(csp), "unsupported colorspace.\n" )
+ FAIL_IF_ERROR( !depth_filter_csp_is_supported(csp), "unsupported colorspace.\n" );
depth_hnd_t *h = x264_malloc( sizeof(depth_hnd_t) + (info->width+1)*sizeof(int16_t) );
if( !h )
int x264_cli_pic_copy( cli_pic_t *out, cli_pic_t *in )
{
int csp = in->img.csp & X264_CSP_MASK;
- FAIL_IF_ERROR( x264_cli_csp_is_invalid( in->img.csp ), "invalid colorspace arg %d\n", in->img.csp )
+ FAIL_IF_ERROR( x264_cli_csp_is_invalid( in->img.csp ), "invalid colorspace arg %d\n", in->img.csp );
FAIL_IF_ERROR( in->img.csp != out->img.csp || in->img.height != out->img.height
|| in->img.width != out->img.width, "incompatible frame properties\n" );
/* copy data */
{
FAIL_IF_ERROR( 2 != sscanf( str_sar, "%u:%u", &out_sar_w, &out_sar_h ) &&
2 != sscanf( str_sar, "%u/%u", &out_sar_w, &out_sar_h ),
- "invalid sar `%s'\n", str_sar )
+ "invalid sar `%s'\n", str_sar );
}
else
out_sar_w = out_sar_h = 1;
if( !strcasecmp( fittobox, "both" ) )
{
FAIL_IF_ERROR( width <= 0 || height <= 0, "invalid box resolution %sx%s\n",
- x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) )
+ x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) );
}
else if( !strcasecmp( fittobox, "width" ) )
{
- FAIL_IF_ERROR( width <= 0, "invalid box width `%s'\n", x264_otos( str_width, "<unset>" ) )
+ FAIL_IF_ERROR( width <= 0, "invalid box width `%s'\n", x264_otos( str_width, "<unset>" ) );
height = INT_MAX;
}
else if( !strcasecmp( fittobox, "height" ) )
{
- FAIL_IF_ERROR( height <= 0, "invalid box height `%s'\n", x264_otos( str_height, "<unset>" ) )
+ FAIL_IF_ERROR( height <= 0, "invalid box height `%s'\n", x264_otos( str_height, "<unset>" ) );
width = INT_MAX;
}
- else FAIL_IF_ERROR( 1, "invalid fittobox mode `%s'\n", fittobox )
+ else FAIL_IF_ERROR( 1, "invalid fittobox mode `%s'\n", fittobox );
/* maximally fit the new coded resolution to the box */
const x264_cli_csp_t *csp = x264_cli_get_csp( h->dst_csp );
if( str_width || str_height )
{
FAIL_IF_ERROR( width <= 0 || height <= 0, "invalid resolution %sx%s\n",
- x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) )
+ x264_otos( str_width, "<unset>" ), x264_otos( str_height, "<unset>" ) );
if( !str_sar ) /* res only -> adjust sar */
{
/* new_sar = (new_h * old_w * old_sar_w) / (old_h * new_w * old_sar_h) */
return -1;
h->buffer_allocated = 1;
}
- FAIL_IF_ERROR( x264_init_sws_context( h ), "swscale init failed\n" )
+ FAIL_IF_ERROR( x264_init_sws_context( h ), "swscale init failed\n" );
return 0;
}
h->variable_input = 1;
h->dst_csp = pick_closest_supported_csp( info->csp );
FAIL_IF_ERROR( h->dst_csp == X264_CSP_NONE,
- "filter get invalid input pixel format %d (colorspace %d)\n", convert_csp_to_pix_fmt( info->csp ), info->csp )
+ "filter get invalid input pixel format %d (colorspace %d)\n", convert_csp_to_pix_fmt( info->csp ), info->csp );
}
else
{
FAIL_IF_ERROR( src_pix_fmt == AV_PIX_FMT_NONE && src_pix_fmt_inv != AV_PIX_FMT_NONE,
"input colorspace %s with bit depth %d is not supported\n", av_get_pix_fmt_name( src_pix_fmt_inv ),
info->csp & X264_CSP_HIGH_DEPTH ? 16 : 8 );
- FAIL_IF_ERROR( !sws_isSupportedInput( src_pix_fmt ), "input colorspace %s is not supported\n", av_get_pix_fmt_name( src_pix_fmt ) )
+ FAIL_IF_ERROR( !sws_isSupportedInput( src_pix_fmt ), "input colorspace %s is not supported\n", av_get_pix_fmt_name( src_pix_fmt ) );
FAIL_IF_ERROR( h->dst.pix_fmt == AV_PIX_FMT_NONE && dst_pix_fmt_inv != AV_PIX_FMT_NONE,
"input colorspace %s with bit depth %d is not supported\n", av_get_pix_fmt_name( dst_pix_fmt_inv ),
h->dst_csp & X264_CSP_HIGH_DEPTH ? 16 : 8 );
- FAIL_IF_ERROR( !sws_isSupportedOutput( h->dst.pix_fmt ), "output colorspace %s is not supported\n", av_get_pix_fmt_name( h->dst.pix_fmt ) )
+ FAIL_IF_ERROR( !sws_isSupportedOutput( h->dst.pix_fmt ), "output colorspace %s is not supported\n", av_get_pix_fmt_name( h->dst.pix_fmt ) );
FAIL_IF_ERROR( h->dst.height != info->height && info->interlaced,
- "swscale is not compatible with interlaced vertical resizing\n" )
+ "swscale is not compatible with interlaced vertical resizing\n" );
/* confirm that the desired resolution meets the colorspace requirements */
const x264_cli_csp_t *csp = x264_cli_get_csp( h->dst_csp );
FAIL_IF_ERROR( h->dst.width % csp->mod_width || h->dst.height % csp->mod_height,
- "resolution %dx%d is not compliant with colorspace %s\n", h->dst.width, h->dst.height, csp->name )
+ "resolution %dx%d is not compliant with colorspace %s\n", h->dst.width, h->dst.height, csp->name );
if( h->dst.width != info->width || h->dst.height != info->height )
x264_cli_log( NAME, X264_LOG_INFO, "resizing to %dx%d\n", h->dst.width, h->dst.height );
}
/* pass if nothing needs to be done, otherwise fail */
- FAIL_IF_ERROR( ret, "not compiled with swscale support\n" )
+ FAIL_IF_ERROR( ret, "not compiled with swscale support\n" );
return 0;
}
int val = x264_otoi( tok, -1 );
if( p )
{
- FAIL_IF_ERROR( val <= 0, "invalid step `%s'\n", tok )
+ FAIL_IF_ERROR( val <= 0, "invalid step `%s'\n", tok );
h->step_size = val;
continue;
}
- FAIL_IF_ERROR( val < 0 || val >= h->step_size, "invalid offset `%s'\n", tok )
- FAIL_IF_ERROR( h->pattern_len >= MAX_PATTERN_SIZE, "max pattern size %d reached\n", MAX_PATTERN_SIZE )
+ FAIL_IF_ERROR( val < 0 || val >= h->step_size, "invalid offset `%s'\n", tok );
+ FAIL_IF_ERROR( h->pattern_len >= MAX_PATTERN_SIZE, "max pattern size %d reached\n", MAX_PATTERN_SIZE );
offsets[h->pattern_len++] = val;
}
- FAIL_IF_ERROR( !h->step_size, "no step size provided\n" )
- FAIL_IF_ERROR( !h->pattern_len, "no offsets supplied\n" )
+ FAIL_IF_ERROR( !h->step_size, "no step size provided\n" );
+ FAIL_IF_ERROR( !h->pattern_len, "no offsets supplied\n" );
h->pattern = malloc( h->pattern_len * sizeof(int) );
if( !h->pattern )
#if USE_AVXSYNTH
return 2.58f;
#else
- FAIL_IF_ERROR( !h->func.avs_function_exists( h->env, "VersionNumber" ), "VersionNumber does not exist\n" )
+ FAIL_IF_ERROR( !h->func.avs_function_exists( h->env, "VersionNumber" ), "VersionNumber does not exist\n" );
AVS_Value ver = h->func.avs_invoke( h->env, "VersionNumber", avs_new_value_array( NULL, 0 ), NULL );
- FAIL_IF_ERROR( avs_is_error( ver ), "unable to determine avisynth version: %s\n", avs_as_error( ver ) )
+ FAIL_IF_ERROR( avs_is_error( ver ), "unable to determine avisynth version: %s\n", avs_as_error( ver ) );
FAIL_IF_ERROR( !avs_is_float( ver ), "VersionNumber did not return a float value\n" );
float ret = avs_as_float( ver );
h->func.avs_release_value( ver );
avs_hnd_t *h = malloc( sizeof(avs_hnd_t) );
if( !h )
return -1;
- FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth\n" )
+ FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth\n" );
h->env = h->func.avs_create_script_environment( AVS_INTERFACE_25 );
if( h->func.avs_get_error )
{
if( !strcasecmp( filename_ext, "avs" ) )
{
res = h->func.avs_invoke( h->env, "Import", arg, NULL );
- FAIL_IF_ERROR( avs_is_error( res ), "%s\n", avs_as_string( res ) )
+ FAIL_IF_ERROR( avs_is_error( res ), "%s\n", avs_as_string( res ) );
/* check if the user is using a multi-threaded script and apply distributor if necessary.
adapted from avisynth's vfw interface */
AVS_Value mt_test = h->func.avs_invoke( h->env, "GetMTMode", avs_new_value_bool( 0 ), NULL );
}
x264_cli_printf( X264_LOG_INFO, "failed\n" );
}
- FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'\n", psz_filename )
+ FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'\n", psz_filename );
}
- FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip\n", psz_filename )
+ FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip\n", psz_filename );
h->clip = h->func.avs_take_clip( res, h->env );
const AVS_VideoInfo *vi = h->func.avs_get_video_info( h->clip );
- FAIL_IF_ERROR( !avs_has_video( vi ), "`%s' has no video data\n", psz_filename )
+ FAIL_IF_ERROR( !avs_has_video( vi ), "`%s' has no video data\n", psz_filename );
/* if the clip is made of fields instead of frames, call weave to make them frames */
if( avs_is_field_based( vi ) )
{
x264_cli_log( "avs", X264_LOG_WARNING, "detected fieldbased (separated) input, weaving to frames\n" );
AVS_Value tmp = h->func.avs_invoke( h->env, "Weave", res, NULL );
- FAIL_IF_ERROR( avs_is_error( tmp ), "couldn't weave fields into frames\n" )
+ FAIL_IF_ERROR( avs_is_error( tmp ), "couldn't weave fields into frames\n" );
res = update_clip( h, &vi, tmp, res );
info->interlaced = 1;
info->tff = avs_is_tff( vi );
#if !HAVE_SWSCALE
/* if swscale is not available, convert the CSP if necessary */
FAIL_IF_ERROR( avs_version < 2.6f && (opt->output_csp == X264_CSP_I422 || opt->output_csp == X264_CSP_I444),
- "avisynth >= 2.6 is required for i422/i444 output\n" )
+ "avisynth >= 2.6 is required for i422/i444 output\n" );
if( (opt->output_csp == X264_CSP_I420 && !avs_is_yv12( vi )) || (opt->output_csp == X264_CSP_I422 && !avs_is_yv16( vi )) ||
(opt->output_csp == X264_CSP_I444 && !avs_is_yv24( vi )) || (opt->output_csp == X264_CSP_RGB && !avs_is_rgb( vi )) )
{
opt->output_csp == X264_CSP_I444 ? "YV24" : "RGB";
x264_cli_log( "avs", X264_LOG_WARNING, "converting input clip to %s\n", csp );
FAIL_IF_ERROR( opt->output_csp < X264_CSP_I444 && (vi->width&1),
- "input clip width not divisible by 2 (%dx%d)\n", vi->width, vi->height )
+ "input clip width not divisible by 2 (%dx%d)\n", vi->width, vi->height );
FAIL_IF_ERROR( opt->output_csp == X264_CSP_I420 && info->interlaced && (vi->height&3),
- "input clip height not divisible by 4 (%dx%d)\n", vi->width, vi->height )
+ "input clip height not divisible by 4 (%dx%d)\n", vi->width, vi->height );
FAIL_IF_ERROR( (opt->output_csp == X264_CSP_I420 || info->interlaced) && (vi->height&1),
- "input clip height not divisible by 2 (%dx%d)\n", vi->width, vi->height )
+ "input clip height not divisible by 2 (%dx%d)\n", vi->width, vi->height );
char conv_func[14];
snprintf( conv_func, sizeof(conv_func), "ConvertTo%s", csp );
char matrix[7] = "";
arg_arr[1] = avs_new_value_bool( info->interlaced );
arg_arr[2] = avs_new_value_string( matrix );
AVS_Value res2 = h->func.avs_invoke( h->env, conv_func, avs_new_value_array( arg_arr, arg_count ), arg_name );
- FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert input clip to %s\n", csp )
+ FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert input clip to %s\n", csp );
res = update_clip( h, &vi, res2, res );
}
/* if swscale is not available, change the range if necessary. This only applies to YUV-based CSPs however */
arg_arr[1] = avs_new_value_string( levels );
const char *arg_name[] = { NULL, "levels" };
AVS_Value res2 = h->func.avs_invoke( h->env, "ColorYUV", avs_new_value_array( arg_arr, 2 ), arg_name );
- FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert range: %s\n", avs_as_error( res2 ) )
+ FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert range: %s\n", avs_as_error( res2 ) );
res = update_clip( h, &vi, res2, res );
// notification that the input range has changed to the desired one
opt->input_range = opt->output_range;
return -1;
AVS_VideoFrame *frm = pic->opaque = h->func.avs_get_frame( h->clip, i_frame );
const char *err = h->func.avs_clip_get_error( h->clip );
- FAIL_IF_ERROR( err, "%s occurred while reading frame %d\n", err, i_frame )
+ FAIL_IF_ERROR( err, "%s occurred while reading frame %d\n", err, i_frame );
for( int i = 0; i < pic->img.planes; i++ )
{
/* explicitly cast away the const attribute to avoid a warning */
if( !idx )
{
FFMS_Indexer *indexer = FFMS_CreateIndexer( psz_filename, &e );
- FAIL_IF_ERROR( !indexer, "could not create indexer\n" )
+ FAIL_IF_ERROR( !indexer, "could not create indexer\n" );
if( opt->progress )
FFMS_SetProgressCallback( indexer, update_progress, &h->time );
idx = FFMS_DoIndexing2( indexer, FFMS_IEH_ABORT, &e );
fprintf( stderr, "%*c", PROGRESS_LENGTH+1, '\r' );
- FAIL_IF_ERROR( !idx, "could not create index\n" )
+ FAIL_IF_ERROR( !idx, "could not create index\n" );
if( opt->index_file && FFMS_WriteIndex( opt->index_file, idx, &e ) )
x264_cli_log( "ffms", X264_LOG_WARNING, "could not write index file\n" );
h->video_source = FFMS_CreateVideoSource( psz_filename, trackno, idx, 1, seekmode, &e );
FFMS_DestroyIndex( idx );
- FAIL_IF_ERROR( trackno < 0, "could not find video track\n" )
- FAIL_IF_ERROR( !h->video_source, "could not create video source\n" )
+ FAIL_IF_ERROR( trackno < 0, "could not find video track\n" );
+ FAIL_IF_ERROR( !h->video_source, "could not create video source\n" );
const FFMS_VideoProperties *videop = FFMS_GetVideoProperties( h->video_source );
info->num_frames = h->num_frames = videop->NumFrames;
info->thread_safe = 0;
const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, 0, &e );
- FAIL_IF_ERROR( !frame, "could not read frame 0\n" )
+ FAIL_IF_ERROR( !frame, "could not read frame 0\n" );
info->fullrange = 0;
info->width = frame->EncodedWidth;
FFMS_ErrorInfo e;
e.BufferSize = 0;
const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, i_frame, &e );
- FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame )
+ FAIL_IF_ERROR( !frame, "could not read frame %d \n", i_frame );
memcpy( pic->img.stride, frame->Linesize, sizeof(pic->img.stride) );
memcpy( pic->img.plane, frame->Data, sizeof(pic->img.plane) );
{
const FFMS_FrameInfo *info = FFMS_GetFrameInfo( h->track, i_frame );
FAIL_IF_ERROR( info->PTS == AV_NOPTS_VALUE, "invalid timestamp. "
- "Use --force-cfr and specify a framerate with --fps\n" )
+ "Use --force-cfr and specify a framerate with --fps\n" );
pic->pts = info->PTS >> h->reduce_pts;
pic->duration = 0;
if( opt->format )
FAIL_IF_ERROR( !(format = av_find_input_format( opt->format )), "unknown file format: %s\n", opt->format );
- FAIL_IF_ERROR( avformat_open_input( &h->lavf, psz_filename, format, &options ), "could not open input file\n" )
+ FAIL_IF_ERROR( avformat_open_input( &h->lavf, psz_filename, format, &options ), "could not open input file\n" );
if( options )
av_dict_free( &options );
- FAIL_IF_ERROR( avformat_find_stream_info( h->lavf, NULL ) < 0, "could not find input stream info\n" )
+ FAIL_IF_ERROR( avformat_find_stream_info( h->lavf, NULL ) < 0, "could not find input stream info\n" );
int i = 0;
while( i < h->lavf->nb_streams && h->lavf->streams[i]->codec->codec_type != AVMEDIA_TYPE_VIDEO )
i++;
- FAIL_IF_ERROR( i == h->lavf->nb_streams, "could not find video stream\n" )
+ FAIL_IF_ERROR( i == h->lavf->nb_streams, "could not find video stream\n" );
h->stream_id = i;
h->next_frame = 0;
AVCodecContext *c = h->lavf->streams[i]->codec;
info->thread_safe = 0;
h->vfr_input = info->vfr;
FAIL_IF_ERROR( avcodec_open2( c, avcodec_find_decoder( c->codec_id ), NULL ),
- "could not find decoder for video stream\n" )
+ "could not find decoder for video stream\n" );
/* prefetch the first frame and set/confirm flags */
h->first_pic = malloc( sizeof(cli_pic_t) );
FAIL_IF_ERROR( !h->first_pic || lavf_input.picture_alloc( h->first_pic, h, X264_CSP_OTHER, info->width, info->height ),
- "malloc failed\n" )
- else if( read_frame_internal( h->first_pic, h, 0, info ) )
+ "malloc failed\n" );
+ if( read_frame_internal( h->first_pic, h, 0, info ) )
return -1;
info->width = c->width;
}
else
sscanf( opt->resolution, "%dx%d", &info->width, &info->height );
- FAIL_IF_ERROR( !info->width || !info->height, "raw input requires a resolution.\n" )
+ FAIL_IF_ERROR( !info->width || !info->height, "raw input requires a resolution.\n" );
if( opt->colorspace )
{
for( info->csp = X264_CSP_CLI_MAX-1; info->csp > X264_CSP_NONE; info->csp-- )
{
thread_hnd_t *h = malloc( sizeof(thread_hnd_t) );
FAIL_IF_ERR( !h || cli_input.picture_alloc( &h->pic, *p_handle, info->csp, info->width, info->height ),
- "x264", "malloc failed\n" )
+ "x264", "malloc failed\n" );
h->input = cli_input;
h->p_handle = *p_handle;
h->next_frame = -1;
fps_den = i * h->timebase_num;
fps_num = round( fps_den * fps_sig ) * exponent;
FAIL_IF_ERROR( fps_num > UINT32_MAX, "tcfile fps correction failed.\n"
- " Specify an appropriate timebase manually or remake tcfile.\n" )
+ " Specify an appropriate timebase manually or remake tcfile.\n" );
if( fabs( ((double)fps_num / fps_den) / exponent - fps_sig ) < DOUBLE_EPSILON )
break;
++i;
fps_den = round( MKV_TIMEBASE_DEN / fps_sig ) / exponent;
h->timebase_num = fps_den && h->timebase_num ? gcd( h->timebase_num, fps_den ) : fps_den;
FAIL_IF_ERROR( h->timebase_num > UINT32_MAX || !h->timebase_num, "automatic timebase generation failed.\n"
- " Specify timebase manually.\n" )
+ " Specify timebase manually.\n" );
}
return 0;
}
double *fpss = NULL;
ret = fscanf( tcfile_in, "# timecode format v%d", &tcfv );
- FAIL_IF_ERROR( ret != 1 || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" )
+ FAIL_IF_ERROR( ret != 1 || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" );
#define NO_TIMECODE_LINE (buff[0] == '#' || buff[0] == '\n' || buff[0] == '\r')
if( tcfv == 1 )
{
if( NO_TIMECODE_LINE )
continue;
FAIL_IF_ERROR( sscanf( buff, "assume %lf", &h->assume_fps ) != 1 && sscanf( buff, "Assume %lf", &h->assume_fps ) != 1,
- "tcfile parsing error: assumed fps not found\n" )
+ "tcfile parsing error: assumed fps not found\n" );
break;
}
- FAIL_IF_ERROR( h->assume_fps <= 0, "invalid assumed fps %.6f\n", h->assume_fps )
+ FAIL_IF_ERROR( h->assume_fps <= 0, "invalid assumed fps %.6f\n", h->assume_fps );
file_pos = ftell( tcfile_in );
h->stored_pts_num = 0;
continue;
}
ret = sscanf( buff, "%d,%d,%lf", &start, &end, &seq_fps );
- FAIL_IF_ERROR( ret != 3 && ret != EOF, "invalid input tcfile\n" )
+ FAIL_IF_ERROR( ret != 3 && ret != EOF, "invalid input tcfile\n" );
FAIL_IF_ERROR( start > end || start <= prev_start || end <= prev_end || seq_fps <= 0,
- "invalid input tcfile at line %d: %s\n", num, buff )
+ "invalid input tcfile at line %d: %s\n", num, buff );
prev_start = start;
prev_end = end;
if( h->auto_timebase_den || h->auto_timebase_num )
h->stored_pts_num++;
}
timecodes_num = h->stored_pts_num;
- FAIL_IF_ERROR( !timecodes_num, "input tcfile doesn't have any timecodes!\n" )
+ FAIL_IF_ERROR( !timecodes_num, "input tcfile doesn't have any timecodes!\n" );
fseek( tcfile_in, file_pos, SEEK_SET );
timecodes = malloc( timecodes_num * sizeof(double) );
{
ret = sscanf( buff, "%lf", &timecodes[0] );
timecodes[0] *= 1e-3; /* Timecode format v2 is expressed in milliseconds. */
- FAIL_IF_ERROR( ret != 1, "invalid input tcfile for frame 0\n" )
+ FAIL_IF_ERROR( ret != 1, "invalid input tcfile for frame 0\n" );
for( num = 1; num < timecodes_num && fgets( buff, sizeof(buff), tcfile_in ) != NULL; )
{
if( NO_TIMECODE_LINE )
ret = sscanf( buff, "%lf", &timecodes[num] );
timecodes[num] *= 1e-3; /* Timecode format v2 is expressed in milliseconds. */
FAIL_IF_ERROR( ret != 1 || timecodes[num] <= timecodes[num - 1],
- "invalid input tcfile for frame %d\n", num )
+ "invalid input tcfile for frame %d\n", num );
++num;
}
}
- FAIL_IF_ERROR( num < timecodes_num, "failed to read input tcfile for frame %d", num )
+ FAIL_IF_ERROR( num < timecodes_num, "failed to read input tcfile for frame %d", num );
if( timecodes_num == 1 )
h->timebase_den = info->fps_num;
x264_cli_log( "timecode", X264_LOG_INFO, "automatic timebase generation %"PRIu64"/%"PRIu64"\n", h->timebase_num, h->timebase_den );
}
else FAIL_IF_ERROR( h->timebase_den > UINT32_MAX || !h->timebase_den, "automatic timebase generation failed.\n"
- " Specify an appropriate timebase manually.\n" )
+ " Specify an appropriate timebase manually.\n" );
h->pts = malloc( h->stored_pts_num * sizeof(int64_t) );
if( !h->pts )
for( num = 0; num < h->stored_pts_num; num++ )
{
h->pts[num] = timecodes[num] * ((double)h->timebase_den / h->timebase_num) + 0.5;
- FAIL_IF_ERROR( num > 0 && h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num )
+ FAIL_IF_ERROR( num > 0 && h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num );
}
free( timecodes );
int ret = 0;
FILE *tcfile_in;
timecode_hnd_t *h = malloc( sizeof(timecode_hnd_t) );
- FAIL_IF_ERROR( !h, "malloc failed\n" )
+ FAIL_IF_ERROR( !h, "malloc failed\n" );
h->input = cli_input;
h->p_handle = *p_handle;
h->pts = NULL;
h->timebase_den = 0; /* set later by auto timebase generation */
}
FAIL_IF_ERROR( h->timebase_num > UINT32_MAX || h->timebase_den > UINT32_MAX,
- "timebase you specified exceeds H.264 maximum\n" )
+ "timebase you specified exceeds H.264 maximum\n" );
}
h->auto_timebase_num = !ret;
h->auto_timebase_den = ret < 2;
h->timebase_den = 0; /* set later by auto timebase generation */
tcfile_in = x264_fopen( psz_filename, "rb" );
- FAIL_IF_ERROR( !tcfile_in, "can't open `%s'\n", psz_filename )
- else if( !x264_is_regular_file( tcfile_in ) )
+ FAIL_IF_ERROR( !tcfile_in, "can't open `%s'\n", psz_filename );
+ if( !x264_is_regular_file( tcfile_in ) )
{
x264_cli_log( "timecode", X264_LOG_ERROR, "tcfile input incompatible with non-regular file `%s'\n", psz_filename );
fclose( tcfile_in );
break;
}
}
- FAIL_IF_ERROR( strncmp( header, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1 ), "bad sequence header magic\n" )
- FAIL_IF_ERROR( i == MAX_YUV4_HEADER, "bad sequence header length\n" )
+ FAIL_IF_ERROR( strncmp( header, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1 ), "bad sequence header magic\n" );
+ FAIL_IF_ERROR( i == MAX_YUV4_HEADER, "bad sequence header length\n" );
/* Scan properties */
header_end = &header[i+1]; /* Include space */
h->bit_depth = 8;
}
- FAIL_IF_ERROR( colorspace <= X264_CSP_NONE || colorspace >= X264_CSP_MAX, "colorspace unhandled\n" )
+ FAIL_IF_ERROR( colorspace <= X264_CSP_NONE || colorspace >= X264_CSP_MAX, "colorspace unhandled\n" );
FAIL_IF_ERROR( h->bit_depth < 8 || h->bit_depth > 16, "unsupported bit depth `%d'\n", h->bit_depth );
info->thread_safe = 1;
int len = 1;
while( len <= MAX_FRAME_HEADER && fgetc( h->fh ) != '\n' )
len++;
- FAIL_IF_ERROR( len > MAX_FRAME_HEADER || len < sizeof(Y4M_FRAME_MAGIC), "bad frame header length\n" )
+ FAIL_IF_ERROR( len > MAX_FRAME_HEADER || len < sizeof(Y4M_FRAME_MAGIC), "bad frame header length\n" );
h->frame_header_len = len;
h->frame_size += len;
* produces y4m files with variable-length frame headers so just error out if that happens. */
while( i <= h->frame_header_len && header[i-1] != '\n' )
i++;
- FAIL_IF_ERROR( i != h->frame_header_len, "bad frame header length\n" )
+ FAIL_IF_ERROR( i != h->frame_header_len, "bad frame header length\n" );
}
else
{
return -1;
while( i <= MAX_FRAME_HEADER && fgetc( h->fh ) != '\n' )
i++;
- FAIL_IF_ERROR( i > MAX_FRAME_HEADER, "bad frame header length\n" )
+ FAIL_IF_ERROR( i > MAX_FRAME_HEADER, "bad frame header length\n" );
}
- FAIL_IF_ERROR( memcmp( header, Y4M_FRAME_MAGIC, slen ), "bad frame header magic\n" )
+ FAIL_IF_ERROR( memcmp( header, Y4M_FRAME_MAGIC, slen ), "bad frame header magic\n" );
for( i = 0; i < pic->img.planes; i++ )
{
{
CHECK( mk_write_id( c, id ) );
CHECK( mk_write_size( c, size ) );
- CHECK( mk_append_context_data( c, data, size ) ) ;
+ CHECK( mk_append_context_data( c, data, size ) );
return 0;
}
return -1;
int b_regular = x264_is_regular_file( fh );
fclose( fh );
- FAIL_IF_ERR( !b_regular, "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename )
+ FAIL_IF_ERR( !b_regular, "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename );
mp4_hnd_t *p_mp4 = calloc( 1, sizeof(mp4_hnd_t) );
if( !p_mp4 )
#ifdef _WIN32
/* GPAC doesn't support Unicode filenames. */
char ansi_filename[MAX_PATH];
- FAIL_IF_ERR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 1 ), "mp4", "invalid ansi filename\n" )
+ FAIL_IF_ERR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 1 ), "mp4", "invalid ansi filename\n" );
p_mp4->p_file = gf_isom_open( ansi_filename, GF_ISOM_OPEN_WRITE, NULL );
#else
p_mp4->p_file = gf_isom_open( psz_filename, GF_ISOM_OPEN_WRITE, NULL );
p_mp4->i_time_res = (uint64_t)p_param->i_timebase_den * p_mp4->i_dts_compress_multiplier;
p_mp4->i_time_inc = (uint64_t)p_param->i_timebase_num * p_mp4->i_dts_compress_multiplier;
- FAIL_IF_ERR( p_mp4->i_time_res > UINT32_MAX, "mp4", "MP4 media timescale %"PRIu64" exceeds maximum\n", p_mp4->i_time_res )
+ FAIL_IF_ERR( p_mp4->i_time_res > UINT32_MAX, "mp4", "MP4 media timescale %"PRIu64" exceeds maximum\n", p_mp4->i_time_res );
p_mp4->i_track = gf_isom_new_track( p_mp4->p_file, 0, GF_ISOM_MEDIA_VISUAL,
p_mp4->i_time_res );
uint64_t dh = p_param->i_height << 16;
double sar = (double)p_param->vui.i_sar_width / p_param->vui.i_sar_height;
if( sar > 1.0 )
- dw *= sar ;
+ dw *= sar;
else
dh /= sar;
gf_isom_set_pixel_aspect_ratio( p_mp4->p_file, p_mp4->i_track, p_mp4->i_descidx, p_param->vui.i_sar_width, p_param->vui.i_sar_height );
/* For close_file() */
#define MP4_LOG_IF_ERR( cond, ... )\
-if( cond )\
+do\
{\
- MP4_LOG_ERROR( __VA_ARGS__ );\
-}
+ if( cond )\
+ {\
+ MP4_LOG_ERROR( __VA_ARGS__ );\
+ }\
+} while( 0 )
/* For open_file() */
#define MP4_FAIL_IF_ERR_EX( cond, ... )\
-if( cond )\
+do\
{\
- remove_mp4_hnd( p_mp4 );\
- MP4_LOG_ERROR( __VA_ARGS__ );\
- return -1;\
-}
+ if( cond )\
+ {\
+ remove_mp4_hnd( p_mp4 );\
+ MP4_LOG_ERROR( __VA_ARGS__ );\
+ return -1;\
+ }\
+} while( 0 )
/*******************/
int dmf = h->dequant4_mf[CQM_4IC][qpdc%6][0] << qpdc/6; \
if( dmf > 32*64 ) \
continue; \
- for( int i = 16; ; i <<= 1 ) \
+ for( int i = 16;; i <<= 1 ) \
{ \
int res_c, res_asm; \
int max = X264_MIN( i, PIXEL_MAX*16 ); \
cli_opt_t opt = {0};
int ret = 0;
- FAIL_IF_ERROR( x264_threading_init(), "unable to initialize threading\n" )
+ FAIL_IF_ERROR( x264_threading_init(), "unable to initialize threading\n" );
#ifdef _WIN32
- FAIL_IF_ERROR( !get_argv_utf8( &argc, &argv ), "unable to convert command line to UTF-8\n" )
+ FAIL_IF_ERROR( !get_argv_utf8( &argc, &argv ), "unable to convert command line to UTF-8\n" );
GetConsoleTitleW( org_console_title, CONSOLE_TITLE_SIZE );
_setmode( _fileno( stdin ), _O_BINARY );
cli_input = raw_input;
}
- FAIL_IF_ERROR( !(*p_handle), "could not open input file `%s' via any method!\n", filename )
+ FAIL_IF_ERROR( !(*p_handle), "could not open input file `%s' via any method!\n", filename );
}
strcpy( used_demuxer, module );
output_filename = optarg;
break;
case OPT_MUXER:
- FAIL_IF_ERROR( parse_enum_name( optarg, muxer_names, &muxer ), "Unknown muxer `%s'\n", optarg )
+ FAIL_IF_ERROR( parse_enum_name( optarg, muxer_names, &muxer ), "Unknown muxer `%s'\n", optarg );
break;
case OPT_DEMUXER:
- FAIL_IF_ERROR( parse_enum_name( optarg, demuxer_names, &demuxer ), "Unknown demuxer `%s'\n", optarg )
+ FAIL_IF_ERROR( parse_enum_name( optarg, demuxer_names, &demuxer ), "Unknown demuxer `%s'\n", optarg );
break;
case OPT_INDEX:
input_opt.index_file = optarg;
break;
case OPT_QPFILE:
opt->qpfile = x264_fopen( optarg, "rb" );
- FAIL_IF_ERROR( !opt->qpfile, "can't open qpfile `%s'\n", optarg )
+ FAIL_IF_ERROR( !opt->qpfile, "can't open qpfile `%s'\n", optarg );
if( !x264_is_regular_file( opt->qpfile ) )
{
x264_cli_log( "x264", X264_LOG_ERROR, "qpfile incompatible with non-regular file `%s'\n", optarg );
break;
case OPT_TCFILE_OUT:
opt->tcfile_out = x264_fopen( optarg, "wb" );
- FAIL_IF_ERROR( !opt->tcfile_out, "can't open `%s'\n", optarg )
+ FAIL_IF_ERROR( !opt->tcfile_out, "can't open `%s'\n", optarg );
break;
case OPT_TIMEBASE:
input_opt.timebase = optarg;
break;
case OPT_PULLDOWN:
- FAIL_IF_ERROR( parse_enum_value( optarg, pulldown_names, &opt->i_pulldown ), "Unknown pulldown `%s'\n", optarg )
+ FAIL_IF_ERROR( parse_enum_value( optarg, pulldown_names, &opt->i_pulldown ), "Unknown pulldown `%s'\n", optarg );
break;
case OPT_VIDEO_FILTER:
vid_filters = optarg;
output_opt.use_dts_compress = 1;
break;
case OPT_OUTPUT_CSP:
- FAIL_IF_ERROR( parse_enum_value( optarg, output_csp_names, &output_csp ), "Unknown output csp `%s'\n", optarg )
+ FAIL_IF_ERROR( parse_enum_value( optarg, output_csp_names, &output_csp ), "Unknown output csp `%s'\n", optarg );
// correct the parsed value to the libx264 csp value
#if X264_CHROMA_FORMAT
static const uint8_t output_csp_fix[] = { X264_CHROMA_FORMAT, X264_CSP_RGB };
param->i_csp = output_csp = output_csp_fix[output_csp];
break;
case OPT_INPUT_RANGE:
- FAIL_IF_ERROR( parse_enum_value( optarg, range_names, &input_opt.input_range ), "Unknown input range `%s'\n", optarg )
+ FAIL_IF_ERROR( parse_enum_value( optarg, range_names, &input_opt.input_range ), "Unknown input range `%s'\n", optarg );
input_opt.input_range += RANGE_AUTO;
break;
case OPT_RANGE:
/* Get the file name */
FAIL_IF_ERROR( optind > argc - 1 || !output_filename, "No %s file. Run x264 --help for a list of options.\n",
- optind > argc - 1 ? "input" : "output" )
+ optind > argc - 1 ? "input" : "output" );
if( select_output( muxer, output_filename, param ) )
return -1;
- FAIL_IF_ERROR( cli_output.open_file( output_filename, &opt->hout, &output_opt ), "could not open output file `%s'\n", output_filename )
+ FAIL_IF_ERROR( cli_output.open_file( output_filename, &opt->hout, &output_opt ), "could not open output file `%s'\n", output_filename );
input_filename = argv[optind++];
video_info_t info = {0};
return -1;
FAIL_IF_ERROR( !opt->hin && cli_input.open_file( input_filename, &opt->hin, &info, &input_opt ),
- "could not open input file `%s'\n", input_filename )
+ "could not open input file `%s'\n", input_filename );
x264_reduce_fraction( &info.sar_width, &info.sar_height );
x264_reduce_fraction( &info.fps_num, &info.fps_den );
if( tcfile_name )
{
- FAIL_IF_ERROR( b_user_fps, "--fps + --tcfile-in is incompatible.\n" )
- FAIL_IF_ERROR( timecode_input.open_file( tcfile_name, &opt->hin, &info, &input_opt ), "timecode input failed\n" )
+ FAIL_IF_ERROR( b_user_fps, "--fps + --tcfile-in is incompatible.\n" );
+ FAIL_IF_ERROR( timecode_input.open_file( tcfile_name, &opt->hin, &info, &input_opt ), "timecode input failed\n" );
cli_input = timecode_input;
}
- else FAIL_IF_ERROR( !info.vfr && input_opt.timebase, "--timebase is incompatible with cfr input\n" )
+ else FAIL_IF_ERROR( !info.vfr && input_opt.timebase, "--timebase is incompatible with cfr input\n" );
/* init threaded input while the information about the input video is unaltered by filtering */
#if HAVE_THREAD
uint64_t i_user_timebase_num;
uint64_t i_user_timebase_den;
int ret = sscanf( input_opt.timebase, "%"SCNu64"/%"SCNu64, &i_user_timebase_num, &i_user_timebase_den );
- FAIL_IF_ERROR( !ret, "invalid argument: timebase = %s\n", input_opt.timebase )
- else if( ret == 1 )
+ FAIL_IF_ERROR( !ret, "invalid argument: timebase = %s\n", input_opt.timebase );
+ if( ret == 1 )
{
i_user_timebase_num = info.timebase_num;
i_user_timebase_den = strtoul( input_opt.timebase, NULL, 10 );
}
FAIL_IF_ERROR( i_user_timebase_num > UINT32_MAX || i_user_timebase_den > UINT32_MAX,
- "timebase you specified exceeds H.264 maximum\n" )
+ "timebase you specified exceeds H.264 maximum\n" );
opt->timebase_convert_multiplier = ((double)i_user_timebase_den / info.timebase_den)
* ((double)info.timebase_num / i_user_timebase_num);
info.timebase_num = i_user_timebase_num;
if( input_opt.output_range == RANGE_AUTO )
param->vui.b_fullrange = RANGE_PC;
/* otherwise fail if they specified tv */
- FAIL_IF_ERROR( !param->vui.b_fullrange, "RGB must be PC range" )
+ FAIL_IF_ERROR( !param->vui.b_fullrange, "RGB must be PC range" );
}
/* Automatically reduce reference frame count to match the user's target level
}
#define FAIL_IF_ERROR2( cond, ... )\
-if( cond )\
+do\
{\
- x264_cli_log( "x264", X264_LOG_ERROR, __VA_ARGS__ );\
- retval = -1;\
- goto fail;\
-}
+ if( cond )\
+ {\
+ x264_cli_log( "x264", X264_LOG_ERROR, __VA_ARGS__ );\
+ retval = -1;\
+ goto fail;\
+ }\
+} while( 0 )
static int encode( x264_param_t *param, cli_opt_t *opt )
{
pulldown = &pulldown_values[opt->i_pulldown];
param->i_timebase_num = param->i_fps_den;
FAIL_IF_ERROR2( fmod( param->i_fps_num * pulldown->fps_factor, 1 ),
- "unsupported framerate for chosen pulldown\n" )
+ "unsupported framerate for chosen pulldown\n" );
param->i_timebase_den = param->i_fps_num * pulldown->fps_factor;
}
/* ticks/frame = ticks/second / frames/second */
ticks_per_frame = (int64_t)param->i_timebase_den * param->i_fps_den / param->i_timebase_num / param->i_fps_num;
- FAIL_IF_ERROR2( ticks_per_frame < 1 && !param->b_vfr_input, "ticks_per_frame invalid: %"PRId64"\n", ticks_per_frame )
+ FAIL_IF_ERROR2( ticks_per_frame < 1 && !param->b_vfr_input, "ticks_per_frame invalid: %"PRId64"\n", ticks_per_frame );
ticks_per_frame = X264_MAX( ticks_per_frame, 1 );
if( !param->b_repeat_headers )
x264_nal_t *headers;
int i_nal;
- FAIL_IF_ERROR2( x264_encoder_headers( h, &headers, &i_nal ) < 0, "x264_encoder_headers failed\n" )
+ FAIL_IF_ERROR2( x264_encoder_headers( h, &headers, &i_nal ) < 0, "x264_encoder_headers failed\n" );
FAIL_IF_ERROR2( (i_file = cli_output.write_headers( opt->hout, headers )) < 0, "error writing headers to output file\n" );
}
#endif
#define RETURN_IF_ERR( cond, name, ret, ... )\
-if( cond )\
+do\
{\
- x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
- return ret;\
-}
+ if( cond )\
+ {\
+ x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
+ return ret;\
+ }\
+} while( 0 )
#define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )