Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
@ 2023-10-27  1:43 Dave Johansen
  2023-10-27  2:53 ` Steven Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Johansen @ 2023-10-27  1:43 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Dave Johansen

---
 libavformat/dashenc.c     | 3 ++-
 libavformat/hlsenc.c      | 8 +++++++-
 libavformat/hlsplaylist.c | 5 ++++-
 libavformat/hlsplaylist.h | 2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 96f4a5fbdf..15f700acbc 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1284,7 +1284,8 @@ static int write_manifest(AVFormatContext *s, int final)
                     continue;
                 get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, i);
                 ff_hls_write_audio_rendition(c->m3u8_out, audio_group,
-                                             playlist_file, NULL, i, is_default);
+                                             playlist_file, NULL, i, is_default,
+                                             s->streams[i]->codecpar->ch_layout.nb_channels);
                 max_audio_bitrate = FFMAX(st->codecpar->bit_rate +
                                           os->muxer_overhead, max_audio_bitrate);
                 if (!av_strnstr(audio_codec_str, os->codec_str, sizeof(audio_codec_str))) {
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4ef84c05c1..7dfb8d0a9f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1386,6 +1386,7 @@ static int create_master_playlist(AVFormatContext *s,
     int is_file_proto = proto && !strcmp(proto, "file");
     int use_temp_file = is_file_proto && ((hls->flags & HLS_TEMP_FILE) || hls->master_publish_rate);
     char temp_filename[MAX_URL_SIZE];
+    int nb_channels;
 
     input_vs->m3u8_created = 1;
     if (!hls->master_m3u8_created) {
@@ -1434,8 +1435,13 @@ static int create_master_playlist(AVFormatContext *s,
             av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
             goto fail;
         }
+        nb_channels = 0;
+        for (j = 0; j < vs->nb_streams; j++)
+            if (vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
+                if (vs->streams[j]->codecpar->ch_layout.nb_channels > nb_channels)
+                    nb_channels = vs->streams[j]->codecpar->ch_layout.nb_channels;
 
-        ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, vs->language, i, hls->has_default_key ? vs->is_default : 1);
+        ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, vs->language, i, hls->has_default_key ? vs->is_default : 1, nb_channels);
     }
 
     /* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/
diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
index 2bf05f3c7c..4f35d0388f 100644
--- a/libavformat/hlsplaylist.c
+++ b/libavformat/hlsplaylist.c
@@ -39,7 +39,7 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version)
 
 void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
                                   const char *filename, const char *language,
-                                  int name_id, int is_default)
+                                  int name_id, int is_default, int nb_channels)
 {
     if (!out || !agroup || !filename)
         return;
@@ -49,6 +49,9 @@ void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
     if (language) {
         avio_printf(out, "LANGUAGE=\"%s\",", language);
     }
+    if (nb_channels) {
+        avio_printf(out, "CHANNELS=\"%d\",", nb_channels);
+    }
     avio_printf(out, "URI=\"%s\"\n", filename);
 }
 
diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h
index 1928fe787d..c2744c227c 100644
--- a/libavformat/hlsplaylist.h
+++ b/libavformat/hlsplaylist.h
@@ -38,7 +38,7 @@ typedef enum {
 void ff_hls_write_playlist_version(AVIOContext *out, int version);
 void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
                                   const char *filename, const char *language,
-                                  int name_id, int is_default);
+                                  int name_id, int is_default, int nb_channels);
 void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup,
                                      const char *filename, const char *language,
                                      int name_id, int is_default);
-- 
2.39.2 (Apple Git-143)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-10-27  1:43 [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio Dave Johansen
@ 2023-10-27  2:53 ` Steven Liu
  2023-10-27  4:02   ` David Johansen
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Liu @ 2023-10-27  2:53 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Dave Johansen <davejohansen@gmail.com> 于2023年10月27日周五 09:44写道:
>
> ---
>  libavformat/dashenc.c     | 3 ++-
>  libavformat/hlsenc.c      | 8 +++++++-
>  libavformat/hlsplaylist.c | 5 ++++-
>  libavformat/hlsplaylist.h | 2 +-
>  4 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 96f4a5fbdf..15f700acbc 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -1284,7 +1284,8 @@ static int write_manifest(AVFormatContext *s, int final)
>                      continue;
>                  get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, i);
>                  ff_hls_write_audio_rendition(c->m3u8_out, audio_group,
> -                                             playlist_file, NULL, i, is_default);
> +                                             playlist_file, NULL, i, is_default,
> +                                             s->streams[i]->codecpar->ch_layout.nb_channels);
>                  max_audio_bitrate = FFMAX(st->codecpar->bit_rate +
>                                            os->muxer_overhead, max_audio_bitrate);
>                  if (!av_strnstr(audio_codec_str, os->codec_str, sizeof(audio_codec_str))) {
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 4ef84c05c1..7dfb8d0a9f 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1386,6 +1386,7 @@ static int create_master_playlist(AVFormatContext *s,
>      int is_file_proto = proto && !strcmp(proto, "file");
>      int use_temp_file = is_file_proto && ((hls->flags & HLS_TEMP_FILE) || hls->master_publish_rate);
>      char temp_filename[MAX_URL_SIZE];
> +    int nb_channels;
>
>      input_vs->m3u8_created = 1;
>      if (!hls->master_m3u8_created) {
> @@ -1434,8 +1435,13 @@ static int create_master_playlist(AVFormatContext *s,
>              av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n");
>              goto fail;
>          }
> +        nb_channels = 0;
> +        for (j = 0; j < vs->nb_streams; j++)
> +            if (vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
> +                if (vs->streams[j]->codecpar->ch_layout.nb_channels > nb_channels)
> +                    nb_channels = vs->streams[j]->codecpar->ch_layout.nb_channels;
>
> -        ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, vs->language, i, hls->has_default_key ? vs->is_default : 1);
> +        ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, vs->language, i, hls->has_default_key ? vs->is_default : 1, nb_channels);
>      }
>
>      /* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/
> diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
> index 2bf05f3c7c..4f35d0388f 100644
> --- a/libavformat/hlsplaylist.c
> +++ b/libavformat/hlsplaylist.c
> @@ -39,7 +39,7 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version)
>
>  void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
>                                    const char *filename, const char *language,
> -                                  int name_id, int is_default)
> +                                  int name_id, int is_default, int nb_channels)
>  {
>      if (!out || !agroup || !filename)
>          return;
> @@ -49,6 +49,9 @@ void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
>      if (language) {
>          avio_printf(out, "LANGUAGE=\"%s\",", language);
>      }
> +    if (nb_channels) {
> +        avio_printf(out, "CHANNELS=\"%d\",", nb_channels);
> +    }
>      avio_printf(out, "URI=\"%s\"\n", filename);
>  }
>
> diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h
> index 1928fe787d..c2744c227c 100644
> --- a/libavformat/hlsplaylist.h
> +++ b/libavformat/hlsplaylist.h
> @@ -38,7 +38,7 @@ typedef enum {
>  void ff_hls_write_playlist_version(AVIOContext *out, int version);
>  void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
>                                    const char *filename, const char *language,
> -                                  int name_id, int is_default);
> +                                  int name_id, int is_default, int nb_channels);
>  void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup,
>                                       const char *filename, const char *language,
>                                       int name_id, int is_default);
> --
> 2.39.2 (Apple Git-143)
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

LGTM


Thanks
Steven
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-10-27  2:53 ` Steven Liu
@ 2023-10-27  4:02   ` David Johansen
  2023-10-27  7:32     ` Steven Liu
  0 siblings, 1 reply; 8+ messages in thread
