Re: [FFmpeg-devel] [PATCH 1/2] avisynth: pass audio channel layout

2023-07-19 Thread Stephen Hutchinson

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 1/2] avisynth: pass audio channel layout

2023-07-15 Thread Stephen Hutchinson
---
 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".