Skip to content

Commit

Permalink
repeat=true: give more helpful error message (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asd-g committed Jan 6, 2024
1 parent 234f693 commit e70a53e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions AviSynth/lwlibav_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,17 @@ LWLibavVideoSource::LWLibavVideoSource
indicator.update = (progress) ? update_indicator : NULL;
indicator.close = (progress) ? close_indicator : NULL;
/* Construct index. */
const int orig_apply_repeat_flag = opt->apply_repeat_flag;
int ret = lwlibav_construct_index( &lwh, vdhp, vohp, adhp.get(), aohp.get(), lhp, opt, &indicator, NULL );
free_audio_decode_handler();
free_audio_output_handler();
if (ret < 0)
env->ThrowError("LWLibavVideoSource: failed to construct index for %s.", lwh.file_path );
/* Eliminate silent failure: if apply_repeat_flag == 1, then fail if repeat is not applied. */
if (opt->apply_repeat_flag == 1)
if (orig_apply_repeat_flag == 1)
{
if (vohp->repeat_requested && !vohp->repeat_control)
env->ThrowError("LWLibavVideoSource: repeat requested for %d frames by input video, but unable to obey (try repeat=false to get a VFR clip).", vohp->repeat_requested);
env->ThrowError("LWLibavVideoSource: frame %d has mismatched field order (try repeat=false to get a VFR clip).", opt->apply_repeat_flag);
}
/* Get the desired video track. */
if( lwlibav_video_get_desired_track( lwh.file_path, vdhp, lwh.threads ) < 0 )
Expand Down
4 changes: 2 additions & 2 deletions VapourSynth/lwlibav_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@ void VS_CC vs_lwlibavsource_create( const VSMap *in, VSMap *out, void *user_data
return;
}
/* Eliminate silent failure: if apply_repeat_flag == 1, then fail if repeat is not applied. */
if ( opt.apply_repeat_flag == 1 )
if ( apply_repeat_flag == 1 )
{
if ( vohp->repeat_requested && !vohp->repeat_control )
{
free_handler( &hp );
set_error_on_init( out, vsapi, "lsmas: repeat requested for %d frames by input video, but unable to obey (try repeat=0 to get a VFR clip).", vohp->repeat_requested );
set_error_on_init( out, vsapi, "lsmas: frame %d has mismatched field order (try repeat=0 to get a VFR clip).", opt.apply_repeat_flag );
return;
}
}
Expand Down
5 changes: 4 additions & 1 deletion common/lwindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,11 @@ static void create_video_frame_order_list
complete_frame ^= 1;
order_count -= 1;
}
else if( !repeat_field )
else if (!repeat_field)
{
opt->apply_repeat_flag = i;
goto disable_repeat;
}
}
if( opt->apply_repeat_flag )
switch( repeat_pict )
Expand Down

0 comments on commit e70a53e

Please sign in to comment.