@@ -105,6 +105,7 @@ typedef struct AviSynthContext {
/* (de)activate reading frame properties */
int frameprops;
int frameprop_field_order;
+ int frameprop_range;
int frameprop_sar;
/* Linked list pointers. */
@@ -547,18 +548,20 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
}
/* Color Range */
- if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) {
- st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
- } else {
- switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) {
- case 0:
- st->codecpar->color_range = AVCOL_RANGE_JPEG;
- break;
- case 1:
- st->codecpar->color_range = AVCOL_RANGE_MPEG;
- break;
- default:
+ if(avs->frameprop_range) {
+ if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) {
st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+ } else {
+ switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, &error)) {
+ case 0:
+ st->codecpar->color_range = AVCOL_RANGE_JPEG;
+ break;
+ case 1:
+ st->codecpar->color_range = AVCOL_RANGE_MPEG;
+ break;
+ default:
+ st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED;
+ }
}
}
@@ -1156,6 +1159,7 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index,
static const AVOption avisynth_options[] = {
{ "read_frameprops", "Read frame properties from script (AviSynth+ v3.7.1+).", OFFSET(frameprops), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "read_frameprop_field_order", "Read field order from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_field_order), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+ { "read_frameprop_range", "Read color range from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_range), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "read_frameprop_sar", "Read SAR from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
Signed-off-by: Stephen Hutchinson <qyot27@gmail.com> --- libavformat/avisynth.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)