Skip to content

Commit 6c2a19a

Browse files
committed
AviSynth: allow format="" (#54)
1 parent d365e8b commit 6c2a19a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

AviSynth/libavsmash_source.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,13 @@ AVSValue __cdecl CreateLSMASHVideoSource( AVSValue args, void *user_data, IScrip
530530
enum AVPixelFormat pixel_format = AV_PIX_FMT_NONE;
531531
if (args[8].Defined())
532532
{
533-
pixel_format = get_av_output_pixel_format(args[8].AsString(nullptr));
534-
if (pixel_format == AV_PIX_FMT_NONE)
535-
env->ThrowError("LSMASHVideoSource: wrong format.");
533+
const char* pix_fmt = args[8].AsString();
534+
if (strcmp(pix_fmt, ""))
535+
{
536+
pixel_format = get_av_output_pixel_format(pix_fmt);
537+
if (pixel_format == AV_PIX_FMT_NONE)
538+
env->ThrowError("LSMASHVideoSource: wrong format.");
539+
}
536540
}
537541
const char *preferred_decoder_names = args[9].AsString( nullptr );
538542
int prefer_hw_decoder = args[10].AsInt( 0 );

AviSynth/lwlibav_source.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,13 @@ AVSValue __cdecl CreateLWLibavVideoSource( AVSValue args, void *user_data, IScri
415415
enum AVPixelFormat pixel_format = AV_PIX_FMT_NONE;
416416
if (args[12].Defined())
417417
{
418-
pixel_format = get_av_output_pixel_format(args[12].AsString());
419-
if (pixel_format == AV_PIX_FMT_NONE)
420-
env->ThrowError("LWLibavVideoSource: wrong format.");
418+
const char* pix_fmt = args[12].AsString();
419+
if (strcmp(pix_fmt, ""))
420+
{
421+
pixel_format = get_av_output_pixel_format(pix_fmt);
422+
if (pixel_format == AV_PIX_FMT_NONE)
423+
env->ThrowError("LWLibavVideoSource: wrong format.");
424+
}
421425
}
422426
const char *preferred_decoder_names = args[13].AsString( nullptr );
423427
int prefer_hw_decoder = args[14].AsInt( 0 );

0 commit comments

Comments
 (0)