Re: [FFmpeg-devel] [PATCH 2/2] configure: bump minimum AviSynth+ header version
On 7/16/23 1:12 AM, Stephen Hutchinson wrote: AVISYNTH_INTERFACE_VERSION 10 fell in-between the releases of 3.7.2 and 3.7.3, and is required to be able to read the channel layout information. --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index dab3fb9036..a85122921e 100755 --- a/configure +++ b/configure @@ -6657,8 +6657,8 @@ done # these are off by default, so fail if requested and not available enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && - { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || - die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 3 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.3"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && { check_pkg_config chromaprint libchromaprint "chromaprint.h" chromaprint_get_version || require chromaprint chromaprint.h chromaprint_get_version -lchromaprint; } Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avisynth: pass audio channel layout
On 7/16/23 1:12 AM, Stephen Hutchinson wrote: --- libavformat/avisynth.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index b426ac343e..027e8c63f6 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -62,6 +62,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_create_script_environment); AVSC_DECLARE_FUNC(avs_delete_script_environment); AVSC_DECLARE_FUNC(avs_get_audio); +AVSC_DECLARE_FUNC(avs_get_channel_mask); AVSC_DECLARE_FUNC(avs_get_error); AVSC_DECLARE_FUNC(avs_get_frame); AVSC_DECLARE_FUNC(avs_get_version); @@ -157,6 +158,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); +LOAD_AVS_FUNC(avs_get_channel_mask, 1); LOAD_AVS_FUNC(avs_get_error, 1); // New to AviSynth 2.6 LOAD_AVS_FUNC(avs_get_frame, 0); LOAD_AVS_FUNC(avs_get_version, 0); @@ -793,6 +795,10 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->duration= avs->vi->num_audio_samples; avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second); +if (avs_library.avs_get_version(avs->clip) >= 10) +av_channel_layout_from_mask(>codecpar->ch_layout, +avs_library.avs_get_channel_mask(avs->vi)); + switch (avs->vi->sample_type) { case AVS_SAMPLE_INT8: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] configure: bump minimum AviSynth+ header version
AVISYNTH_INTERFACE_VERSION 10 fell in-between the releases of 3.7.2 and 3.7.3, and is required to be able to read the channel layout information. --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index dab3fb9036..a85122921e 100755 --- a/configure +++ b/configure @@ -6657,8 +6657,8 @@ done # these are off by default, so fail if requested and not available enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && - { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || - die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 3 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.3"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && { check_pkg_config chromaprint libchromaprint "chromaprint.h" chromaprint_get_version || require chromaprint chromaprint.h chromaprint_get_version -lchromaprint; } -- 2.39.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avisynth: pass audio channel layout
--- libavformat/avisynth.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index b426ac343e..027e8c63f6 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -62,6 +62,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_create_script_environment); AVSC_DECLARE_FUNC(avs_delete_script_environment); AVSC_DECLARE_FUNC(avs_get_audio); +AVSC_DECLARE_FUNC(avs_get_channel_mask); AVSC_DECLARE_FUNC(avs_get_error); AVSC_DECLARE_FUNC(avs_get_frame); AVSC_DECLARE_FUNC(avs_get_version); @@ -157,6 +158,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_create_script_environment, 0); LOAD_AVS_FUNC(avs_delete_script_environment, 0); LOAD_AVS_FUNC(avs_get_audio, 0); +LOAD_AVS_FUNC(avs_get_channel_mask, 1); LOAD_AVS_FUNC(avs_get_error, 1); // New to AviSynth 2.6 LOAD_AVS_FUNC(avs_get_frame, 0); LOAD_AVS_FUNC(avs_get_version, 0); @@ -793,6 +795,10 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->duration= avs->vi->num_audio_samples; avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second); +if (avs_library.avs_get_version(avs->clip) >= 10) +av_channel_layout_from_mask(>codecpar->ch_layout, +avs_library.avs_get_channel_mask(avs->vi)); + switch (avs->vi->sample_type) { case AVS_SAMPLE_INT8: st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; -- 2.39.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/2] avisynth: pass audio channel layout
AviSynth+ 3.7.3 adds the ability to define audio channel layouts, and adding it to the libavformat demuxer is trivial. Bumps the minimum required version of the AviSynth+ headers to 3.7.3. Stephen Hutchinson (2): avisynth: pass audio channel layout configure: bump minimum AviSynth+ header version configure | 4 ++-- libavformat/avisynth.c | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.39.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avisynth: use AviSynth+'s frame properties to set various fields
On 8/25/22 3:46 AM, Steinar Apalnes wrote: tor. 25. aug. 2022 kl. 02:11 skrev Stephen Hutchinson : On 8/24/22 1:04 PM, Steinar Apalnes wrote: tir. 8. feb. 2022 kl. 12:03 skrev Stephen Hutchinson : * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson ... Hi Stephen, Would it be possible to add support for "_SARum" and "_SARDen" so that ffmpeg could also recognize the sample aspect ratio in avs scripts? I'm a bit hesitant to do so, namely because the _SARNum/Den properties are much more likely to need to have been changed due to operations in-script, and unless the user is studious about updating those properties after even just a basic resizing operation, then _SARNum/Den will still be set to the original values populated by the source filter, and will be wrong, leading to encodes ending up wrong and potentially bug reports to Trac which aren't actually the fault of the demuxer. This is partially coming from the fact that even the color-based properties that were already added have experienced some level of backlash because of the requirement for users to ensure the properties are correctly updated if they've done any changes to those factors (as best as I'm aware, the filters in the AviSynth+ core still only pass through the existing properties, but they don't update them if they pertain to that property's functionality; I believe some external filters do update them, however). I would be fairly confident in betting that users resizing video is far more common than them doing color correction ops that would require updating the frameprops FFmpeg can currently read. One mitigation to that, IMO, would be to flag that as an experimental feature, making it to where FFmpeg won't read _SARNum/Den unless the -strict option has been used. ___ If you think cherry picking what props to support under normal operation is the way to go then a -strict option to support *all* "scary" avs props would be very welcome indeed. Because as it is now we have nothing at all in regards to the SAR. Thanks for your efforts :-) -steinar SAR frameprops implemented in commit c49beead, and a more fine-grained, flags-based way to toggle any of the frameprops on and off added in commit adead1cc. Pushed a few minutes ago. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3 v2] avformat/avisynth: reindent
On 8/30/22 8:23 PM, Stephen Hutchinson wrote: Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 348 - 1 file changed, 174 insertions(+), 174 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 7bb2977383..b426ac343e 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -533,235 +533,235 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) /* Field order */ if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER) { -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { -st->codecpar->field_order = AV_FIELD_UNKNOWN; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } } -} /* Color Range */ if(avs->flags & AVISYNTH_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, )) { -case 0: -st->codecpar->color_range = AVCOL_RANGE_JPEG; -break; -case 1: -st->codecpar->color_range = AVCOL_RANGE_MPEG; -break; -default: +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, )) { +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; +} } } -} /* Color Primaries */ if(avs->flags & AVISYNTH_FRAMEPROP_PRIMARIES) { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { -case 1: -st->codecpar->color_primaries = AVCOL_PRI_BT709; -break; -case 2: -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; -break; -case 4: -st->codecpar->color_primaries = AVCOL_PRI_BT470M; -break; -case 5: -st->codecpar->color_primaries = AVCOL_PRI_BT470BG; -break; -case 6: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; -break; -case 7: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; -break; -case 8: -st->codecpar->color_primaries = AVCOL_PRI_FILM; -break; -case 9: -st->codecpar->color_primaries = AVCOL_PRI_BT2020; -break; -case 10: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE428; -break; -case 11: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; -break; -case 12: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; -break; -case 22: -st->codecpar->color_primaries = AVCOL_PRI_EBU3213; -break; -default: -st
Re: [FFmpeg-devel] [PATCH 2/3 v2] avformat/avisynth: implement avisynth_flags option
On 8/30/22 8:23 PM, Stephen Hutchinson wrote: Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 52 ++ 1 file changed, 52 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index d978e6ec40..7bb2977383 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -21,6 +21,7 @@ #include "libavutil/attributes.h" #include "libavutil/internal.h" +#include "libavutil/opt.h" #include "libavcodec/internal.h" @@ -85,7 +86,18 @@ typedef struct AviSynthLibrary { #undef AVSC_DECLARE_FUNC } AviSynthLibrary; +typedef enum AviSynthFlags { +AVISYNTH_FRAMEPROP_FIELD_ORDER = (1 << 0), +AVISYNTH_FRAMEPROP_RANGE = (1 << 1), +AVISYNTH_FRAMEPROP_PRIMARIES = (1 << 2), +AVISYNTH_FRAMEPROP_TRANSFER = (1 << 3), +AVISYNTH_FRAMEPROP_MATRIX = (1 << 4), +AVISYNTH_FRAMEPROP_CHROMA_LOCATION = (1 << 5), +AVISYNTH_FRAMEPROP_SAR = (1 << 6), +} AviSynthFlags; + typedef struct AviSynthContext { +const AVClass *class; AVS_ScriptEnvironment *env; AVS_Clip *clip; const AVS_VideoInfo *vi; @@ -100,6 +112,8 @@ typedef struct AviSynthContext { int error; +uint32_t flags; + /* Linked list pointers. */ struct AviSynthContext *next; } AviSynthContext; @@ -518,6 +532,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ +if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; } else { @@ -535,8 +550,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->field_order = AV_FIELD_UNKNOWN; } } +} /* Color Range */ +if(avs->flags & AVISYNTH_FRAMEPROP_RANGE) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) { st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; } else { @@ -551,8 +568,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; } } +} /* Color Primaries */ +if(avs->flags & AVISYNTH_FRAMEPROP_PRIMARIES) { switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { case 1: st->codecpar->color_primaries = AVCOL_PRI_BT709; @@ -593,8 +612,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) default: st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; } +} /* Color Transfer Characteristics */ +if(avs->flags & AVISYNTH_FRAMEPROP_TRANSFER) { switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Transfer", 0, )) { case 1: st->codecpar->color_trc = AVCOL_TRC_BT709; @@ -650,8 +671,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) default: st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; } +} /* Matrix coefficients */ +if(avs->flags & AVISYNTH_FRAMEPROP_MATRIX) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == AVS_PROPTYPE_UNSET) { st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; } else { @@ -702,8 +725,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; } } +} /* Chroma Location */ +if(avs->flags & AVISYNTH_FRAMEPROP_CHROMA_LOCATION) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ChromaLocation") == AVS_PROPTYPE_UNSET) { st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } else { @@ -730,11 +755,14 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } +} /* Sample aspect ratio */ +if(avs->flags & AVISYNTH_FRAMEPROP_SAR) { sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); st->sample_aspect_ratio = (AVRational){
Re: [FFmpeg-devel] [PATCH 1/3 v2] avformat/avisynth: read _SARNum/_SARDen from frame properties
On 8/30/22 8:23 PM, Stephen Hutchinson wrote: Initialized to 1:1, but if the script sets these properties, it will be set to those instead (0:0 disables it, apparently). Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 3d9fa2be50..d978e6ec40 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -251,6 +251,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AVS_VideoFrame *frame; int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA +int sar_num = 1; +int sar_den = 1; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; @@ -728,6 +730,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } + +/* Sample aspect ratio */ +sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); +sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); +st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; + avs_library.avs_release_video_frame(frame); } else { st->codecpar->field_order = AV_FIELD_UNKNOWN; Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3 v2] avformat/avisynth: reindent
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 348 - 1 file changed, 174 insertions(+), 174 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 7bb2977383..b426ac343e 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -533,235 +533,235 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) /* Field order */ if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER) { -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { -st->codecpar->field_order = AV_FIELD_UNKNOWN; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } } -} /* Color Range */ if(avs->flags & AVISYNTH_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, )) { -case 0: -st->codecpar->color_range = AVCOL_RANGE_JPEG; -break; -case 1: -st->codecpar->color_range = AVCOL_RANGE_MPEG; -break; -default: +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, )) { +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; +} } } -} /* Color Primaries */ if(avs->flags & AVISYNTH_FRAMEPROP_PRIMARIES) { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { -case 1: -st->codecpar->color_primaries = AVCOL_PRI_BT709; -break; -case 2: -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; -break; -case 4: -st->codecpar->color_primaries = AVCOL_PRI_BT470M; -break; -case 5: -st->codecpar->color_primaries = AVCOL_PRI_BT470BG; -break; -case 6: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; -break; -case 7: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; -break; -case 8: -st->codecpar->color_primaries = AVCOL_PRI_FILM; -break; -case 9: -st->codecpar->color_primaries = AVCOL_PRI_BT2020; -break; -case 10: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE428; -break; -case 11: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; -break; -case 12: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; -break; -case 22: -st->codecpar->color_primaries = AVCOL_PRI_EBU3213; -break; -default: -st->codecpar->color_primaries = AVCOL_PRI_UNSPE
[FFmpeg-devel] [PATCH 2/3 v2] avformat/avisynth: implement avisynth_flags option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 52 ++ 1 file changed, 52 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index d978e6ec40..7bb2977383 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -21,6 +21,7 @@ #include "libavutil/attributes.h" #include "libavutil/internal.h" +#include "libavutil/opt.h" #include "libavcodec/internal.h" @@ -85,7 +86,18 @@ typedef struct AviSynthLibrary { #undef AVSC_DECLARE_FUNC } AviSynthLibrary; +typedef enum AviSynthFlags { +AVISYNTH_FRAMEPROP_FIELD_ORDER = (1 << 0), +AVISYNTH_FRAMEPROP_RANGE = (1 << 1), +AVISYNTH_FRAMEPROP_PRIMARIES = (1 << 2), +AVISYNTH_FRAMEPROP_TRANSFER = (1 << 3), +AVISYNTH_FRAMEPROP_MATRIX = (1 << 4), +AVISYNTH_FRAMEPROP_CHROMA_LOCATION = (1 << 5), +AVISYNTH_FRAMEPROP_SAR = (1 << 6), +} AviSynthFlags; + typedef struct AviSynthContext { +const AVClass *class; AVS_ScriptEnvironment *env; AVS_Clip *clip; const AVS_VideoInfo *vi; @@ -100,6 +112,8 @@ typedef struct AviSynthContext { int error; +uint32_t flags; + /* Linked list pointers. */ struct AviSynthContext *next; } AviSynthContext; @@ -518,6 +532,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ +if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; } else { @@ -535,8 +550,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->field_order = AV_FIELD_UNKNOWN; } } +} /* Color Range */ +if(avs->flags & AVISYNTH_FRAMEPROP_RANGE) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ColorRange") == AVS_PROPTYPE_UNSET) { st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; } else { @@ -551,8 +568,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->color_range = AVCOL_RANGE_UNSPECIFIED; } } +} /* Color Primaries */ +if(avs->flags & AVISYNTH_FRAMEPROP_PRIMARIES) { switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { case 1: st->codecpar->color_primaries = AVCOL_PRI_BT709; @@ -593,8 +612,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) default: st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; } +} /* Color Transfer Characteristics */ +if(avs->flags & AVISYNTH_FRAMEPROP_TRANSFER) { switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Transfer", 0, )) { case 1: st->codecpar->color_trc = AVCOL_TRC_BT709; @@ -650,8 +671,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) default: st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; } +} /* Matrix coefficients */ +if(avs->flags & AVISYNTH_FRAMEPROP_MATRIX) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == AVS_PROPTYPE_UNSET) { st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; } else { @@ -702,8 +725,10 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; } } +} /* Chroma Location */ +if(avs->flags & AVISYNTH_FRAMEPROP_CHROMA_LOCATION) { if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ChromaLocation") == AVS_PROPTYPE_UNSET) { st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } else { @@ -730,11 +755,14 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } +} /* Sample aspect ratio */ +if(avs->flags & AVISYNTH_FRAMEPROP_SAR) { sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; +} avs_library.avs_release_video_frame(frame); }
[FFmpeg-devel] [PATCH 1/3 v2] avformat/avisynth: read _SARNum/_SARDen from frame properties
Initialized to 1:1, but if the script sets these properties, it will be set to those instead (0:0 disables it, apparently). Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 3d9fa2be50..d978e6ec40 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -251,6 +251,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AVS_VideoFrame *frame; int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA +int sar_num = 1; +int sar_den = 1; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; @@ -728,6 +730,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } + +/* Sample aspect ratio */ +sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); +sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); +st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; + avs_library.avs_release_video_frame(frame); } else { st->codecpar->field_order = AV_FIELD_UNKNOWN; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/3 v2] avisynth: add user-selectable flags
The reading of frame properties from the script can now be toggled on and off per-property or as a whole, using the avisynth_flags option. The ability to read _SARNum/_SARDen properties has been added, but is kept off by default because it poses more of a risk of a user accidentally getting it wrong than the already existing properties do, which is what prompted adding the ability to switch frame property reading on and off. Stephen Hutchinson (3): avformat/avisynth: read _SARNum/_SARDen from frame properties avformat/avisynth: implement avisynth_flags option avformat/avisynth: reindent libavformat/avisynth.c | 386 - 1 file changed, 223 insertions(+), 163 deletions(-) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/9] avformat/avisynth: add read_frameprops option
On 8/30/22 7:17 PM, Andreas Rheinhardt wrote: { "avisynth_flags", "set flags related to reading frame properties from script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, "flags" }, This is wrong. It should be { "avisynth_flags", "set flags related to reading frame properties from script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVISYNTH_FRAMEPROP_FIELD_ORDER | AVISYNTH_FRAMEPROP_RANGE | AVISYNTH_FRAMEPROP_PRIMARIES | AVISYNTH_FRAMEPROP_TRANSFER | AVISYNTH_FRAMEPROP_MATRIX | AVISYNTH_FRAMEPROP_CHROMA_LOCATION}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM, "flags" } The default option should be removed. Users can then set the options via avisynth_flags=+sar-range or via avisynth_flags=matrix or however they wish. The AVISYNTH_FRAMEPROP_DEFAULT should also be removed (at least, it should not be part of the bitfield, but you can of course add a define (or an enum value) equivalent to the default value I used above and you can use that for the default value above); to know whether field order should be exported, you simply query via "if (avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER)". For this it is of course important that the default value is a combination of other bits of the bitfield and not a bit of its own. I don't know why I didn't think to use it directly in the avisynth_flags line. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/9] avformat/avisynth: add read_frameprops option
On 8/28/22 8:41 PM, Andreas Rheinhardt wrote: This will make frameprops a global on-off which overrides everything else even if some of the "else" stuff has been enabled explicitly. Worse yet, if you want to disable everything except exactly one field, you have to leave frameprops enabled and disable everything else explicitly. Why not use a bitfield (with AV_OPT_TYPE_FLAGS and AV_OPT_TYPE_CONST)? These properties certainly seem like a bitfield and the above would be easily achievable with it. How are flags supposed to be set to on by default? With av_dict_set or a different mechanism? Because the closest I was able to get¹, if(avs->flags & AVISYNTH_FRAMEPROP_FIELD_ORDER | AVISYNTH_FRAMEPROP_DEFAULT) { ends up correctly setting the flags that should be on by default, with the new sar flag able to be enabled or disabled, but the ones flagged as default refuse to be disabled now. ¹https://github.com/qyot27/FFmpeg/commit/6d3d6108145f9c7ac2dfcdaf09852b7472f6ca7f ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 9/9] avformat/avisynth: add read_frameprop_chroma_location option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 50 +++--- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 99173a8d51..4e7395c22b 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -109,6 +109,7 @@ typedef struct AviSynthContext { int frameprop_primaries; int frameprop_transfer; int frameprop_matrix; +int frameprop_chroma_location; int frameprop_sar; /* Linked list pointers. */ @@ -726,30 +727,32 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Chroma Location */ -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ChromaLocation") == AVS_PROPTYPE_UNSET) { -st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ChromaLocation", 0, )) { -case 0: -st->codecpar->chroma_location = AVCHROMA_LOC_LEFT; -break; -case 1: -st->codecpar->chroma_location = AVCHROMA_LOC_CENTER; -break; -case 2: -st->codecpar->chroma_location = AVCHROMA_LOC_TOPLEFT; -break; -case 3: -st->codecpar->chroma_location = AVCHROMA_LOC_TOP; -break; -case 4: -st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOMLEFT; -break; -case 5: -st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOM; -break; -default: +if(avs->frameprop_chroma_location) { +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_ChromaLocation") == AVS_PROPTYPE_UNSET) { st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ChromaLocation", 0, )) { +case 0: +st->codecpar->chroma_location = AVCHROMA_LOC_LEFT; +break; +case 1: +st->codecpar->chroma_location = AVCHROMA_LOC_CENTER; +break; +case 2: +st->codecpar->chroma_location = AVCHROMA_LOC_TOPLEFT; +break; +case 3: +st->codecpar->chroma_location = AVCHROMA_LOC_TOP; +break; +case 4: +st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOMLEFT; +break; +case 5: +st->codecpar->chroma_location = AVCHROMA_LOC_BOTTOM; +break; +default: +st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; +} } } @@ -1172,6 +1175,7 @@ static const AVOption avisynth_options[] = { { "read_frameprop_primaries", "Read color primaries from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_primaries), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "read_frameprop_transfer", "Read color transfer characteristics from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_transfer), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "read_frameprop_matrix", "Read matrix coefficients from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_matrix), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, +{ "read_frameprop_chroma_location", "Read chroma location from script's frame properties (AviSynth+ v3.7.1+).", OFFSET(frameprop_chroma_location), 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 }, }; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 8/9] avformat/avisynth: add read_frameprop_matrix option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 98 ++ 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index ff4435758e..99173a8d51 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -108,6 +108,7 @@ typedef struct AviSynthContext { int frameprop_range; int frameprop_primaries; int frameprop_transfer; +int frameprop_matrix; int frameprop_sar; /* Linked list pointers. */ @@ -671,54 +672,56 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Matrix coefficients */ -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == AVS_PROPTYPE_UNSET) { -st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Matrix", 0, )) { -case 0: -st->codecpar->color_space = AVCOL_SPC_RGB; -break; -case 1: -st->codecpar->color_space = AVCOL_SPC_BT709; -break; -case 2: -st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; -break; -case 4: -st->codecpar->color_space = AVCOL_SPC_FCC; -break; -case 5: -st->codecpar->color_space = AVCOL_SPC_BT470BG; -break; -case 6: -st->codecpar->color_space = AVCOL_SPC_SMPTE170M; -break; -case 7: -st->codecpar->color_space = AVCOL_SPC_SMPTE240M; -break; -case 8: -st->codecpar->color_space = AVCOL_SPC_YCGCO; -break; -case 9: -st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; -break; -case 10: -st->codecpar->color_space = AVCOL_SPC_BT2020_CL; -break; -case 11: -st->codecpar->color_space = AVCOL_SPC_SMPTE2085; -break; -case 12: -st->codecpar->color_space = AVCOL_SPC_CHROMA_DERIVED_NCL; -break; -case 13: -st->codecpar->color_space = AVCOL_SPC_CHROMA_DERIVED_CL; -break; -case 14: -st->codecpar->color_space = AVCOL_SPC_ICTCP; -break; -default: +if(avs->frameprop_matrix) { +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_Matrix") == AVS_PROPTYPE_UNSET) { st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Matrix", 0, )) { +case 0: +st->codecpar->color_space = AVCOL_SPC_RGB; +break; +case 1: +st->codecpar->color_space = AVCOL_SPC_BT709; +break; +case 2: +st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; +break; +case 4: +st->codecpar->color_space = AVCOL_SPC_FCC; +break; +case 5: +st->codecpar->color_space = AVCOL_SPC_BT470BG; +break; +case 6: +st->codecpar->color_space = AVCOL_SPC_SMPTE170M; +break; +case 7: +st->codecpar->color_space = AVCOL_SPC_SMPTE240M; +break; +case 8: +st->codecpar->color_space = AVCOL_SPC_YCGCO; +break; +case 9: +st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; +break; +case 10: +st->codecpar->color_space = AVCOL_SPC_BT2020_CL; +break; +case 11: +st->codecpar->color_space = AVCOL_SPC_SMPTE2085; +break; +case 12: +st->codecpar->color_space = AVCOL_SPC_CHROMA_DERIVED_NCL; +break; +case 13: +st->codecpar->color_s
[FFmpeg-devel] [PATCH 7/9] avformat/avisynth: add read_frameprop_transfer option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 112 + 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 945ce0e245..ff4435758e 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -107,6 +107,7 @@ typedef struct AviSynthContext { int frameprop_field_order; int frameprop_range; int frameprop_primaries; +int frameprop_transfer; int frameprop_sar; /* Linked list pointers. */ @@ -611,60 +612,62 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Color Transfer Characteristics */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Transfer", 0, )) { -case 1: -st->codecpar->color_trc = AVCOL_TRC_BT709; -break; -case 2: -st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; -break; -case 4: -st->codecpar->color_trc = AVCOL_TRC_GAMMA22; -break; -case 5: -st->codecpar->color_trc = AVCOL_TRC_GAMMA28; -break; -case 6: -st->codecpar->color_trc = AVCOL_TRC_SMPTE170M; -break; -case 7: -st->codecpar->color_trc = AVCOL_TRC_SMPTE240M; -break; -case 8: -st->codecpar->color_trc = AVCOL_TRC_LINEAR; -break; -case 9: -st->codecpar->color_trc = AVCOL_TRC_LOG; -break; -case 10: -st->codecpar->color_trc = AVCOL_TRC_LOG_SQRT; -break; -case 11: -st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_4; -break; -case 12: -st->codecpar->color_trc = AVCOL_TRC_BT1361_ECG; -break; -case 13: -st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_1; -break; -case 14: -st->codecpar->color_trc = AVCOL_TRC_BT2020_10; -break; -case 15: -st->codecpar->color_trc = AVCOL_TRC_BT2020_12; -break; -case 16: -st->codecpar->color_trc = AVCOL_TRC_SMPTE2084; -break; -case 17: -st->codecpar->color_trc = AVCOL_TRC_SMPTE428; -break; -case 18: -st->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; -break; -default: -st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +if(avs->frameprop_transfer) { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Transfer", 0, )) { +case 1: +st->codecpar->color_trc = AVCOL_TRC_BT709; +break; +case 2: +st->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +break; +case 4: +st->codecpar->color_trc = AVCOL_TRC_GAMMA22; +break; +case 5: +st->codecpar->color_trc = AVCOL_TRC_GAMMA28; +break; +case 6: +st->codecpar->color_trc = AVCOL_TRC_SMPTE170M; +break; +case 7: +st->codecpar->color_trc = AVCOL_TRC_SMPTE240M; +break; +case 8: +st->codecpar->color_trc = AVCOL_TRC_LINEAR; +break; +case 9: +st->codecpar->color_trc = AVCOL_TRC_LOG; +break; +case 10: +st->codecpar->color_trc = AVCOL_TRC_LOG_SQRT; +break; +case 11: +st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_4; +break; +case 12: +st->codecpar->color_trc = AVCOL_TRC_BT1361_ECG; +break; +case 13: +st->codecpar->color_trc = AVCOL_TRC_IEC61966_2_1; +break; +case 14: +st->codecpar->color_trc = AVCOL_TRC_BT2020_10; +break; +case 15: +st->codecpar->color_trc = AVCOL_TRC_BT2020_12; +break; +case 16: +st->codecpar->color_trc = AVCOL_TRC_SMPTE2084; +break; +case 17: +st->codecpar->c
[FFmpeg-devel] [PATCH 6/9] avformat/avisynth: add read_frameprop_primaries option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 82 ++ 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 65d8448e89..945ce0e245 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -106,6 +106,7 @@ typedef struct AviSynthContext { int frameprops; int frameprop_field_order; int frameprop_range; +int frameprop_primaries; int frameprop_sar; /* Linked list pointers. */ @@ -566,45 +567,47 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Color Primaries */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { -case 1: -st->codecpar->color_primaries = AVCOL_PRI_BT709; -break; -case 2: -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; -break; -case 4: -st->codecpar->color_primaries = AVCOL_PRI_BT470M; -break; -case 5: -st->codecpar->color_primaries = AVCOL_PRI_BT470BG; -break; -case 6: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; -break; -case 7: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; -break; -case 8: -st->codecpar->color_primaries = AVCOL_PRI_FILM; -break; -case 9: -st->codecpar->color_primaries = AVCOL_PRI_BT2020; -break; -case 10: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE428; -break; -case 11: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; -break; -case 12: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; -break; -case 22: -st->codecpar->color_primaries = AVCOL_PRI_EBU3213; -break; -default: -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; +if(avs->frameprop_primaries) { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { +case 1: +st->codecpar->color_primaries = AVCOL_PRI_BT709; +break; +case 2: +st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; +break; +case 4: +st->codecpar->color_primaries = AVCOL_PRI_BT470M; +break; +case 5: +st->codecpar->color_primaries = AVCOL_PRI_BT470BG; +break; +case 6: +st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; +break; +case 7: +st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; +break; +case 8: +st->codecpar->color_primaries = AVCOL_PRI_FILM; +break; +case 9: +st->codecpar->color_primaries = AVCOL_PRI_BT2020; +break; +case 10: +st->codecpar->color_primaries = AVCOL_PRI_SMPTE428; +break; +case 11: +st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; +break; +case 12: +st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; +break; +case 22: +st->codecpar->color_primaries = AVCOL_PRI_EBU3213; +break; +default: +st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; +} } /* Color Transfer Characteristics */ @@ -1160,6 +1163,7 @@ 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_prim
[FFmpeg-devel] [PATCH 5/9] avformat/avisynth: add read_frameprop_range option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index c76b50421c..65d8448e89 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -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, )) { -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, )) { +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 }, }; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/9] avformat/avisynth: add read_frameprop_field_order option
Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 5d726d70a5..c76b50421c 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -104,6 +104,7 @@ typedef struct AviSynthContext { /* (de)activate reading frame properties */ int frameprops; +int frameprop_field_order; int frameprop_sar; /* Linked list pointers. */ @@ -525,21 +526,23 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) if(avs->frameprops) { /* Field order */ -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { -st->codecpar->field_order = AV_FIELD_UNKNOWN; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs->frameprop_field_order) { +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } } @@ -1152,6 +1155,7 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index, #define OFFSET(x) offsetof(AviSynthContext, x) 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_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 }, }; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/9] avformat/avisynth: add read_frameprops option
Allows turning the reading of frame properties entirely on and off. Defaults to reading frame properties. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 355 + 1 file changed, 179 insertions(+), 176 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index d503c7ed40..5d726d70a5 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -103,6 +103,7 @@ typedef struct AviSynthContext { int error; /* (de)activate reading frame properties */ +int frameprops; int frameprop_sar; /* Linked list pointers. */ @@ -522,227 +523,228 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) frame = avs_library.avs_get_frame(avs->clip, 0); avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); -/* Field order */ -if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { -st->codecpar->field_order = AV_FIELD_UNKNOWN; -} else { -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs->frameprops) { +/* Field order */ +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } -} -/* 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, )) { -case 0: -st->codecpar->color_range = AVCOL_RANGE_JPEG; -break; -case 1: -st->codecpar->color_range = AVCOL_RANGE_MPEG; -break; -default: +/* 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, )) { +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; +} } -} -/* Color Primaries */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Primaries", 0, )) { -case 1: -st->codecpar->color_primaries = AVCOL_PRI_BT709; -break; -case 2: -st->codecpar->color_primaries = AVCOL_PRI_UNSPECIFIED; -break; -case 4: -st->codecpar->color_primaries = AVCOL_PRI_BT470M; -break; -case 5: -st->codecpar->color_primaries = AVCOL_PRI_BT470BG; -break; -case 6: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; -break; -case 7: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; -break; -case 8: -st->codecpar->color_primaries = AVCOL_PRI_FILM; -break; -case 9: -st->codecpar->color_primaries = AVCOL_PRI_BT2020; -break; -case 10: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE428; -break; -case 11: -st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; -
[FFmpeg-devel] [PATCH 2/9] avformat/avisynth: add read_frameprop_sar option
Because SAR is much more likely to be negatively affected by operations made in-script, given that resizing is probably far more common than the sort of color manipulation involved in most of the other frame properties, the safest option is to disable reading it by default, allowing users to opt in. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 27 --- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index d978e6ec40..d503c7ed40 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -21,6 +21,7 @@ #include "libavutil/attributes.h" #include "libavutil/internal.h" +#include "libavutil/opt.h" #include "libavcodec/internal.h" @@ -86,6 +87,7 @@ typedef struct AviSynthLibrary { } AviSynthLibrary; typedef struct AviSynthContext { +const AVClass *class; AVS_ScriptEnvironment *env; AVS_Clip *clip; const AVS_VideoInfo *vi; @@ -100,6 +102,9 @@ typedef struct AviSynthContext { int error; +/* (de)activate reading frame properties */ +int frameprop_sar; + /* Linked list pointers. */ struct AviSynthContext *next; } AviSynthContext; @@ -732,9 +737,11 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Sample aspect ratio */ -sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); -sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); -st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; +if (avs->frameprop_sar) { +sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); +sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); +st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; +} avs_library.avs_release_video_frame(frame); } else { @@ -1140,6 +1147,19 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index, return 0; } +#define OFFSET(x) offsetof(AviSynthContext, x) +static const AVOption avisynth_options[] = { +{ "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 }, +}; + +static const AVClass avisynth_demuxer_class = { +.class_name = "AviSynth demuxer", +.item_name = av_default_item_name, +.option = avisynth_options, +.version= LIBAVUTIL_VERSION_INT, +}; + const AVInputFormat ff_avisynth_demuxer = { .name = "avisynth", .long_name = NULL_IF_CONFIG_SMALL("AviSynth script"), @@ -1149,4 +1169,5 @@ const AVInputFormat ff_avisynth_demuxer = { .read_close = avisynth_read_close, .read_seek = avisynth_read_seek, .extensions = "avs", +.priv_class = _demuxer_class, }; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/9] avformat/avisynth: read _SARNum/_SARDen from frame properties
Initialized to 1:1, but if the script sets these properties, it will be set to those instead (0:0 disables it, apparently). Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 3d9fa2be50..d978e6ec40 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -251,6 +251,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AVS_VideoFrame *frame; int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA +int sar_num = 1; +int sar_den = 1; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; @@ -728,6 +730,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } + +/* Sample aspect ratio */ +sar_num = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARNum", 0, ); +sar_den = avs_library.avs_prop_get_int(avs->env, avsmap, "_SARDen", 0, ); +st->sample_aspect_ratio = (AVRational){ sar_num, sar_den }; + avs_library.avs_release_video_frame(frame); } else { st->codecpar->field_order = AV_FIELD_UNKNOWN; -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/9] avisynth: add user options
The introduction of reading _SARNum/Den values spurred the idea of making sure that users can turn the frameprop value reading ability on and off. Resizing is a much more common activity in AviSynth scripts than the kind of broad color work that would potentially severely impact the usage of the color-related frameprops. Since the source filter sets the SAR values, but then it would be quite possible for a user to manipulate the resolution without updating the prop values for _SARNum and _SARDen, it would become extremely easy to get it wrong. So reading _SARNum/_SARDen is *possible*, but requires user opt-in with the -read_frameprop_sar boolean option. And that then lead to fleshing out the others into their own options, and a mass frameprop on/off setting. Stephen Hutchinson (9): avformat/avisynth: read _SARNum/_SARDen from frame properties avformat/avisynth: add read_frameprop_sar option avformat/avisynth: add read_frameprops option avformat/avisynth: add read_frameprop_field_order option avformat/avisynth: add read_frameprop_range option avformat/avisynth: add read_frameprop_primaries option avformat/avisynth: add read_frameprop_transfer option avformat/avisynth: add read_frameprop_matrix option avformat/avisynth: add read_frameprop_chroma_location option libavformat/avisynth.c | 462 +++-- 1 file changed, 259 insertions(+), 203 deletions(-) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avisynth: use AviSynth+'s frame properties to set various fields
On 8/24/22 1:04 PM, Steinar Apalnes wrote: tir. 8. feb. 2022 kl. 12:03 skrev Stephen Hutchinson : * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson ... Hi Stephen, Would it be possible to add support for "_SARum" and "_SARDen" so that ffmpeg could also recognize the sample aspect ratio in avs scripts? I'm a bit hesitant to do so, namely because the _SARNum/Den properties are much more likely to need to have been changed due to operations in-script, and unless the user is studious about updating those properties after even just a basic resizing operation, then _SARNum/Den will still be set to the original values populated by the source filter, and will be wrong, leading to encodes ending up wrong and potentially bug reports to Trac which aren't actually the fault of the demuxer. This is partially coming from the fact that even the color-based properties that were already added have experienced some level of backlash because of the requirement for users to ensure the properties are correctly updated if they've done any changes to those factors (as best as I'm aware, the filters in the AviSynth+ core still only pass through the existing properties, but they don't update them if they pertain to that property's functionality; I believe some external filters do update them, however). I would be fairly confident in betting that users resizing video is far more common than them doing color correction ops that would require updating the frameprops FFmpeg can currently read. One mitigation to that, IMO, would be to flag that as an experimental feature, making it to where FFmpeg won't read _SARNum/Den unless the -strict option has been used. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avformat/avisynth: add missing avs_release_video_frame
On 8/7/22 9:25 PM, Stephen Hutchinson wrote: The AviSynth C API requires using avs_release_video_frame whenever avs_get_frame has been used, but the recent addition of frameprop reading to the demuxer was missing this in avisynth_create_stream_video. --- libavformat/avisynth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index a97d12b6b6..98b4d68a57 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -728,6 +728,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } +avs_library.avs_release_video_frame(frame); } else { st->codecpar->field_order = AV_FIELD_UNKNOWN; /* AviSynth works with frame-based video, detecting field order can Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avformat/avisynth: cosmetics after nb_channels change
--- libavformat/avisynth.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 5605fbefc4..3d9fa2be50 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -751,10 +751,10 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) { AviSynthContext *avs = s->priv_data; -st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->sample_rate = avs->vi->audio_samples_per_second; -st->codecpar->ch_layout.nb_channels= avs->vi->nchannels; -st->duration = avs->vi->num_audio_samples; +st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; +st->codecpar->sample_rate = avs->vi->audio_samples_per_second; +st->codecpar->ch_layout.nb_channels = avs->vi->nchannels; +st->duration= avs->vi->num_audio_samples; avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second); switch (avs->vi->sample_type) { -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avformat/avisynth: use ch_layout.nb_channels for channel count
Fixes deprecation warning --- libavformat/avisynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 98b4d68a57..5605fbefc4 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -753,7 +753,7 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->sample_rate = avs->vi->audio_samples_per_second; -st->codecpar->channels= avs->vi->nchannels; +st->codecpar->ch_layout.nb_channels= avs->vi->nchannels; st->duration = avs->vi->num_audio_samples; avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second); -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avformat/avisynth: add missing avs_release_video_frame
The AviSynth C API requires using avs_release_video_frame whenever avs_get_frame has been used, but the recent addition of frameprop reading to the demuxer was missing this in avisynth_create_stream_video. --- libavformat/avisynth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index a97d12b6b6..98b4d68a57 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -728,6 +728,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->chroma_location = AVCHROMA_LOC_UNSPECIFIED; } } +avs_library.avs_release_video_frame(frame); } else { st->codecpar->field_order = AV_FIELD_UNKNOWN; /* AviSynth works with frame-based video, detecting field order can -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/3] avisynth: miscellaneous fixes
Stephen Hutchinson (3): avformat/avisynth: add missing avs_release_video_frame avformat/avisynth: use ch_layout.nb_channels for channel count avformat/avisynth: cosmetics after nb_channels change libavformat/avisynth.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 4/5] libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()
On 6/13/22 2:55 PM, Hendrik Leppkes wrote: This seems unrelated to this patch, which is about removing the MAX_PATH limit. The code previously converted UTF-8 to ANSI, and still does so now, just without the MAX_PATH limit. Further improvements tangential to this topic can, and should, be applied independently, and not hold up this patch in discussion-hell for longer than necessary. Agreed. As is stands, if a user finds that they need to open files that use non-ANSI characters in their filenames, they can always go into their Language settings and turn on UTF-8 for worldwide language support, which was just as true before the MAX_PATH-related patches. Honestly, Microsoft just needs to stop delaying it and make UTF-8 the default, and then we won't have this problem anymore. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v13 2/4] libavformat/avisynth.c: Remove MAX_PATH limit
On 6/11/22 1:01 PM, nil-admir...@mailo.com wrote: Why not use the AviSynth mechanism that allows to supply a UTF-8 string? https://github.com/AviSynth/AviSynthPlus/blob/c377916aa4146d2f4386852d91dc177d49103c16/avs_core/core/parser/script.cpp#L477-L481 Was not aware such a mechanism exists. Commit dates back to 10 April 2017, first release supporting it is, apparently, Avisynth+ r2487-MT: https://github.com/pinterf/AviSynthPlus/releases/tag/r2489-MT. A remark in https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/avisynth.c#L844 says: /* On Windows, FFmpeg supports AviSynth interface version 6 or higher. * This includes AviSynth 2.6 RC1 or higher, and AviSynth+ r1718 or higher, * and excludes 2.5 and the 2.6 alphas. */ Support for plain AviSynth will have to be dropped. Presumably, the original manifest idea, parsed down to only using it to force FFmpeg into UTF-8, would be sufficient for this, right? As long as AviSynth inherits that from FFmpeg, UTF-8 strings would be pervasive and both A) the utf8 parameter would not need to be used and B) 2.6 would work just fine with it, transparently. The Windows API does have a SetConsoleCP function. If that accomplishes the same effect as the manifest idea, that would be simpler, but it probably would need to be located somewhere *other* than the AviSynth demuxer. And while it might work for the fftools themselves, does it also work for usage of the libraries directly in applications that may not be console apps? Barring that, if/else checks to ensure that A) IsWindowsVersionOrGreater is at least 1903 A1) If yes, go to B A2) If no, use the existing logic B) If yes, GetACP to check that it's UTF8 B1) If yes, the Import call stays the same as it is now, no utf8 parameter B2) If no, that's where things get complicated: C1) Use the no result to tell it to then force UTF-8 mode with SetConsoleCP, if that actually works for what we need it to do. Then don't use the utf8 parameter. C2) Use avs_get_version to detect an incompatible version of AviSynth and gracefully exit with a message about upgrading to a supported version of AviSynth+, before then using the utf8 parameter for real. C3) Use avs_get_version, but if it's not a new enough version, just fall back to the logic that exists now, where 2.6 may or may not work just because the system may or may not be already set to UTF-8. C2 should really be considered a last resort IMO, because it's an artificial limit and doesn't actually have anything to do with the AviSynth API. The reason is that the utf8 parameter being discussed here is not part of the AviSynth API, it's an option handed to one of the script-level functions that avs_invoke (which is the actual API call there) is using. On the other hand, configure checks for https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/avisynth.c#L844 die "ERROR: AviSynth+ header version must be >= 3.7.1" so probably plain AviSynth and AviSynth+ below r2489-MT are already unsupported. The header version check there isn't because of old versions of AviSynth(+) being unsupported (as far as the demuxer is concerned, anyway). 3.7.1 is still API compatible with 2.6 in all the functions the demuxer uses that are shared between them. The additional Plus-specific functionality is enabled with runtime checks, so if you don't use the newer header, it will fail to build, but you can run 2.6 without problems even when using the newer header to compile the demuxer. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi
Thus far I've avoided jumping into this because I genuinely do not care about Windows' code page shenanigans or what-all, but because this seems to be zeroing in on one thing in particular... On 4/25/22 5:03 AM, nil-admir...@mailo.com wrote: If you were to look at the code, you would've seen that charset conversion was already there. AviSynth is not Unicode-aware, it expects ANSI strings. Inline charset conversion was replaced by a library call, which, again, was already there, only slightly extended. > Which is necessary for compatibility with AviSynth, It has nothing to do with compatibility with AviSynth, because AviSynth just uses the code page the system is set on. What 'it's not Unicode-aware' means is that it doesn't jump into convoluted conversions to UTF-16, because that's what Windows meant by 'Unicode' for 20+ years, and nobody from either classic AviSynth or Plus wanted to do that, because it's an absolute mess and now that Plus is cross-platform, utterly pointless on every other OS, because they all use UTF-8 and have for at least 15 years, if not [much] longer. Some third-party applications that utilize AviSynth have decided they want to bend over backwards to make sure their users don't have to freak themselves out by telling Windows to use UTF-8 as the system code page, so they'll do an end-run around it and use these sorts of manifests to force the program's locale to UTF-8, AppLocale style. But that's not a compatibility issue with AviSynth. As soon as Microsoft actually makes UTF-8 the default code page going forward, that issue will poof out of existence, as if by magic. It already does if you toggle it on in the system settings. Nothing special was required regarding locale support when Linux, macOS, BSD, and Haiku support landed. All of those use UTF-8 and AviSynth+ works with it transparently. And it works with UTF-8 on Windows transparently if you've gone into the Region Settings and actually enabled it. Even AviSynth 2.6 is cool with it, as this screenshot from *two years ago* illustrates: https://i.imgur.com/1p5osrE.jpg ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/avisynth: fix fallbacks for four frameprops
On 2/27/22 3:03 PM, Stephen Hutchinson wrote: If _FieldBased, _Matrix, _ColorRange, or _ChromaLocation haven't been set, that absence would be interpreted as 0, leading to those being set to case 0 instead of default. There is no case 0 for _Primaries and _Transfer, so those were correctly falling back to the default case. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 184 ++--- 1 file changed, 101 insertions(+), 83 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 318588ff52..8ba2bdead2 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -78,6 +78,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_is_planar_rgba); AVSC_DECLARE_FUNC(avs_get_frame_props_ro); AVSC_DECLARE_FUNC(avs_prop_get_int); +AVSC_DECLARE_FUNC(avs_prop_get_type); AVSC_DECLARE_FUNC(avs_get_env_property); #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -158,6 +159,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_is_planar_rgba, 1); LOAD_AVS_FUNC(avs_get_frame_props_ro, 1); LOAD_AVS_FUNC(avs_prop_get_int, 1); +LOAD_AVS_FUNC(avs_prop_get_type, 1); LOAD_AVS_FUNC(avs_get_env_property, 1); #undef LOAD_AVS_FUNC @@ -511,30 +513,38 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } /* Color Range */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, )) { -case 0: -st->codecpar->color_range = AVCOL_RANGE_JPEG; -break; -case 1: -st->codecpar->color_range = AVCOL_RANGE_MPEG; -break; -default: +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, )) { +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; +} } /* Color Primaries */ @@ -637,75 +647,83 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Matrix coefficients */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Matrix", 0, )) { -case 0: -st->codecpar->color_space = AVCOL_SPC_RGB; -break; -case 1: -st->codecpar->color_space = AVCOL_SPC_BT709; -break; -case 2: -st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; -break; -case 4: -st->codecpar->color_space = AVCOL_SPC_FCC; -break; -case 5: -st->codecpar->color_space = AVCOL_SPC_BT470BG; -break; -case 6: -st->codecpar->color_space = AVCOL_SPC_SMPTE170M; -break; -case 7: -st->codecpar->color_space = AVCOL_SPC_SMPTE240M; -break; -case 8: -st->codecpar->color_space = AVCOL_SPC_YCGCO; -break; -case 9: -st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; -break; -case 10: -st->codecpar->color_space = AVCOL_SPC_BT2020_CL; -
[FFmpeg-devel] [PATCH] avformat/avisynth: fix fallbacks for four frameprops
If _FieldBased, _Matrix, _ColorRange, or _ChromaLocation haven't been set, that absence would be interpreted as 0, leading to those being set to case 0 instead of default. There is no case 0 for _Primaries and _Transfer, so those were correctly falling back to the default case. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 184 ++--- 1 file changed, 101 insertions(+), 83 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 318588ff52..8ba2bdead2 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -78,6 +78,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_is_planar_rgba); AVSC_DECLARE_FUNC(avs_get_frame_props_ro); AVSC_DECLARE_FUNC(avs_prop_get_int); +AVSC_DECLARE_FUNC(avs_prop_get_type); AVSC_DECLARE_FUNC(avs_get_env_property); #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -158,6 +159,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_is_planar_rgba, 1); LOAD_AVS_FUNC(avs_get_frame_props_ro, 1); LOAD_AVS_FUNC(avs_prop_get_int, 1); +LOAD_AVS_FUNC(avs_prop_get_type, 1); LOAD_AVS_FUNC(avs_get_env_property, 1); #undef LOAD_AVS_FUNC @@ -511,30 +513,38 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { -case 0: -st->codecpar->field_order = AV_FIELD_PROGRESSIVE; -break; -case 1: -st->codecpar->field_order = AV_FIELD_BB; -break; -case 2: -st->codecpar->field_order = AV_FIELD_TT; -break; -default: +if(avs_library.avs_prop_get_type(avs->env, avsmap, "_FieldBased") == AVS_PROPTYPE_UNSET) { st->codecpar->field_order = AV_FIELD_UNKNOWN; +} else { +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} } /* Color Range */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, )) { -case 0: -st->codecpar->color_range = AVCOL_RANGE_JPEG; -break; -case 1: -st->codecpar->color_range = AVCOL_RANGE_MPEG; -break; -default: +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, )) { +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; +} } /* Color Primaries */ @@ -637,75 +647,83 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } /* Matrix coefficients */ -switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_Matrix", 0, )) { -case 0: -st->codecpar->color_space = AVCOL_SPC_RGB; -break; -case 1: -st->codecpar->color_space = AVCOL_SPC_BT709; -break; -case 2: -st->codecpar->color_space = AVCOL_SPC_UNSPECIFIED; -break; -case 4: -st->codecpar->color_space = AVCOL_SPC_FCC; -break; -case 5: -st->codecpar->color_space = AVCOL_SPC_BT470BG; -break; -case 6: -st->codecpar->color_space = AVCOL_SPC_SMPTE170M; -break; -case 7: -st->codecpar->color_space = AVCOL_SPC_SMPTE240M; -break; -case 8: -st->codecpar->color_space = AVCOL_SPC_YCGCO; -break; -case 9: -st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; -break; -case 10: -st->codecpar->color_space = AVCOL_SPC_BT2020_CL; -break; -case 11: -st->codecpar->color_
Re: [FFmpeg-devel] [PATCH] avformat/avisynth: remove framedata variable
On 2/19/22 7:09 PM, Stephen Hutchinson wrote: It's just a simple index. Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 03489f180f..318588ff52 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -244,7 +244,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AviSynthContext *avs = s->priv_data; const AVS_Map *avsmap; AVS_VideoFrame *frame; -int framedata, error; +int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -507,7 +507,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) if (avs_library.avs_get_version(avs->clip) >= 9) { -frame = avs_library.avs_get_frame(avs->clip, framedata); +frame = avs_library.avs_get_frame(avs->clip, 0); avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/avisynth: remove unused variable 'frameprop'
On 2/19/22 4:41 PM, Stephen Hutchinson wrote: Since the check got simplified and stdbool was no longer necessary to include, neither is that variable. Silences a warning. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2bd0c6949b..03489f180f 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -245,7 +245,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) const AVS_Map *avsmap; AVS_VideoFrame *frame; int framedata, error; -bool frameprop; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/avisynth: remove framedata variable
It's just a simple index. Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 03489f180f..318588ff52 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -244,7 +244,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AviSynthContext *avs = s->priv_data; const AVS_Map *avsmap; AVS_VideoFrame *frame; -int framedata, error; +int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -507,7 +507,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) if (avs_library.avs_get_version(avs->clip) >= 9) { -frame = avs_library.avs_get_frame(avs->clip, framedata); +frame = avs_library.avs_get_frame(avs->clip, 0); avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); /* Field order */ -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avformat/avisynth: make sure framedata variable is initialized
On 2/19/22 5:45 PM, Andreas Rheinhardt wrote: Stephen Hutchinson: Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 03489f180f..cfb7b2a783 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -244,7 +244,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AviSynthContext *avs = s->priv_data; const AVS_Map *avsmap; AVS_VideoFrame *frame; -int framedata, error; +int framedata = 0; +int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; Looking at the naming in https://github.com/AviSynth/AviSynthPlus/blob/master/avs_core/core/avisynth_c.cpp#L828 makes me believe that this variable is actually a frame number. If so, it is misnamed and this could be fixed easily by just removing this variable. Am I right? It seems so. I think I was just going off of the way avs_get_frame was used in avisynth_read_packet_video (as I was also trying to see whether some of the other properties* should be read per-frame from within read_packet_video), but there's no need to do that with the simpler ones in avisynth_create_stream_video. *related to timestamps or to HDR mastering information, but I'm thinking that's going to require adding an entire function to the demuxer to be able to set side metadata (at least for the HDR stuff, anyway). ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avisynth: use AviSynth+'s frame properties to set various fields
On 2/19/22 3:39 PM, Andreas Rheinhardt wrote: +if (frameprop = true) { + +frame = avs_library.avs_get_frame(avs->clip, framedata); framedata is completely uninitialized here. I presume it should be zero (for the first frame)? (This is Coverity issue 1500290.) I don't remember why I left that uninitialized (there's a vague memory of something, almost certainly unrelated since it works now, but it was months ago at this point). Patch sent. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/avisynth: make sure framedata variable is initialized
Addresses Coverity issue 1500290 Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 03489f180f..cfb7b2a783 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -244,7 +244,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) AviSynthContext *avs = s->priv_data; const AVS_Map *avsmap; AVS_VideoFrame *frame; -int framedata, error; +int framedata = 0; +int error; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avformat/avisynth: remove unused variable 'frameprop'
Since the check got simplified and stdbool was no longer necessary to include, neither is that variable. Silences a warning. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2bd0c6949b..03489f180f 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -245,7 +245,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) const AVS_Map *avsmap; AVS_VideoFrame *frame; int framedata, error; -bool frameprop; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/avisynth: fix frameprop version check
On 2/16/22 7:49 PM, Stephen Hutchinson wrote: Trying to be clever about determining between interface version 8 and 8.1 ended up with pre-8.1 versions of AviSynth+ segfaulting. The amount of time between interface version 8.1 and 9 is small, so just restrict the frameprop awareness to version 9 and call it a day. --- libavformat/avisynth.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8bc39869a3..b345f5efe2 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -502,24 +502,13 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) /* Read AviSynth+'s frame properties to set additional info. * * Due to a bug preventing the C interface from accessing frame - * properties in earlier versions of interface version 8, only - * enable this if we detect version 8.1 at the minimum. */ + * properties in earlier versions of interface version 8, and + * previous attempts at being clever resulting in pre-8 versions + * of AviSynth+ segfaulting, only enable this if we detect + * version 9 at the minimum. Technically, 8.1 works, but the time + * distance between 8.1 and 9 is very small, so just restrict it to 9. */ -if (!avs_library.avs_get_env_property) { -av_log(s, AV_LOG_TRACE, "%s\n", - "avs_get_env_property does not exist in AviSynth library; frame properties won't be checked."); -frameprop = false; -} else { -if (avs_library.avs_get_env_property(avs->env, AVS_AEP_INTERFACE_BUGFIX)) { -av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.1 or higher, reading frame properties."); -frameprop = true; -} else { -av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.0, need 8.1+ to read frame properties."); -frameprop = false; -} -} - -if (frameprop = true) { +if (avs_library.avs_get_version(avs->clip) >= 9) { frame = avs_library.avs_get_frame(avs->clip, framedata); avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/17/22 5:19 PM, Helmut K. C. Tessarek wrote: It's definitely not working, since I don't ship any dylibs. I always thought 3.5.1 li9nked a static lib, but I checked. It does not. Even if I wanted to I couldn't ship any dylibs, since I can't build AviSynthPlus on macOS 10.14. It's really the same situation as Windows: users get the FFmpeg build from whoever builds it with AviSynth support enabled, and if they want to use that functionality, they can install the official release of AviSynth+ that we provide upstream. The .dll situation on Windows is one of several reasons for the use of dlopen, as well. That's why with 3.7.0 I started providing macOS builds in the releases in both installer .pkg and -filesonly tarball form, since I know some people prefer doing it that way. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/16/22 1:25 PM, Helmut K. C. Tessarek wrote: On 2022-02-16 02:37, Stephen Hutchinson wrote: There is another option, basically what Gyan suggested earlier: grab the release build of 3.7.1, fetch the extra headers from the Github repo, then copy either all the contents of the tarball's /usr directory into the system /usr directory (or wherever your working ${prefix} is), or just the 'avisynth' directory into ${prefix}/include. Then try FFmpeg again. This does not work. I compile static binaries. The filesonly tarball only has dylibs. As I mentioned nefore:. 3 days ago everything worked fine. Now the ffmpeg builds are broken and I can no longer compile ffmpeg. Is there any chancf you can add something to make it work again with 3.5.1 which compiled withtout issues on macOS 10.14 and which I've been using since it was released. FFmpeg dlopens AviSynth, it only needs the headers and doesn't try to link it. It has never linked to AviSynth. If 3.5.1 is working (and by that I assume you mean you're opening a Version() script in FFplay and it's showing you the video clip with the version and copyright information), then libavisynth.dylib is somewhere on your DYLD_LIBRARY_PATH, and you could just as easily set DYLD_LIBRARY_PATH to the /usr/lib directory in the -filesonly package and that Version() script will start reporting 3.7.1 instead. After fetching the extra headers in that sequence of commands, copy the fixed-up /usr/include/avisynth in the -filesonly package to wherever it is on your system you point FFmpeg's configure to to see AviSynth's headers, whether that's the default /usr/local/include or /usr/include or somewhere in your build root. You can completely omit copying the .dylibs and it won't care. At this point, just use latest git, since that's where the HEADERS_ONLY fix resides: git clone https://github.com/AviSynth/AviSynthPlus cd AviSynthPlus mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DHEADERS_ONLY=ON ../ make VersionGen install And HEADERS_ONLY is exactly what it says on the tin: it only sets CMake to install the headers, and stops it from building the library, which wouldn't get linked to anyway. This all did expose a major problem with the version detection inside the frame properties initialization area in the demuxer, so that check needs to be simplified and not try to be so clever. Between HEADERS_ONLY from AviSynth+-git and the simplifying patch*, which I'll need to push sometime in the next day or so, that should completely resolve the problem. *http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/293128.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/avisynth: fix frameprop version check
Trying to be clever about determining between interface version 8 and 8.1 ended up with pre-8.1 versions of AviSynth+ segfaulting. The amount of time between interface version 8.1 and 9 is small, so just restrict the frameprop awareness to version 9 and call it a day. --- libavformat/avisynth.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8bc39869a3..b345f5efe2 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -502,24 +502,13 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) /* Read AviSynth+'s frame properties to set additional info. * * Due to a bug preventing the C interface from accessing frame - * properties in earlier versions of interface version 8, only - * enable this if we detect version 8.1 at the minimum. */ + * properties in earlier versions of interface version 8, and + * previous attempts at being clever resulting in pre-8 versions + * of AviSynth+ segfaulting, only enable this if we detect + * version 9 at the minimum. Technically, 8.1 works, but the time + * distance between 8.1 and 9 is very small, so just restrict it to 9. */ -if (!avs_library.avs_get_env_property) { -av_log(s, AV_LOG_TRACE, "%s\n", - "avs_get_env_property does not exist in AviSynth library; frame properties won't be checked."); -frameprop = false; -} else { -if (avs_library.avs_get_env_property(avs->env, AVS_AEP_INTERFACE_BUGFIX)) { -av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.1 or higher, reading frame properties."); -frameprop = true; -} else { -av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.0, need 8.1+ to read frame properties."); -frameprop = false; -} -} - -if (frameprop = true) { +if (avs_library.avs_get_version(avs->clip) >= 9) { frame = avs_library.avs_get_frame(avs->clip, framedata); avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/16/22 12:10 AM, Helmut K. C. Tessarek wrote: On 2022-02-15 22:50, Stephen Hutchinson wrote: Those errors would indicate you're not on the 3.7 branch, because if the filesystem submodule isn't present, it doesn't emit those errors, it stops dead because of the missing header. If the submodule is there, it compiles as it should. Is the filesystem subdirectory empty? Nope, I used the git command you posted. I also checked the filesystem dir: [tessus@epsilon3 0 ~/data/ext/ffmpeg/compile/AviSynthPlus/filesystem :3f1c185|✔]$ ll total 76 drwxr-xr-x 18 tessus wheel 576 2022-02-15 20:23 . drwxr-xr-x 16 tessus wheel 512 2022-02-15 20:31 .. -rw-r--r-- 1 tessus wheel 2842 2022-02-15 20:23 .appveyor.yml drwxr-xr-x 4 tessus wheel 128 2022-02-15 20:23 .ci -rw-r--r-- 1 tessus wheel 313 2022-02-15 20:23 .cirrus.yml -rw-r--r-- 1 tessus wheel 576 2022-02-15 20:23 .clang-format -rw-r--r-- 1 tessus wheel 795 2022-02-15 20:23 .drone.yml -rw-r--r-- 1 tessus wheel35 2022-02-15 20:23 .git drwxr-xr-x 3 tessus wheel96 2022-02-15 20:23 .github -rw-r--r-- 1 tessus wheel32 2022-02-15 20:23 .gitignore -rw-r--r-- 1 tessus wheel 4141 2022-02-15 20:23 .travis.yml -rw-r--r-- 1 tessus wheel 1937 2022-02-15 20:23 CMakeLists.txt -rw-r--r-- 1 tessus wheel 1086 2022-02-15 20:23 LICENSE -rw-r--r-- 1 tessus wheel 35982 2022-02-15 20:23 README.md drwxr-xr-x 4 tessus wheel 128 2022-02-15 20:23 cmake drwxr-xr-x 5 tessus wheel 160 2022-02-15 20:23 examples drwxr-xr-x 3 tessus wheel96 2022-02-15 20:23 include drwxr-xr-x 11 tessus wheel 352 2022-02-15 20:23 test I'm building AviSynth like this: [tessus@epsilon3 0 ~/data/ext/ffmpeg/compile/AviSynthPlus] mkdir avisynth-build && cd avisynth-build cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DBUILD_SHARED_LIBS=OFF .. make VersionGen install Until 2 days ago I could compile ffmpeg with AviSynth 3.5.1 just fine. So something must have made my configure to fail. I can't reproduce under the 10.14 VM. BUILD_SHARED_LIBS or not, if filesystem isn't present, it stops with a missing header error, and if it was properly '--recursive'ly cloned, the build succeeds. The only thing I can think of at this point is that the default Command Line Developer Tools fetch the utilities from Xcode 10, which are blissfully unaware of things Apple might have tried getting clever about in Xcode 11. That repeated 'error: is unavailable: introduced in macOS 10.15' message seems like something is new enough to *know* about it being present in 10.15, and might be interfering with it somehow. There is another option, basically what Gyan suggested earlier: grab the release build of 3.7.1, fetch the extra headers from the Github repo, then copy either all the contents of the tarball's /usr directory into the system /usr directory (or wherever your working ${prefix} is), or just the 'avisynth' directory into ${prefix}/include. Then try FFmpeg again. curl -L -O https://github.com/AviSynth/AviSynthPlus/releases/download/v3.7.1/AviSynthPlus_3.7.1_macOS_10.13_._10.14_x64-filesonly.tar.xz tar -xJvf AviSynthPlus_3.7.1_macOS_10.13_._10.14_x64-filesonly.tar.xz cd avisynthplus_3.7.1_macOS_10.13_\&_10.14_x64-filesonly/usr/include/avisynth/avs curl -L -o arch.h https://raw.githubusercontent.com/AviSynth/AviSynthPlus/master/avs_core/core/arch.h.in curl -L -o version.h https://raw.githubusercontent.com/AviSynth/AviSynthPlus/master/avs_core/core/version.h.in cd ../../../ sudo cp -R * /usr or cd ../../ sudo cp -R avisynth /usr/include The first option will at least allow you to test that AviSynth works when trying to use it with FFmpeg, because it'll make sure libavisynth.dylib is present. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/15/22 8:33 PM, Helmut K. C. Tessarek wrote: Unfortunately this didn't work. Building the new AviSynthPlus results in the following errors: Those errors would indicate you're not on the 3.7 branch, because if the filesystem submodule isn't present, it doesn't emit those errors, it stops dead because of the missing header. If the submodule is there, it compiles as it should. Is the filesystem subdirectory empty? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/15/22 5:02 PM, Helmut K. C. Tessarek wrote: What is the solution? I am compiling ffmpeg with AviSynthPlus-3.5.1 and my configure just errored out with ERROR: avisynth/avisynth_c.h avisynth/avs/version.h not found Which makes sense because I don't have a version.h Do I have to use the latest git version of AviSynthPlus. Is there a fix coming for configure so that I can compile it as I did 2 days ago? Cheers, K. C. git clone --recursive -b 3.7 https://github.com/AviSynth/AviSynthPlus [build/install as usual] -b 3.7 is equal to the tarball for 3.7.1a (which has the fix for the case of building the entire library), --recursive pulls in the submodule needed for the default AppleClang on 10.13 & 10.14. Unfortunately, Github doesn't put submodules in the tarballs. The fix on latest git was specifically for those that want to use the HEADERS_ONLY option when configuring. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/14/22 6:56 AM, Gyan Doshi wrote: On 2022-02-14 05:04 am, Stephen Hutchinson wrote: On 2/8/22 6:02 AM, Stephen Hutchinson wrote: The headers from version 3.7.1 are needed in order to support parsing of frame properties. avs/version.h has been generated as part of the AviSynth+ build process for a long time, but was never installed with the includes until version 3.7.1a. Checking for the presence of avs/version.h might have been sufficient, but a version check mechanism might be useful in the future. This does not change the version compatibility with the library itself; previous 3.x versions of AviSynth+ as well as AviSynth 2.6 can still be used with the demuxer. Signed-off-by: Stephen Hutchinson --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 493493b4c5..544d341b49 100755 --- a/configure +++ b/configure @@ -6508,7 +6508,9 @@ for func in $COMPLEX_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth && require_headers "avisynth/avisynth_c.h" +enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && The advice for AVS+ dlopen consumers is to only build and install AVS+ headers. That does not install version.h and arch.h which are only built with the binary artifacts, not with -DHEADERS_ONLY. For my Windows build, I just manually copied and renamed the template files to make configure succeed. Regards, Gyan Should be fixed in https://github.com/AviSynth/AviSynthPlus/commit/0e583378116c857372232e9886c599df2fb8da85 with the caveat (noted in AviSynth+'s README.md) that the `make install` step now needs to explicitly invoke the VersionGen target, `make VersionGen install`. I fiddled with it for a while, but I couldn't get the install process to invoke it automatically. Related, the older GNUmakefile method is not set up to generate version.h and arch.h (especially considering both of those use *.cmake scripts), so it's now pretty clearly deprecated. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: The headers from version 3.7.1 are needed in order to support parsing of frame properties. avs/version.h has been generated as part of the AviSynth+ build process for a long time, but was never installed with the includes until version 3.7.1a. Checking for the presence of avs/version.h might have been sufficient, but a version check mechanism might be useful in the future. This does not change the version compatibility with the library itself; previous 3.x versions of AviSynth+ as well as AviSynth 2.6 can still be used with the demuxer. Signed-off-by: Stephen Hutchinson --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 493493b4c5..544d341b49 100755 --- a/configure +++ b/configure @@ -6508,7 +6508,9 @@ for func in $COMPLEX_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth && require_headers "avisynth/avisynth_c.h" +enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avisynth: use AviSynth+'s frame properties to set various fields
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: * Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 263 +++-- 1 file changed, 250 insertions(+), 13 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1e862a6a85..8bc39869a3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/attributes.h" #include "libavutil/internal.h" @@ -76,6 +78,9 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); +AVSC_DECLARE_FUNC(avs_get_frame_props_ro); +AVSC_DECLARE_FUNC(avs_prop_get_int); +AVSC_DECLARE_FUNC(avs_get_env_property); #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -153,6 +158,9 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); +LOAD_AVS_FUNC(avs_get_frame_props_ro, 1); +LOAD_AVS_FUNC(avs_prop_get_int, 1); +LOAD_AVS_FUNC(avs_get_env_property, 1); #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -236,6 +244,10 @@ static av_cold void avisynth_atexit_handler(void) static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) { AviSynthContext *avs = s->priv_data; +const AVS_Map *avsmap; +AVS_VideoFrame *frame; +int framedata, error; +bool frameprop; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -251,19 +263,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -st->codecpar->field_order = AV_FIELD_UNKNOWN; -/* AviSynth works with frame-based video, detecting field order can - * only work when avs_is_field_based returns 'false'. */ -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -if (avs_is_field_based(avs->vi) == 0) { -if (avs_is_tff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_TT; -} -else if (avs_is_bff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_BB; -} -} - switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: @@ -499,6 +498,244 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 1; avs->planes = avs_planes_packed; } + +/* Read AviSynth+'s frame properties to set additional info. + * + * Due to a bug preventing the C interface from accessing frame + * properties in earlier versions of interface version 8, only + * enable this if we detect version 8.1 at the minimum. */ + +if (!avs_library.avs_get_env_property) { +av_log(s, AV_LOG_TRACE, "%s\n", + "avs_get_env_property does not exist in AviSynth library; frame properties won't be checked."); +frameprop = false; +} else { +if (avs_library.avs_get_env_property(avs->env, AVS_AEP_INTERFACE_BUGFIX)) { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.1 or higher, reading frame properties."); +frameprop = true; +} else { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.0, need 8.1+ to read frame properties."); +frameprop = false; +} +} + +if (frameprop = true) { + +frame = avs_library.avs_get_frame(avs->clip, framedata); +avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); + +/* Field order */ +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} + +/* Color Range */ +switch (avs_library.avs_prop_get_int(avs->env,
Re: [FFmpeg-devel] [PATCH 1/3] avisynth: corrected interlace detection
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: From: emcodem AviSynth works on frame-based video by default, which can be either progressive or interlaced. Some filters can break frames into half-height fields, at which point it considers the clip to be field-based (avs_is_field_based can be used to check for this situation). To properly detect the field order of a typical video clip, the frame needs to have been weaved back together already, so avs_is_field_based should actually report 'false' when checked. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..1e862a6a85 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); -/* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; -if (avs_is_field_based(avs->vi)) { +/* AviSynth works with frame-based video, detecting field order can + * only work when avs_is_field_based returns 'false'. */ +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; } Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 0/3] avformat/avisynth: support frame properties
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: AviSynth+ 3.6.0 introduced support for frame properties, allowing various metadata to be passed between filters or read out by client programs. Using this, FFmpeg can read Color Range, Transfer Characteristics, Matrix, Color Primaries, Chroma Location, and Field Order information from AviSynth scripts. Reading frame properties through AviSynth's C interface was not possible until a few months ago, though, so client programs that use the C API need version 3.7.1 or higher to be able to take advantage of it. Incorporates a previous patch by emcodem that fixes setting field order on non-frameprop-aware versions of AviSynth. Stephen Hutchinson (2): avisynth: use AviSynth+'s frame properties to set various fields configure: check avisynth header version emcodem (1): avisynth: corrected interlace detection configure | 4 +- libavformat/avisynth.c | 266 ++--- 2 files changed, 253 insertions(+), 17 deletions(-) Since it's been about a week, if there aren't any objections that show up, I'll go ahead and push this later today or tomorrow. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] configure: check avisynth header version
The headers from version 3.7.1 are needed in order to support parsing of frame properties. avs/version.h has been generated as part of the AviSynth+ build process for a long time, but was never installed with the includes until version 3.7.1a. Checking for the presence of avs/version.h might have been sufficient, but a version check mechanism might be useful in the future. This does not change the version compatibility with the library itself; previous 3.x versions of AviSynth+ as well as AviSynth 2.6 can still be used with the demuxer. Signed-off-by: Stephen Hutchinson --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 493493b4c5..544d341b49 100755 --- a/configure +++ b/configure @@ -6508,7 +6508,9 @@ for func in $COMPLEX_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth && require_headers "avisynth/avisynth_c.h" +enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" && + { test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" || + die "ERROR: AviSynth+ header version must be >= 3.7.1"; } } enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avisynth: use AviSynth+'s frame properties to set various fields
* Field Order * Chroma Location * Color Transfer Characteristics * Color Range * Color Primaries * Matrix Coefficients The existing TFF/BFF detection is retained as a fallback for older versions of AviSynth that can't access frame properties. The other properties have no legacy equivalent to detect them. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 263 +++-- 1 file changed, 250 insertions(+), 13 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1e862a6a85..8bc39869a3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "libavutil/attributes.h" #include "libavutil/internal.h" @@ -76,6 +78,9 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); +AVSC_DECLARE_FUNC(avs_get_frame_props_ro); +AVSC_DECLARE_FUNC(avs_prop_get_int); +AVSC_DECLARE_FUNC(avs_get_env_property); #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -153,6 +158,9 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); +LOAD_AVS_FUNC(avs_get_frame_props_ro, 1); +LOAD_AVS_FUNC(avs_prop_get_int, 1); +LOAD_AVS_FUNC(avs_get_env_property, 1); #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -236,6 +244,10 @@ static av_cold void avisynth_atexit_handler(void) static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) { AviSynthContext *avs = s->priv_data; +const AVS_Map *avsmap; +AVS_VideoFrame *frame; +int framedata, error; +bool frameprop; int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -251,19 +263,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -st->codecpar->field_order = AV_FIELD_UNKNOWN; -/* AviSynth works with frame-based video, detecting field order can - * only work when avs_is_field_based returns 'false'. */ -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -if (avs_is_field_based(avs->vi) == 0) { -if (avs_is_tff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_TT; -} -else if (avs_is_bff(avs->vi)) { -st->codecpar->field_order = AV_FIELD_BB; -} -} - switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: @@ -499,6 +498,244 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 1; avs->planes = avs_planes_packed; } + +/* Read AviSynth+'s frame properties to set additional info. + * + * Due to a bug preventing the C interface from accessing frame + * properties in earlier versions of interface version 8, only + * enable this if we detect version 8.1 at the minimum. */ + +if (!avs_library.avs_get_env_property) { +av_log(s, AV_LOG_TRACE, "%s\n", + "avs_get_env_property does not exist in AviSynth library; frame properties won't be checked."); +frameprop = false; +} else { +if (avs_library.avs_get_env_property(avs->env, AVS_AEP_INTERFACE_BUGFIX)) { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.1 or higher, reading frame properties."); +frameprop = true; +} else { +av_log(s, AV_LOG_TRACE, "%s\n", "Using interface version 8.0, need 8.1+ to read frame properties."); +frameprop = false; +} +} + +if (frameprop = true) { + +frame = avs_library.avs_get_frame(avs->clip, framedata); +avsmap = avs_library.avs_get_frame_props_ro(avs->env, frame); + +/* Field order */ +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_FieldBased", 0, )) { +case 0: +st->codecpar->field_order = AV_FIELD_PROGRESSIVE; +break; +case 1: +st->codecpar->field_order = AV_FIELD_BB; +break; +case 2: +st->codecpar->field_order = AV_FIELD_TT; +break; +default: +st->codecpar->field_order = AV_FIELD_UNKNOWN; +} + +/* Color Range */ +switch (avs_library.avs_prop_get_int(avs->env, avsmap, "_ColorRange", 0, )) { +case 0: +st->
[FFmpeg-devel] [PATCH 1/3] avisynth: corrected interlace detection
From: emcodem AviSynth works on frame-based video by default, which can be either progressive or interlaced. Some filters can break frames into half-height fields, at which point it considers the clip to be field-based (avs_is_field_based can be used to check for this situation). To properly detect the field order of a typical video clip, the frame needs to have been weaved back together already, so avs_is_field_based should actually report 'false' when checked. Signed-off-by: Stephen Hutchinson --- libavformat/avisynth.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..1e862a6a85 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); -/* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; -if (avs_is_field_based(avs->vi)) { +/* AviSynth works with frame-based video, detecting field order can + * only work when avs_is_field_based returns 'false'. */ +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; } -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/3] avformat/avisynth: support frame properties
AviSynth+ 3.6.0 introduced support for frame properties, allowing various metadata to be passed between filters or read out by client programs. Using this, FFmpeg can read Color Range, Transfer Characteristics, Matrix, Color Primaries, Chroma Location, and Field Order information from AviSynth scripts. Reading frame properties through AviSynth's C interface was not possible until a few months ago, though, so client programs that use the C API need version 3.7.1 or higher to be able to take advantage of it. Incorporates a previous patch by emcodem that fixes setting field order on non-frameprop-aware versions of AviSynth. Stephen Hutchinson (2): avisynth: use AviSynth+'s frame properties to set various fields configure: check avisynth header version emcodem (1): avisynth: corrected interlace detection configure | 4 +- libavformat/avisynth.c | 266 ++--- 2 files changed, 253 insertions(+), 17 deletions(-) -- 2.32.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/cmdutils: don't print build configuration by default
On 8/8/2021 12:31 AM, Gyan Doshi wrote: On 2021-08-06 11:34 pm, James Almer wrote: From: Matthieu Patou Suggested-by: ffm...@fb.com Signed-off-by: James Almer --- fftools/cmdutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 912e881174..fc58277df7 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1160,7 +1160,8 @@ static void print_program_info(int flags, int level) av_log(NULL, level, "\n"); av_log(NULL, level, "%sbuilt with %s\n", indent, CC_IDENT); - av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent); + if (flags & SHOW_CONFIG) + av_log(NULL, level, "%sconfiguration: " FFMPEG_CONFIGURATION "\n", indent); I like it. If most users pasted the full log on their own initiative in bug reports or Q then this would have been a negative but they don't. I suggest to add an else clause that prints something like "Add -buildconf to view configuration". Fun fact, the original -buildconf patchset included¹ that as an option, by letting users opt to disable the configuration: line entirely, whereby it would notify them to use -buildconf. I have kept it rebased over the years in my github repo². ¹http://ffmpeg.org/pipermail/ffmpeg-devel/2013-November/151075.html ²https://github.com/qyot27/FFmpeg/commit/ce087ae0b72cf70fff29300b528122b7451cb4b7 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavformat/isom_tags.c: add ipcm to list of tags
Fixes http://trac.ffmpeg.org/ticket/9219 --- libavformat/isom_tags.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c index 1666b9d4a5..e2e589b658 100644 --- a/libavformat/isom_tags.c +++ b/libavformat/isom_tags.c @@ -312,6 +312,8 @@ const AVCodecTag ff_codec_movaudio_tags[] = { { AV_CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') }, { AV_CODEC_ID_PCM_S16BE, MKTAG('l', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') }, +{ AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'p', 'c', 'm') }, +{ AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') }, { AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') }, { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') }, -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avisynth.c corrected interlace detection
On 5/24/2021 11:03 AM, emcodem wrote: Sorry for the delay on this, should have corrected it much earlier. There was some confusion in the interlaced analysis. From 3rdparty decoders perspective, a clip can only be interlaced when it is NOT field_based. This is because in a field_based clip, the fields are separate images, so it is actually progressive. In that case, avisynth still shows is_tff or bff because those values are needed in case the script decides to weave the separated fields later on. --- libavformat/avisynth.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..ff6e6e1bfa 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); -av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); -av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); -/* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; -if (avs_is_field_based(avs->vi)) { +/* separatefields makes field_based==true, weave makes field_based==false + * only non field_based clips can therefore be interlaced */ +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; } The change seems okay, but the comment and commit message need to explain what's going on better, because the confusion that's erupted over this seems to derive from the rather poor way the AviSynth documentation describes the difference between field-based and frame-based clips, and how to access this information through the API. After having read through all of this a bit more, the situation appears to be as follows: AviSynth works on Frame-based video. Full stop. 'Frame-based', despite the name, is not a synonym for 'progressive', merely that it's being processed as a single frame rather than as a half-height field. This is the single point from which all the rest of this got confused. Using SeparateFields(), you can break the frame into its constituent half-height fields so that certain filters which don't like processing interlaced footage can filter the fields as a sort of 'fake progressive', before using Weave() to combine the fields again into a singular full height frame. That's its intention, rather than to signal to a client program that something is interlaced. The AssumeFieldBased() function and avs_is_field_based API check are there to allow other functions to understand this situation where the fields have been broken apart (or to override the field-based setting in cases that it didn't get set properly). The confusion seems to have arisen from mistaking these as ways that AviSynth indicates something is interlaced or not, and it isn't. For that purpose, you have to look at frame properties, something that was introduced in AviSynth+ as a flag that a source plugin can set to indicate whether the frame is interlaced (either tff or bff) or progressive. Adding frame property detection to the demuxer here would require larger changes that need to be guarded from 2.6, but it would accomplish the goal I *think* this is ultimately intended to address. The in-code comment should probably be something closer to: /* AviSynth works on frame-based video by default, which can /* be either progressive or interlaced. Some filters can break /* frames into half-height fields, at which point it considers /* the clip to be field-based (avs_is_field_based can be used /* to check for this situation). /* To properly detect the field order of a typical video clip, /* the frame needs to have been weaved back together already, /* so avs_is_field_based should actually report 'false' when /* checked. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 4.4
On 3/10/2021 2:48 PM, Marton Balint wrote: On Tue, 9 Mar 2021, Stephen Hutchinson wrote: On 3/9/2021 3:47 PM, Michael Niedermayer wrote: Hi all I will branch release/4.4 soon then like always leave some time for testing, bugfixes, ... and then make FFmeg 4.4 from release/4.4, its too long since 4.3 These three AviSynth demuxer patches should probably go in before 4.4: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html That third one especially. OK, I will apply these. The fixed version of the first patch is here, as I mentioned in the other email: http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277547.html Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avisynth: more intelligent RGB flipping
avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available through AVSC_API since 2.6. This means that GetProcAddress doesn't have to run on every frame. --- libavformat/avisynth.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..5756aea0b6 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -57,6 +57,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); @@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); +LOAD_AVS_FUNC(avs_is_color_space, 1); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); @@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits, ret; const char *error; -int avsplus av_unused; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; @@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef _WIN32 -/* Detect whether we're using AviSynth 2.6 or AviSynth+ by - * looking for whether avs_is_planar_rgb exists. */ -if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) -avsplus = 0; -else -avsplus = 1; -#else -/* AviSynth+ is now the only variant of AviSynth we support - * on Linux and macOS. */ -avsplus = 1; -#endif - bits = avs_library.avs_bits_per_pixel(avs->vi); /* Without the cast to int64_t, calculation overflows at about 9k x 9k @@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, planeheight = avs_library.avs_get_height_p(frame, plane); /* Flip RGB video. */ -if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { -src_p = src_p + (planeheight - 1) * pitch; -pitch = -pitch; -} - -/* Flip Planar RGB video */ -if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || -avs_library.avs_is_planar_rgba(avs->vi))) { +if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 4.4
On 3/10/2021 2:48 PM, Marton Balint wrote: On Tue, 9 Mar 2021, Stephen Hutchinson wrote: On 3/9/2021 3:47 PM, Michael Niedermayer wrote: Hi all I will branch release/4.4 soon then like always leave some time for testing, bugfixes, ... and then make FFmeg 4.4 from release/4.4, its too long since 4.3 These three AviSynth demuxer patches should probably go in before 4.4: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html That third one especially. OK, I will apply these. Regards, Marton There is one minor change to the RGB flipping patch that's needed that I confirmed last night. +LOAD_AVS_FUNC(avs_is_color_space, 0); That actually needs to be 1, not 0. Otherwise it breaks the version check that tells people to upgrade if they're still using 2.5. I was going to send a fixed version of the patch later today. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 4.4
On 3/10/2021 2:48 PM, Marton Balint wrote: On Tue, 9 Mar 2021, Stephen Hutchinson wrote: On 3/9/2021 3:47 PM, Michael Niedermayer wrote: Hi all I will branch release/4.4 soon then like always leave some time for testing, bugfixes, ... and then make FFmeg 4.4 from release/4.4, its too long since 4.3 These three AviSynth demuxer patches should probably go in before 4.4: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html That third one especially. OK, I will apply these. Regards, Marton There is one minor change to the RGB flipping patch that's needed that I confirmed last night. +LOAD_AVS_FUNC(avs_is_color_space, 0); That actually needs to be 1, not 0. Otherwise it breaks the version check that tells people to upgrade if they're still using 2.5. I was going to send a fixed version of the patch later today. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 4.4
On 3/9/2021 3:47 PM, Michael Niedermayer wrote: Hi all I will branch release/4.4 soon then like always leave some time for testing, bugfixes, ... and then make FFmeg 4.4 from release/4.4, its too long since 4.3 These three AviSynth demuxer patches should probably go in before 4.4: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/264269.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275893.html http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276389.html That third one especially. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avisynth: populate field order
From: emcodem Fixes Trac ticket #8757 Signed-off-by: Stephen Hutchinson --- Resubmitting with my signed-off so that it's clear that I've given final approval and it shows up in Patchwork. libavformat/avisynth.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index f029a0e842..923c645bfb 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -243,6 +243,23 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); + +/* The following typically only works when assumetff (-bff) and + * assumefieldbased is used in-script. Additional + * logic using GetParity() could deliver more accurate results + * but also decodes a frame which we want to avoid. */ +st->codecpar->field_order = AV_FIELD_UNKNOWN; +if (avs_is_field_based(avs->vi)) { +if (avs_is_tff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_TT; +} +else if (avs_is_bff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_BB; +} +} + switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avisynth: fix audio on big endian
--- libavformat/avisynth.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index f029a0e842..4cd6d6bc90 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -42,6 +42,13 @@ #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +/* Endianness guards for audio */ +#if HAVE_BIGENDIAN +#define PCM(format) (AV_CODEC_ID_PCM_ ## format ## BE) +#else +#define PCM(format) (AV_CODEC_ID_PCM_ ## format ## LE) +#endif + #include typedef struct AviSynthLibrary { @@ -496,16 +503,16 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case AVS_SAMPLE_INT16: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; +st->codecpar->codec_id = PCM(S16); break; case AVS_SAMPLE_INT24: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE; +st->codecpar->codec_id = PCM(S24); break; case AVS_SAMPLE_INT32: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE; +st->codecpar->codec_id = PCM(S32); break; case AVS_SAMPLE_FLOAT: -st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE; +st->codecpar->codec_id = PCM(F32); break; default: av_log(s, AV_LOG_ERROR, -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avisynth: fix audio on big endian
--- Open for bikeshedding, as I'm not too sure of the names, but I didn't want to use anything too close to regular AV_CODEC_ID* defines. libavformat/avisynth.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index f029a0e842..fbebb6707c 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -42,6 +42,19 @@ #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +/* Endianness guards for audio */ +#if HAVE_BIGENDIAN +#define AVISYNTH_PCM_OUT_S16 AV_CODEC_ID_PCM_S16BE +#define AVISYNTH_PCM_OUT_S24 AV_CODEC_ID_PCM_S24BE +#define AVISYNTH_PCM_OUT_S32 AV_CODEC_ID_PCM_S32BE +#define AVISYNTH_PCM_OUT_F32 AV_CODEC_ID_PCM_F32BE +#else +#define AVISYNTH_PCM_OUT_S16 AV_CODEC_ID_PCM_S16LE +#define AVISYNTH_PCM_OUT_S24 AV_CODEC_ID_PCM_S24LE +#define AVISYNTH_PCM_OUT_S32 AV_CODEC_ID_PCM_S32LE +#define AVISYNTH_PCM_OUT_F32 AV_CODEC_ID_PCM_F32LE +#endif + #include typedef struct AviSynthLibrary { @@ -496,16 +509,16 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; break; case AVS_SAMPLE_INT16: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; +st->codecpar->codec_id = AVISYNTH_PCM_OUT_S16; break; case AVS_SAMPLE_INT24: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE; +st->codecpar->codec_id = AVISYNTH_PCM_OUT_S24; break; case AVS_SAMPLE_INT32: -st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE; +st->codecpar->codec_id = AVISYNTH_PCM_OUT_S32; break; case AVS_SAMPLE_FLOAT: -st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE; +st->codecpar->codec_id = AVISYNTH_PCM_OUT_F32; break; default: av_log(s, AV_LOG_ERROR, -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Populate field order returned by avs script, Trac Ticket 8757
On 1/17/21 1:23 PM, emco...@ffastrans.com wrote: On 2021-01-17 09:02, wrote Stephen Hutchinson: Comment bikeshedding aside, LGTM, but the avs_is* API usage added here needs to be reflected in the AVSC_DECLARE_FUNC and LOAD_AVS_FUNC blocks. If those parts of the API are present in 2.5, the LOAD_AVS_FUNC can be a 0. If they were added in 2.6 (or Plus, but I know these would have to be from classic AviSynth), then it should be 1. What i am not able to do is to add the used convenience functions avs_is_tff and bff to AVSC_DECLARE_FUNC and LOAD_AVS_FUNC, it refuses to compile when i do so. IMHO this is because it is just convenience functions that's function body is defined in the linked avisynth_c.h file instead of being exported by the avisynth api lib. The existing code in avisynth.c also uses such convenience functions without adding them to the declaration, examples: avs_has_video, line 524 avs_is_clip, line 571 Also, i found it safe to use the convenience functions avs_is_tff and bff because the minimum required version is 2.6 and Plus or above, so i hoped the functions will be always available. Yeah, never mind about that. I didn't notice that those are declared AVSC_INLINE, not AVSC_API, so they don't get used through the dynamic API loader. The comment formatting seems to have been messed up in the second version, though. /* The following typically only works when assumetff (-bff) and * assumefieldbased is used in-script. Additional * logic using GetParity() could deliver more accurate results * but also decodes a frame which we want to avoid. */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Populate field order returned by avs script, Trac Ticket 8757
On 1/16/21 7:26 PM, emco...@ffastrans.com wrote: The purpose of this is to tell ffmpeg which field order the returned clip of the avisynth .avs script decided to finally deliver, which is handy in an automated environment. Interlacing is generally a very hard topic in avisynth, the huge comment is neccessary to explain my reasons. Additionally to the comment in the patch, i can tell that i set unknown instead of progressive for backward compatibility. (i was struggeling with this, maybe i should have even left it unset in case it is not clearly tff or bff interlaced. /* Set interlacing type. http://avisynth.nl/index.php/Interlaced_fieldbased * The following typically only works when assumetff (-bff) and assumefieldbased is used in the avs. * This is because most avisynth source plugins do not set the parity info in the clip properties. * We could use GetParity() to be more accurate but it decodes a frame which is * expensive and can potentially lead to unforeseen behaviour when seeking later. * In case Parity is not known, we still cannot guarantee that */ Going into detail about GetParity wouldn't be necessary if it's not used (and there aren't any other invoke-parsed functions aside from checking with Import() whether the script actually returns a clip), so the comment could be shortened. Also, since this is the avisynth demuxer, 'in the avs' would be better rendered as 'in the script', and simply refer to 'source plugins' rather than 'avisynth source plugins'. Comment bikeshedding aside, LGTM, but the avs_is* API usage added here needs to be reflected in the AVSC_DECLARE_FUNC and LOAD_AVS_FUNC blocks. If those parts of the API are present in 2.5, the LOAD_AVS_FUNC can be a 0. If they were added in 2.6 (or Plus, but I know these would have to be from classic AviSynth), then it should be 1. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avisynth: more intelligent RGB flipping
On 6/9/20 7:56 PM, Stephen Hutchinson wrote: avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available since 2.6. This means that GetProcAddress doesn't have to run on every frame. --- Also should probably be applied to the 4.3 branch as well. libavformat/avisynth.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..f029a0e842 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -57,6 +57,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); @@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); +LOAD_AVS_FUNC(avs_is_color_space, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); @@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits, ret; const char *error; -int avsplus av_unused; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; @@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef _WIN32 -/* Detect whether we're using AviSynth 2.6 or AviSynth+ by - * looking for whether avs_is_planar_rgb exists. */ -if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) -avsplus = 0; -else -avsplus = 1; -#else -/* AviSynth+ is now the only variant of AviSynth we support - * on Linux and macOS. */ -avsplus = 1; -#endif - bits = avs_library.avs_bits_per_pixel(avs->vi); /* Without the cast to int64_t, calculation overflows at about 9k x 9k @@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, planeheight = avs_library.avs_get_height_p(frame, plane); /* Flip RGB video. */ -if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { -src_p = src_p + (planeheight - 1) * pitch; -pitch = -pitch; -} - -/* Flip Planar RGB video */ -if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || -avs_library.avs_is_planar_rgba(avs->vi))) { +if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avisynth: more intelligent RGB flipping
avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available since 2.6. This means that GetProcAddress doesn't have to run on every frame. --- Also should probably be applied to the 4.3 branch as well. libavformat/avisynth.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..f029a0e842 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -57,6 +57,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); @@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); +LOAD_AVS_FUNC(avs_is_color_space, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); @@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits, ret; const char *error; -int avsplus av_unused; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; @@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef _WIN32 -/* Detect whether we're using AviSynth 2.6 or AviSynth+ by - * looking for whether avs_is_planar_rgb exists. */ -if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) -avsplus = 0; -else -avsplus = 1; -#else -/* AviSynth+ is now the only variant of AviSynth we support - * on Linux and macOS. */ -avsplus = 1; -#endif - bits = avs_library.avs_bits_per_pixel(avs->vi); /* Without the cast to int64_t, calculation overflows at about 9k x 9k @@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, planeheight = avs_library.avs_get_height_p(frame, plane); /* Flip RGB video. */ -if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { -src_p = src_p + (planeheight - 1) * pitch; -pitch = -pitch; -} - -/* Flip Planar RGB video */ -if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || -avs_library.avs_is_planar_rgba(avs->vi))) { +if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/4] avisynth: switch to AviSynth+ on Linux
On 3/24/2020 2:40 PM, Stephen Hutchinson wrote: On 3/12/20 7:38 PM, Stephen Hutchinson wrote: AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++--- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..43b65badc9 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif - /* AviSynth 2.5 and AvxSynth pix_fmts */ + /* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_gre
Re: [FFmpeg-devel] [PATCH] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone.
On 3/24/2020 2:39 PM, Stephen Hutchinson wrote: Related to this are the following changes: * Mention the two methods that AviSynth+ provides for installing just the headers. * Expand on users installing AviSynth on their system a little more. --- This is the only patch that needed changes. I'll just ping the other three. doc/general.texi | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 3684847ac1..5f0f1b2ad1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -50,16 +50,18 @@ This driver can be installed using amdgpu-pro-install script in official amd dri @section AviSynth FFmpeg can read AviSynth scripts as input. To enable support, pass -@code{--enable-avisynth} to configure. The correct headers are -included in compat/avisynth/, which allows the user to enable support -without needing to search for these headers themselves. +@code{--enable-avisynth} to configure after installing the headers +provided by @url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}. +AviSynth+ can be configured to install only the headers by either +passing `-DHEADERS_ONLY:bool=on` to the normal CMake-based build +system, or by using the supplied @code{GNUmakefile}. For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux, macOS, and BSD, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,10 +79,11 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg -with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be -installed to use AviSynth scripts (obviously). +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg +with @code{--enable-avisynth}, and the binaries will work regardless +of the end user having AviSynth installed. If/when an end user +would like to use AviSynth scripts, then they can install AviSynth(+) +and FFmpeg will be able to find and use it to open scripts. @end float @section Chromaprint Ping. On Patchwork: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200324183919.8789-1-qyo...@gmail.com/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/4] avisynth: fix deprecation warning
On 3/24/2020 2:40 PM, Stephen Hutchinson wrote: On 3/12/20 7:38 PM, Stephen Hutchinson wrote: --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 43b65badc9..2c08ace8db 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,12 +555,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ - MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); + MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi); #else - arg = avs_new_value_string(s->filename); + arg = avs_new_value_string(s->url); #endif val = avs_library.avs_invoke(avs->env, "Import", arg, 0); if (avs_is_error(val)) { Ping. Ping #2. On Patchwork: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200312233802.4033-4-qyo...@gmail.com/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/4] avisynth: fix deprecation warning
On 3/12/20 7:38 PM, Stephen Hutchinson wrote: --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 43b65badc9..2c08ace8db 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,12 +555,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ -MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); +MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi); #else -arg = avs_new_value_string(s->filename); +arg = avs_new_value_string(s->url); #endif val = avs_library.avs_invoke(avs->env, "Import", arg, 0); if (avs_is_error(val)) { Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/4] compat: remove avisynth headers
On 3/12/20 7:37 PM, Stephen Hutchinson wrote: --- compat/avisynth/avisynth_c.h | 1264 - compat/avisynth/avs/capi.h| 94 -- compat/avisynth/avs/config.h | 70 - compat/avisynth/avs/types.h | 57 - compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 - configure |1 + tests/ref/fate/source |9 - 9 files changed, 1 insertion(+), 2384 deletions(-) delete mode 100644 compat/avisynth/avisynth_c.h delete mode 100644 compat/avisynth/avs/capi.h delete mode 100644 compat/avisynth/avs/config.h delete mode 100644 compat/avisynth/avs/types.h delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h deleted file mode 100644 index 9ff9321552..00 --- a/compat/avisynth/avisynth_c.h +++ /dev/null @@ -1,1264 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 USA, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -// NOTE: this is a partial update of the Avisynth C interface to recognize -// new color spaces added in Avisynth 2.60. By no means is this document -// completely Avisynth 2.60 compliant. -// 170103: added new CPU constants (FMA4, AVX512xx) -// 171102: define SIZETMOD. do not use yet, experimental. Offsets are size_t instead of int. Affects x64. -// 171106: avs_get_row_size calls into avs_get_row_size_p, instead of direct field access -// 171106: avs_get_height calls into avs_get_row_size_p, instead of direct field access -// 180524: AVSC_EXPORT to dllexport in capi.h for avisynth_c_plugin_init -// 180524: avs_is_same_colorspace VideoInfo parameters to const -// 181230: Readability: functions regrouped to mix less AVSC_API and AVSC_INLINE, put together Avisynth+ specific stuff -// 181230: use #ifndef AVSC_NO_DECLSPEC for AVSC_INLINE functions which are calling API functions -// 181230: comments on avs_load_library (helper for loading API entries dynamically into a struct using AVSC_NO_DECLSPEC define) -// 181230: define alias AVS_FRAME_ALIGN as FRAME_ALIGN -// 181230: remove unused form of avs_get_rowsize and avs_get_height (kept earlier for reference) -// 190104: avs_load_library: smart fallback mechanism for Avisynth+ specific functions: -// if they are not loadable, they will work in a classic Avisynth compatible mode -// Example#1: e.g. avs_is_444 will call the existing avs_is_yv24 instead -// Example#2: avs_bits_per_component will return 8 for all colorspaces (Classic Avisynth supports only 8 bits/pixel) -// Thus the Avisynth+ specific API functions are safely callable even when connected to classic Avisynth DLL - -#ifndef __AVISYNTH_C__ -#define __AVISYNTH_C__ - -#include "avs/config.h" -#include "avs/capi.h" -#include "avs/types.h" - -#define AVS_FRAME_ALIGN FRAME_ALIGN -/ -// -// Constants -// - -#ifndef __AVISYNTH_6_H__ -enum { AVISYNTH_IN
Re: [FFmpeg-devel] [PATCH 2/4] avisynth: switch to AviSynth+ on Linux
On 3/12/20 7:38 PM, Stephen Hutchinson wrote: AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++--- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..43b65badc9 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3]= { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3]= { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif -/* AviSynth 2.5 and AvxSynth pix_fmts */ +/* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_grey; @@ -556,7 +545,7 @@ static int avi
[FFmpeg-devel] [PATCH] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone.
Related to this are the following changes: * Mention the two methods that AviSynth+ provides for installing just the headers. * Expand on users installing AviSynth on their system a little more. --- This is the only patch that needed changes. I'll just ping the other three. doc/general.texi | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 3684847ac1..5f0f1b2ad1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -50,16 +50,18 @@ This driver can be installed using amdgpu-pro-install script in official amd dri @section AviSynth FFmpeg can read AviSynth scripts as input. To enable support, pass -@code{--enable-avisynth} to configure. The correct headers are -included in compat/avisynth/, which allows the user to enable support -without needing to search for these headers themselves. +@code{--enable-avisynth} to configure after installing the headers +provided by @url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}. +AviSynth+ can be configured to install only the headers by either +passing `-DHEADERS_ONLY:bool=on` to the normal CMake-based build +system, or by using the supplied @code{GNUmakefile}. For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux, macOS, and BSD, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,10 +79,11 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg -with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be -installed to use AviSynth scripts (obviously). +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg +with @code{--enable-avisynth}, and the binaries will work regardless +of the end user having AviSynth installed. If/when an end user +would like to use AviSynth scripts, then they can install AviSynth(+) +and FFmpeg will be able to find and use it to open scripts. @end float @section Chromaprint -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/4] avisynth: switch to AviSynth+ on Linux
AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++--- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..43b65badc9 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3]= { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3]= { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif -/* AviSynth 2.5 and AvxSynth pix_fmts */ +/* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_grey; @@ -556,7 +545,7 @@ static int avisynth_open_file(AVFormatContext *s) AviSynthContext *avs = s->priv_data; AVS_Value arg, val; int ret; -#ifdef USING_AVISYNTH +#ifdef _WIN32 char filename_ansi[MAX_PATH * 4]; wchar_t filename_wc[MAX_PATH * 4]; #endif @@ -564,7
[FFmpeg-devel] [PATCH 1/4] compat: remove avisynth headers
--- compat/avisynth/avisynth_c.h | 1264 - compat/avisynth/avs/capi.h| 94 -- compat/avisynth/avs/config.h | 70 - compat/avisynth/avs/types.h | 57 - compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 - configure |1 + tests/ref/fate/source |9 - 9 files changed, 1 insertion(+), 2384 deletions(-) delete mode 100644 compat/avisynth/avisynth_c.h delete mode 100644 compat/avisynth/avs/capi.h delete mode 100644 compat/avisynth/avs/config.h delete mode 100644 compat/avisynth/avs/types.h delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h deleted file mode 100644 index 9ff9321552..00 --- a/compat/avisynth/avisynth_c.h +++ /dev/null @@ -1,1264 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 USA, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -// NOTE: this is a partial update of the Avisynth C interface to recognize -// new color spaces added in Avisynth 2.60. By no means is this document -// completely Avisynth 2.60 compliant. -// 170103: added new CPU constants (FMA4, AVX512xx) -// 171102: define SIZETMOD. do not use yet, experimental. Offsets are size_t instead of int. Affects x64. -// 171106: avs_get_row_size calls into avs_get_row_size_p, instead of direct field access -// 171106: avs_get_height calls into avs_get_row_size_p, instead of direct field access -// 180524: AVSC_EXPORT to dllexport in capi.h for avisynth_c_plugin_init -// 180524: avs_is_same_colorspace VideoInfo parameters to const -// 181230: Readability: functions regrouped to mix less AVSC_API and AVSC_INLINE, put together Avisynth+ specific stuff -// 181230: use #ifndef AVSC_NO_DECLSPEC for AVSC_INLINE functions which are calling API functions -// 181230: comments on avs_load_library (helper for loading API entries dynamically into a struct using AVSC_NO_DECLSPEC define) -// 181230: define alias AVS_FRAME_ALIGN as FRAME_ALIGN -// 181230: remove unused form of avs_get_rowsize and avs_get_height (kept earlier for reference) -// 190104: avs_load_library: smart fallback mechanism for Avisynth+ specific functions: -// if they are not loadable, they will work in a classic Avisynth compatible mode -// Example#1: e.g. avs_is_444 will call the existing avs_is_yv24 instead -// Example#2: avs_bits_per_component will return 8 for all colorspaces (Classic Avisynth supports only 8 bits/pixel) -// Thus the Avisynth+ specific API functions are safely callable even when connected to classic Avisynth DLL - -#ifndef __AVISYNTH_C__ -#define __AVISYNTH_C__ - -#include "avs/config.h" -#include "avs/capi.h" -#include "avs/types.h" - -#define AVS_FRAME_ALIGN FRAME_ALIGN -/ -// -// Constants -// - -#ifndef __AVISYNTH_6_H__ -enum { AVISYNTH_INTERFACE_VERSION = 6 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1,
[FFmpeg-devel] [PATCH 3/4] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone.
Related to this are the following changes: * Mention the GNUmakefile that AviSynth+ provides for installing just the headers. * Expand on users installing AviSynth on their system a little more. --- doc/general.texi | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 3684847ac1..ceea4210f3 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -50,16 +50,17 @@ This driver can be installed using amdgpu-pro-install script in official amd dri @section AviSynth FFmpeg can read AviSynth scripts as input. To enable support, pass -@code{--enable-avisynth} to configure. The correct headers are -included in compat/avisynth/, which allows the user to enable support -without needing to search for these headers themselves. +@code{--enable-avisynth} to configure after installing the headers +provided by @url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}. +AviSynth+ supplies a @code{GNUmakefile} to install only the headers, +as CMake does not make header-only installs an easy task. For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux, macOS, and BSD, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,10 +78,11 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg -with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be -installed to use AviSynth scripts (obviously). +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg +with @code{--enable-avisynth}, and the binaries will work regardless +of the end user having AviSynth installed. If/when an end user +would like to use AviSynth scripts, then they can install AviSynth(+) +and FFmpeg will be able to find and use it to open scripts. @end float @section Chromaprint -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] avisynth: fix deprecation warning
--- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 43b65badc9..2c08ace8db 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,12 +555,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ -MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); +MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi); #else -arg = avs_new_value_string(s->filename); +arg = avs_new_value_string(s->url); #endif val = avs_library.avs_invoke(avs->env, "Import", arg, 0); if (avs_is_error(val)) { -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] compat/avisynth: update headers
On 3/12/20 4:46 AM, Marton Balint wrote: Is it still required to include the headers in our source tree? AVISynth was frowned upon in the past beacuse generally we do not allow headers of external libraries in our tree. If there is a way to completely remove the headers and keep the feature buildable with reasonable amount of work then I suggest we should do that. I had a feeling this would get brought up, which is why I did make sure the necessary changes occurred in AviSynth+ upstream so that FFmpeg could use the system headers. I'll send the revised patches as a reply to this message. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/5] compat/avisynth: remove AvxSynth headers
--- compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 -- tests/ref/fate/source | 5 - 4 files changed, 895 deletions(-) delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avxsynth_c.h b/compat/avisynth/avxsynth_c.h deleted file mode 100644 index 991f4be1ab..00 --- a/compat/avisynth/avxsynth_c.h +++ /dev/null @@ -1,728 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 USA, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -#ifndef __AVXSYNTH_C__ -#define __AVXSYNTH_C__ - -#include "windowsPorts/windows2linux.h" -#include - -#ifdef __cplusplus -# define EXTERN_C extern "C" -#else -# define EXTERN_C -#endif - -#define AVSC_USE_STDCALL 1 - -#ifndef AVSC_USE_STDCALL -# define AVSC_CC __cdecl -#else -# define AVSC_CC __stdcall -#endif - -#define AVSC_INLINE static __inline - -#ifdef AVISYNTH_C_EXPORTS -# define AVSC_EXPORT EXTERN_C -# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name -#else -# define AVSC_EXPORT EXTERN_C __declspec(dllexport) -# ifndef AVSC_NO_DECLSPEC -#define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name -# else -#define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func) -# endif -#endif - -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - - -/ -// -// Constants -// - -#ifndef __AVXSYNTH_H__ -enum { AVISYNTH_INTERFACE_VERSION = 3 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1, - AVS_SAMPLE_INT24 = 1<<2, - AVS_SAMPLE_INT32 = 1<<3, - AVS_SAMPLE_FLOAT = 1<<4}; - -enum {AVS_PLANAR_Y=1<<0, - AVS_PLANAR_U=1<<1, - AVS_PLANAR_V=1<<2, - AVS_PLANAR_ALIGNED=1<<3, - AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED, - AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED, - AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED}; - - // Colorspace properties. -enum {AVS_CS_BGR = 1<<28, - AVS_CS_YUV = 1<<29, - AVS_CS_INTERLEAVED = 1<<30, - AVS_CS_PLANAR = 1<<31}; - - // Specific colorformats -enum { - AVS_CS_UNKNOWN = 0, - AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, - AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar - AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar - AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above -}; - -enum { - AVS_IT_BFF = 1<<0, - AVS_IT_TFF = 1<<1, - AVS_IT_FIELDBASED = 1<<2}; - -enum { - AVS_FILTER_TYPE=1, - AVS_FILTER_INPUT_COLORSPACE=2, - AVS_FILTER_OUTPUT_TYPE=9, - AVS_FILTER_NAME=4, - AVS_FILTER_AUTHOR=5, - AVS_FILTER_VERSION=6, - AVS_FILTER_ARGS=7, - AVS_FILTER_ARGS_INFO=8, - AVS_FILTER_ARGS_DESCRIPTION=10, - AVS_FILTER_DESCRIPTION=11}; - -enum { //SUBTYPES - AVS_FILTER_TYPE_AUDIO=1, - AVS_FILTER_TYPE_VIDEO=2, - AVS_FILTER_OUTPUT_TYPE_SAME=3, -
[FFmpeg-devel] [PATCH 1/5] compat/avisynth: update headers
AviSynth+ can now be used on Linux, which required some changes to the headers. As part of this, and to not cause issues with adding a new header, correct the header inclusion guards to make FATE happy. --- compat/avisynth/avisynth_c.h | 30 ++ compat/avisynth/avs/capi.h | 22 ++- compat/avisynth/avs/config.h | 52 +--- compat/avisynth/avs/posix.h | 111 +++ compat/avisynth/avs/types.h | 19 +++--- tests/ref/fate/source| 4 -- 6 files changed, 197 insertions(+), 41 deletions(-) create mode 100644 compat/avisynth/avs/posix.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h index 9ff9321552..d30d7caca9 100644 --- a/compat/avisynth/avisynth_c.h +++ b/compat/avisynth/avisynth_c.h @@ -51,8 +51,8 @@ // Example#2: avs_bits_per_component will return 8 for all colorspaces (Classic Avisynth supports only 8 bits/pixel) // Thus the Avisynth+ specific API functions are safely callable even when connected to classic Avisynth DLL -#ifndef __AVISYNTH_C__ -#define __AVISYNTH_C__ +#ifndef COMPAT_AVISYNTH_AVISYNTH_C_H +#define COMPAT_AVISYNTH_AVISYNTH_C_H #include "avs/config.h" #include "avs/capi.h" @@ -341,7 +341,7 @@ typedef struct AVS_VideoInfo { int audio_samples_per_second; // 0 means no audio int sample_type; - INT64 num_audio_samples; + int64_t num_audio_samples; int nchannels; // Image type properties @@ -444,16 +444,16 @@ AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) { return p->nchannels*avs_bytes_per_channel_sample(p);} -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) -{ return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } +AVSC_INLINE int64_t avs_audio_samples_from_frames(const AVS_VideoInfo * p, int64_t frames) +{ return ((int64_t)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) -{ return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } +AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) +{ return (int)(samples * (int64_t)p->fps_numerator / (int64_t)p->fps_denominator / (int64_t)p->audio_samples_per_second); } -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) +AVSC_INLINE int64_t avs_audio_samples_from_bytes(const AVS_VideoInfo * p, int64_t bytes) { return bytes / avs_bytes_per_audio_sample(p); } -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) +AVSC_INLINE int64_t avs_bytes_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) { return samples * avs_bytes_per_audio_sample(p); } AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) @@ -764,7 +764,7 @@ AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); // return field parity if field_based, else parity of first field in frame AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); // start and count are in samples AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, @@ -784,7 +784,7 @@ struct AVS_FilterInfo AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, int frame_range); void (AVSC_CC * free_filter)(AVS_FilterInfo *); @@ -933,6 +933,8 @@ AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); // The returned video frame must be be released +#if defined(AVS_WINDOWS) +// The following stuff is only relevant for Windows DLL handling; Linux does it completely differently. #ifdef AVSC_NO_DECLSPEC // This part uses LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport) // When AVSC_NO_DECLSPEC is defined, you can use avs_load_library to populate API functions into a struct @@ -944,7 +946,7 @@ AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_Vid void* malloc(size_t) void free(void*); - HMODULE LoadLibrary(const char*); + HMODULE LoadLibraryA(const char*); void*
[FFmpeg-devel] [PATCH 3/5] compat/avisynth: remove AvxSynth headers
--- compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 -- 3 files changed, 890 deletions(-) delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avxsynth_c.h b/compat/avisynth/avxsynth_c.h deleted file mode 100644 index 991f4be1ab..00 --- a/compat/avisynth/avxsynth_c.h +++ /dev/null @@ -1,728 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 USA, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -#ifndef __AVXSYNTH_C__ -#define __AVXSYNTH_C__ - -#include "windowsPorts/windows2linux.h" -#include - -#ifdef __cplusplus -# define EXTERN_C extern "C" -#else -# define EXTERN_C -#endif - -#define AVSC_USE_STDCALL 1 - -#ifndef AVSC_USE_STDCALL -# define AVSC_CC __cdecl -#else -# define AVSC_CC __stdcall -#endif - -#define AVSC_INLINE static __inline - -#ifdef AVISYNTH_C_EXPORTS -# define AVSC_EXPORT EXTERN_C -# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name -#else -# define AVSC_EXPORT EXTERN_C __declspec(dllexport) -# ifndef AVSC_NO_DECLSPEC -#define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name -# else -#define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func) -# endif -#endif - -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - - -/ -// -// Constants -// - -#ifndef __AVXSYNTH_H__ -enum { AVISYNTH_INTERFACE_VERSION = 3 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1, - AVS_SAMPLE_INT24 = 1<<2, - AVS_SAMPLE_INT32 = 1<<3, - AVS_SAMPLE_FLOAT = 1<<4}; - -enum {AVS_PLANAR_Y=1<<0, - AVS_PLANAR_U=1<<1, - AVS_PLANAR_V=1<<2, - AVS_PLANAR_ALIGNED=1<<3, - AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED, - AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED, - AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED}; - - // Colorspace properties. -enum {AVS_CS_BGR = 1<<28, - AVS_CS_YUV = 1<<29, - AVS_CS_INTERLEAVED = 1<<30, - AVS_CS_PLANAR = 1<<31}; - - // Specific colorformats -enum { - AVS_CS_UNKNOWN = 0, - AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, - AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar - AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar - AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above -}; - -enum { - AVS_IT_BFF = 1<<0, - AVS_IT_TFF = 1<<1, - AVS_IT_FIELDBASED = 1<<2}; - -enum { - AVS_FILTER_TYPE=1, - AVS_FILTER_INPUT_COLORSPACE=2, - AVS_FILTER_OUTPUT_TYPE=9, - AVS_FILTER_NAME=4, - AVS_FILTER_AUTHOR=5, - AVS_FILTER_VERSION=6, - AVS_FILTER_ARGS=7, - AVS_FILTER_ARGS_INFO=8, - AVS_FILTER_ARGS_DESCRIPTION=10, - AVS_FILTER_DESCRIPTION=11}; - -enum { //SUBTYPES - AVS_FILTER_TYPE_AUDIO=1, - AVS_FILTER_TYPE_VIDEO=2, - AVS_FILTER_OUTPUT_TYPE_SAME=3, - AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4}; - -enum { - AVS_CACHE_NOTHING=0, -
[FFmpeg-devel] [PATCH 2/5] avisynth: switch to AviSynth+ on Linux
AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++--- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..1970553e49 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include "compat/avisynth/avisynth_c.h" + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3]= { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3]= { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif -/* AviSynth 2.5 and AvxSynth pix_fmts */ +/* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_grey; @@ -556,7 +545,7 @@ static int avisynth_open_file(AVFormatContext *s) AviSynthContext *avs = s->priv_data; AVS_Value arg, val; int ret; -#ifdef USING_AVISYNTH +#ifdef _WIN32 char filename_ansi[MAX_PATH * 4]; wchar_t
[FFmpeg-devel] [PATCH 5/5] avisynth: fix deprecation warning
--- libavformat/avisynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1970553e49..f3e8df933f 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,7 +555,7 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ -MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); +MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi); -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/5] compat/avisynth: update headers
AviSynth+ can now be used on Linux, which required some changes to the headers. --- compat/avisynth/avisynth_c.h | 24 compat/avisynth/avs/capi.h | 16 + compat/avisynth/avs/config.h | 46 +-- compat/avisynth/avs/posix.h | 111 +++ compat/avisynth/avs/types.h | 13 ++-- 5 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 compat/avisynth/avs/posix.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h index 9ff9321552..03c3530ca9 100644 --- a/compat/avisynth/avisynth_c.h +++ b/compat/avisynth/avisynth_c.h @@ -341,7 +341,7 @@ typedef struct AVS_VideoInfo { int audio_samples_per_second; // 0 means no audio int sample_type; - INT64 num_audio_samples; + int64_t num_audio_samples; int nchannels; // Image type properties @@ -444,16 +444,16 @@ AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) { return p->nchannels*avs_bytes_per_channel_sample(p);} -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) -{ return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } +AVSC_INLINE int64_t avs_audio_samples_from_frames(const AVS_VideoInfo * p, int64_t frames) +{ return ((int64_t)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) -{ return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } +AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) +{ return (int)(samples * (int64_t)p->fps_numerator / (int64_t)p->fps_denominator / (int64_t)p->audio_samples_per_second); } -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) +AVSC_INLINE int64_t avs_audio_samples_from_bytes(const AVS_VideoInfo * p, int64_t bytes) { return bytes / avs_bytes_per_audio_sample(p); } -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) +AVSC_INLINE int64_t avs_bytes_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) { return samples * avs_bytes_per_audio_sample(p); } AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) @@ -764,7 +764,7 @@ AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); // return field parity if field_based, else parity of first field in frame AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); // start and count are in samples AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, @@ -784,7 +784,7 @@ struct AVS_FilterInfo AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, int frame_range); void (AVSC_CC * free_filter)(AVS_FilterInfo *); @@ -933,6 +933,8 @@ AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); // The returned video frame must be be released +#if defined(AVS_WINDOWS) +// The following stuff is only relevant for Windows DLL handling; Linux does it completely differently. #ifdef AVSC_NO_DECLSPEC // This part uses LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport) // When AVSC_NO_DECLSPEC is defined, you can use avs_load_library to populate API functions into a struct @@ -944,7 +946,7 @@ AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_Vid void* malloc(size_t) void free(void*); - HMODULE LoadLibrary(const char*); + HMODULE LoadLibraryA(const char*); void* GetProcAddress(HMODULE, const char*); FreeLibrary(HMODULE); */ @@ -1261,4 +1263,6 @@ AVSC_INLINE void avs_free_library(AVS_Library *library) { } #endif +#endif // AVS_WINDOWS + #endif diff --git a/compat/avisynth/avs/capi.h b/compat/avisynth/avs/capi.h index 8799bf1fbb..4e31a5de48 100644 --- a/compat/avisynth/avs/capi.h +++ b/compat/avisynth/avs/capi.h @@ -33,12 +33,20 @@ #ifndef AVS_CAPI_H #define AVS_CAPI_H +#include "config.h" + +#ifdef AVS_POSIX +// this is also defined in avs/posix.h +#define __declspec(x) +#endif + #ifdef __cplusplus # define EXTERN_C extern "C" #else # define EXTERN_C
[FFmpeg-devel] [PATCH 0/5] Switch from AvxSynth to AviSynth+ on non-Windows
Since there were no responses to my question about whether we should use a warning message about AvxSynth's deprecation before switching over at a later time, or to just do the switch immediately, I've gone ahead and sent just the switchover patch. Stephen Hutchinson (5): compat/avisynth: update headers avisynth: switch to AviSynth+ on Linux compat/avisynth: remove AvxSynth headers doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone. avisynth: fix deprecation warning compat/avisynth/avisynth_c.h | 24 +- compat/avisynth/avs/capi.h| 16 + compat/avisynth/avs/config.h | 46 +- compat/avisynth/avs/posix.h | 111 +++ compat/avisynth/avs/types.h | 13 +- compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 -- doc/general.texi | 8 +- libavformat/avisynth.c| 58 +- 10 files changed, 205 insertions(+), 961 deletions(-) create mode 100644 compat/avisynth/avs/posix.h delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/5] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone.
--- doc/general.texi | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 87eaad7791..e92de9d954 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -58,8 +58,8 @@ For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux and OS X, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,9 +77,9 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be +end user having AviSynth installed - they'll only need to be installed to use AviSynth scripts (obviously). @end float -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] libavformat/avisynth: AvxSynth deprecation and switch to AviSynth+
With the release of version 3.5 earlier this evening, AviSynth+ can now be built and used natively on the same platforms AvxSynth could, making AvxSynth completely obsolete. Due to that, is there a preference for how we should handle this? I have two different patchsets ready to send. The first simply adds a warning message that AvxSynth is deprecated and urges the user to upgrade to AviSynth+ 3.5 or higher. The actual switch would then probably occur after the message has been visible for one or two releases of FFmpeg. The second just up and removes the AvxSynth-specific branching and streamlines the demuxer so that it assumes only AviSynth(+) is being used at all times, with the USING_AVISYNTH checks reverted back to simple _WIN32 at the spots it's still necessary to compensate for platform differences. On the one hand, it would be kind of rude to apply the second patchset with no advance warning to users that AvxSynth will suddenly cease to work. But on the other hand, AvxSynth itself is such a dead project at this point that the demuxer was always lopsided in favor of Windows and the vast majority of users probably aren't/weren't even aware AvxSynth existed, let alone that FFmpeg could use it (I still see people calling the ability to open AviSynth scripts a Windows-only feature, even though it's been possible on Linux, et al., with AvxSynth for the last 7-7.5 years, with FFmpeg and x264 both gaining the ability to use it in February/March 2013). ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] compat/avisynth: Fix unicode compilation.
On 12/30/2019 11:11 AM, Matt Oliver wrote: --- compat/avisynth/avisynth_c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h index 8d17125adc..9ff9321552 100644 --- a/compat/avisynth/avisynth_c.h +++ b/compat/avisynth/avisynth_c.h @@ -1096,7 +1096,7 @@ AVSC_INLINE AVS_Library * avs_load_library() { AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library)); if (library == NULL) return NULL; - library->handle = LoadLibrary("avisynth"); + library->handle = LoadLibraryA("avisynth"); if (library->handle == NULL) goto fail; -- LGTM. How are you compiling FFmpeg as unicode in order to expose the issue, though? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/5] doc/general.texi: remove note about regressed AviSynth+ header
On 5/3/2019 12:45 PM, Gyan wrote: On 3/30/2019 7:39 PM, Stephen Hutchinson wrote: I've uploaded the amended 1st patch and added a 6th to deal with the issues I encountered when testing the 'build FFmpeg with MSVC' route. Since git send-email (or Gmail) screwed up the threading when I sent these the first time, this is the proper order: http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241922.html <-fixed header update patch http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241502.html <-enabling the additional pix_fmts; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241507.html <-removing the header warning in the docs; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241504.html <-updating the project link to point to the AviSynth wiki page on AviSynth+; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241505.html <-usage note about 32-bit GCC builds of AviSynth+ and the AVSC_WIN32_GCC32 switch; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241923.html <-new (well, technically old) patch to fix FARPROC warnings/build errors Will apply #3, 4 and 5 with #6. #2 looks okay to me, but I'm not acquainted enowith Avisynth to ok it. But since you're the maintainer for avisynth.c, do you want me to push them? Gyan Yes, go ahead and push all six patches. #2 is just a simple, direct mapping of those pix_fmts in AviSynth+ to the equivalent ones provided by FFmpeg/libavutil. The longer explanation about #2 is here: http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241520.html You didn't mention #1, but #5 (and to a far, far, far lesser extent, #3) don't make much sense without #1 getting applied. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/5] doc/general.texi: remove note about regressed AviSynth+ header
On 3/30/2019 7:39 PM, Stephen Hutchinson wrote: I've uploaded the amended 1st patch and added a 6th to deal with the issues I encountered when testing the 'build FFmpeg with MSVC' route. Since git send-email (or Gmail) screwed up the threading when I sent these the first time, this is the proper order: http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241922.html <-fixed header update patch http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241502.html <-enabling the additional pix_fmts; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241507.html <-removing the header warning in the docs; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241504.html <-updating the project link to point to the AviSynth wiki page on AviSynth+; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241505.html <-usage note about 32-bit GCC builds of AviSynth+ and the AVSC_WIN32_GCC32 switch; nothing has changed on this one http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241923.html <-new (well, technically old) patch to fix FARPROC warnings/build errors Ping #1 for five of the six patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] doc/general.texi: add note about 32-bit GCC builds of AviSynth+
On 3/31/2019 8:12 PM, Stephen Hutchinson wrote: --- The text has been updated to reflect that 32-bit builds of FFmpeg in general don't default to AviSynth+GCC compatibility. doc/general.texi | 15 +++ 1 file changed, 15 insertions(+) diff --git a/doc/general.texi b/doc/general.texi index bafa1e2ea2..6c1acb517c 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -51,6 +51,21 @@ For Windows, supported AviSynth variants are For Linux and OS X, the supported AviSynth variant is @url{https://github.com/avxsynth/avxsynth, AvxSynth}. +@float NOTE +In 2016, AviSynth+ added support for building with GCC. However, due to +the eccentricities of Windows' calling conventions, 32-bit GCC builds +of AviSynth+ are not compatible with typical 32-bit builds of FFmpeg. + +By default, FFmpeg assumes compatibility with 32-bit MSVC builds of +AviSynth+ since that is the most widely-used and entrenched build +configuration. Users can override this and enable support for 32-bit +GCC builds of AviSynth+ by passing @code{-DAVSC_WIN32_GCC32} to +@code{--extra-cflags} when configuring FFmpeg. + +64-bit builds of FFmpeg are not affected, and can use either MSVC or +GCC builds of AviSynth+ without any special flags. +@end float + @float NOTE AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg with @code{--enable-avisynth}, and the binaries will work regardless of the Ping #2 for the sixth of the six patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] doc/general.texi: add note about 32-bit GCC builds of AviSynth+
--- The text has been updated to reflect that 32-bit builds of FFmpeg in general don't default to AviSynth+GCC compatibility. doc/general.texi | 15 +++ 1 file changed, 15 insertions(+) diff --git a/doc/general.texi b/doc/general.texi index bafa1e2ea2..6c1acb517c 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -51,6 +51,21 @@ For Windows, supported AviSynth variants are For Linux and OS X, the supported AviSynth variant is @url{https://github.com/avxsynth/avxsynth, AvxSynth}. +@float NOTE +In 2016, AviSynth+ added support for building with GCC. However, due to +the eccentricities of Windows' calling conventions, 32-bit GCC builds +of AviSynth+ are not compatible with typical 32-bit builds of FFmpeg. + +By default, FFmpeg assumes compatibility with 32-bit MSVC builds of +AviSynth+ since that is the most widely-used and entrenched build +configuration. Users can override this and enable support for 32-bit +GCC builds of AviSynth+ by passing @code{-DAVSC_WIN32_GCC32} to +@code{--extra-cflags} when configuring FFmpeg. + +64-bit builds of FFmpeg are not affected, and can use either MSVC or +GCC builds of AviSynth+ without any special flags. +@end float + @float NOTE AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg with @code{--enable-avisynth}, and the binaries will work regardless of the -- 2.19.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".