From: David Johansen @ 2023-10-27  4:02 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

>
> LGTM
>
>
> Thanks
> Steven
>

I'm new to ffmpeg development so what's the process for this to be merged?
Do I need to do something or is it taken care of by a different
process/someone else?

Thanks,
Dave
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-10-27  4:02   ` David Johansen
@ 2023-10-27  7:32     ` Steven Liu
  2023-10-27 20:18       ` David Johansen
  2023-11-08 23:47       ` David Johansen
  0 siblings, 2 replies; 8+ messages in thread
From: Steven Liu @ 2023-10-27  7:32 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

David Johansen <davejohansen@gmail.com> 于2023年10月27日周五 12:03写道:
>
> >
> > LGTM
> >
> >
> > Thanks
> > Steven
> >
>
> I'm new to ffmpeg development so what's the process for this to be merged?
> Do I need to do something or is it taken care of by a different
> process/someone else?

Nothing, just leave enough time for more developers review, and will
push this if no more comments.
Don't worry David, this is valuable patch, you did a great job.
>
> Thanks,
> Dave
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks
Steven
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-10-27  7:32     ` Steven Liu
@ 2023-10-27 20:18       ` David Johansen
  2023-11-08 23:47       ` David Johansen
  1 sibling, 0 replies; 8+ messages in thread
From: David Johansen @ 2023-10-27 20:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Oct 27, 2023 at 1:33 AM Steven Liu <lingjiujianke@gmail.com> wrote:

> David Johansen <davejohansen@gmail.com> 于2023年10月27日周五 12:03写道:
> >
> > >
> > > LGTM
> > >
> > >
> > > Thanks
> > > Steven
> > >
> >
> > I'm new to ffmpeg development so what's the process for this to be
> merged?
> > Do I need to do something or is it taken care of by a different
> > process/someone else?
>
> Nothing, just leave enough time for more developers review, and will
> push this if no more comments.
> Don't worry David, this is valuable patch, you did a great job.
>

Great! Just wanted to make sure I was doing everything needed to get it
merged in.
Thanks,
Dave
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-10-27  7:32     ` Steven Liu
  2023-10-27 20:18       ` David Johansen
@ 2023-11-08 23:47       ` David Johansen
  2023-11-09  1:37         ` Steven Liu
  1 sibling, 1 reply; 8+ messages in thread
From: David Johansen @ 2023-11-08 23:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Oct 27, 2023 at 1:33 AM Steven Liu <lingjiujianke@gmail.com> wrote:

> David Johansen <davejohansen@gmail.com> 于2023年10月27日周五 12:03写道:
> >
> > >
> > > LGTM
> > >
> > >
> > > Thanks
> > > Steven
> > >
> >
> > I'm new to ffmpeg development so what's the process for this to be
> merged?
> > Do I need to do something or is it taken care of by a different
> > process/someone else?
>
> Nothing, just leave enough time for more developers review, and will
> push this if no more comments.
> Don't worry David, this is valuable patch, you did a great job.
>

I submitted a handful of patches and I believe I've addressed all of
the feedback I've seen, so is there anything I need to do to follow up on
them and get them merged?

Thanks,
Dave
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-11-08 23:47       ` David Johansen
@ 2023-11-09  1:37         ` Steven Liu
  2023-12-28 22:49           ` David Johansen
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Liu @ 2023-11-09  1:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

