mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 08:42:39 +00:00
avformat/hlsenc: Modularized audio rendition playlist write to allow reuse
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
d01eeef4a2
commit
9e25fe4204
@ -1169,10 +1169,8 @@ static int create_master_playlist(AVFormatContext *s,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
avio_printf(hls->m3u8_out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"",
|
ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name);
|
||||||
vs->agroup);
|
|
||||||
avio_printf(hls->m3u8_out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n",
|
|
||||||
m3u8_rel_name);
|
|
||||||
av_freep(&m3u8_rel_name);
|
av_freep(&m3u8_rel_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,15 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) {
|
|||||||
avio_printf(out, "#EXT-X-VERSION:%d\n", version);
|
avio_printf(out, "#EXT-X-VERSION:%d\n", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
|
||||||
|
char *filename) {
|
||||||
|
if (!out || !agroup || !filename)
|
||||||
|
return;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
if (!out || !filename)
|
if (!out || !filename)
|
||||||
|
@ -37,6 +37,7 @@ 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_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,
|
||||||
|
Loading…
Reference in New Issue
Block a user