[FFmpeg-devel] [PATCH] avformat/hlsenc: support fmp4 single file mode
Derek Buitenhuis
derek.buitenhuis at gmail.com
Tue Aug 1 15:41:24 EEST 2017
On 7/31/2017 5:03 AM, Steven Liu wrote:
> add byterange mode of the hls fmp4
>
> Signed-off-by: Steven Liu <lq at onvideo.cn>
> ---
> libavformat/hlsenc.c | 72 ++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 44 insertions(+), 28 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index f98f041..cfc28d2 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -531,6 +531,7 @@ static int hls_mux_init(AVFormatContext *s)
> HLSContext *hls = s->priv_data;
> AVFormatContext *oc;
> AVFormatContext *vtt_oc = NULL;
> + int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
Not quite sure I understand the '|| (hls->max_seg_size > 0)' part. Is there ever a time
that byte range mode is used with more than one file, allowed by the spec?
> if (hls->segment_type == SEGMENT_TYPE_FMP4) {
> - hls->fmp4_init_mode = 1;
> + if (byterange_mode) {
> + hls->fmp4_init_mode = 0;
> + } else {
> + hls->fmp4_init_mode = 1;
> + }
hls->fmp4_init_mode = !byterange_mode;
> if(hls->has_subtitle) {
> -
> if (hls->flags & HLS_SINGLE_FILE)
Accidental white space change.
> + if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type == SEGMENT_TYPE_FMP4)) {
> + hls->fmp4_init_filename = av_strdup(hls->basename);
Missing NULL check.
- Derek
More information about the ffmpeg-devel
mailing list