Commit 8fd2bdd0 authored by Karthick Jeyapal's avatar Karthick Jeyapal Committed by Steven Liu

avformat/hlsplaylist: Audio rendition's name and defaultness made configurable

Reviewed-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
parent 9e25fe42
...@@ -1169,7 +1169,7 @@ static int create_master_playlist(AVFormatContext *s, ...@@ -1169,7 +1169,7 @@ static int create_master_playlist(AVFormatContext *s,
goto fail; goto fail;
} }
ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name); ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, 0, 1);
av_freep(&m3u8_rel_name); av_freep(&m3u8_rel_name);
} }
......
...@@ -36,12 +36,13 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) { ...@@ -36,12 +36,13 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) {
} }
void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
char *filename) { char *filename, int name_id, int is_default) {
if (!out || !agroup || !filename) if (!out || !agroup || !filename)
return; return;
avio_printf(out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup); avio_printf(out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup);
avio_printf(out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", filename); avio_printf(out, ",NAME=\"audio_%d\",DEFAULT=%s,URI=\"%s\"\n", name_id,
is_default ? "YES" : "NO", filename);
} }
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
......
...@@ -37,7 +37,8 @@ typedef enum { ...@@ -37,7 +37,8 @@ typedef enum {
} PlaylistType; } PlaylistType;
void ff_hls_write_playlist_version(AVIOContext *out, int version); void ff_hls_write_playlist_version(AVIOContext *out, int version);
void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char *filename); void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
char *filename, int name_id, int is_default);
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
int bandwidth, char *filename, char *agroup); int bandwidth, char *filename, char *agroup);
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache, void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment