Skip to content

Commit e70a53e

Browse files
committed
repeat=true: give more helpful error message (#53)
1 parent 234f693 commit e70a53e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

AviSynth/lwlibav_source.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,17 @@ LWLibavVideoSource::LWLibavVideoSource
151151
indicator.update = (progress) ? update_indicator : NULL;
152152
indicator.close = (progress) ? close_indicator : NULL;
153153
/* Construct index. */
154+
const int orig_apply_repeat_flag = opt->apply_repeat_flag;
154155
int ret = lwlibav_construct_index( &lwh, vdhp, vohp, adhp.get(), aohp.get(), lhp, opt, &indicator, NULL );
155156
free_audio_decode_handler();
156157
free_audio_output_handler();
157158
if (ret < 0)
158159
env->ThrowError("LWLibavVideoSource: failed to construct index for %s.", lwh.file_path );
159160
/* Eliminate silent failure: if apply_repeat_flag == 1, then fail if repeat is not applied. */
160-
if (opt->apply_repeat_flag == 1)
161+
if (orig_apply_repeat_flag == 1)
161162
{
162163
if (vohp->repeat_requested && !vohp->repeat_control)
163-
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);
164+
env->ThrowError("LWLibavVideoSource: frame %d has mismatched field order (try repeat=false to get a VFR clip).", opt->apply_repeat_flag);
164165
}
165166
/* Get the desired video track. */
166167
if( lwlibav_video_get_desired_track( lwh.file_path, vdhp, lwh.threads ) < 0 )

VapourSynth/lwlibav_source.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,12 @@ void VS_CC vs_lwlibavsource_create( const VSMap *in, VSMap *out, void *user_data
426426
return;
427427
}
428428
/* Eliminate silent failure: if apply_repeat_flag == 1, then fail if repeat is not applied. */
429-
if ( opt.apply_repeat_flag == 1 )
429+
if ( apply_repeat_flag == 1 )
430430
{
431431
if ( vohp->repeat_requested && !vohp->repeat_control )
432432
{
433433
free_handler( &hp );
434-
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 );
434+
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 );
435435
return;
436436
}
437437
}

common/lwindex.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,11 @@ static void create_video_frame_order_list
10091009
complete_frame ^= 1;
10101010
order_count -= 1;
10111011
}
1012-
else if( !repeat_field )
1012+
else if (!repeat_field)
1013+
{
1014+
opt->apply_repeat_flag = i;
10131015
goto disable_repeat;
1016+
}
10141017
}
10151018
if( opt->apply_repeat_flag )
10161019
switch( repeat_pict )

0 commit comments

Comments
 (0)