David Johansen <davejohansen@gmail.com> 于2023年11月9日周四 07:47写道:
>
> On Fri, Oct 27, 2023 at 1:33 AM Steven Liu <lingjiujianke@gmail.com> wrote:
>
> > David Johansen <davejohansen@gmail.com> 于2023年10月27日周五 12:03写道:
> > >
> > > >
> > > > LGTM
> > > >
> > > >
> > > > Thanks
> > > > Steven
> > > >
> > >
> > > I'm new to ffmpeg development so what's the process for this to be
> > merged?
> > > Do I need to do something or is it taken care of by a different
> > > process/someone else?
> >
> > Nothing, just leave enough time for more developers review, and will
> > push this if no more comments.
> > Don't worry David, this is valuable patch, you did a great job.
> >
>
> I submitted a handful of patches and I believe I've addressed all of
> the feedback I've seen, so is there anything I need to do to follow up on
> them and get them merged?
Will apply this patch after 24 hours if there have no more comments.
>
> Thanks,
> Dave

Thanks
Steven
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
  2023-11-09  1:37         ` Steven Liu
@ 2023-12-28 22:49           ` David Johansen
  0 siblings, 0 replies; 8+ messages in thread
From: David Johansen @ 2023-12-28 22:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Wed, Nov 8, 2023 at 6:38 PM Steven Liu <lingjiujianke@gmail.com> wrote:

> David Johansen <davejohansen@gmail.com> 于2023年11月9日周四 07:47写道:
> >
> > On Fri, Oct 27, 2023 at 1:33 AM Steven Liu <lingjiujianke@gmail.com>
> wrote:
> >
> > > David Johansen <davejohansen@gmail.com> 于2023年10月27日周五 12:03写道:
> > > >
> > > > >
> > > > > LGTM
> > > > >
> > > > >
> > > > > Thanks
> > > > > Steven
> > > > >
> > > >
> > > > I'm new to ffmpeg development so what's the process for this to be
> > > merged?
> > > > Do I need to do something or is it taken care of by a different
> > > > process/someone else?
> > >
> > > Nothing, just leave enough time for more developers review, and will
> > > push this if no more comments.
> > > Don't worry David, this is valuable patch, you did a great job.
> > >
> >
> > I submitted a handful of patches and I believe I've addressed all of
> > the feedback I've seen, so is there anything I need to do to follow up on
> > them and get them merged?
> Will apply this patch after 24 hours if there have no more comments.
>

Thanks for applying this patch. I submitted a handful of other patches for
HLS so can those be merged as well?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-28 22:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-27  1:43 [FFmpeg-devel] [PATCH] avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio Dave Johansen
2023-10-27  2:53 ` Steven Liu
2023-10-27  4:02   ` David Johansen
2023-10-27  7:32     ` Steven Liu
2023-10-27 20:18       ` David Johansen
2023-11-08 23:47       ` David Johansen
2023-11-09  1:37         ` Steven Liu
2023-12-28 22:49           ` David Johansen

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git