2017-11-29 11:44:15 +00:00
|
|
|
/*
|
|
|
|
* Apple HTTP Live Streaming segmenter
|
|
|
|
* Copyright (c) 2012, Luca Barbato
|
|
|
|
* Copyright (c) 2017 Akamai Technologies, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2017-11-29 16:02:37 +00:00
|
|
|
#ifndef AVFORMAT_HLSPLAYLIST_H
|
|
|
|
#define AVFORMAT_HLSPLAYLIST_H
|
2017-11-29 11:44:15 +00:00
|
|
|
|
2017-11-29 16:09:23 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "avformat.h"
|
|
|
|
#include "avio.h"
|
2017-11-29 11:44:15 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PLAYLIST_TYPE_NONE,
|
|
|
|
PLAYLIST_TYPE_EVENT,
|
|
|
|
PLAYLIST_TYPE_VOD,
|
|
|
|
PLAYLIST_TYPE_NB,
|
|
|
|
} PlaylistType;
|
|
|
|
|
|
|
|
void ff_hls_write_playlist_version(AVIOContext *out, int version);
|
2020-05-25 17:11:34 +00:00
|
|
|
void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
|
|
|
|
const char *filename, const char *language,
|
2023-10-27 01:43:59 +00:00
|
|
|
int name_id, int is_default, int nb_channels);
|
2020-05-25 17:11:34 +00:00
|
|
|
void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup,
|
|
|
|
const char *filename, const char *language,
|
|
|
|
int name_id, int is_default);
|
|
|
|
void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth,
|
hlsenc: Calculate the average and actual maximum bitrate of segments
Previously, the bitrate advertised in the master playlist would only
be based on the nominal values in either AVCodecParameters bit_rate,
or via AVCPBProperties max_bitrate. On top of this, a
fudge factor of 10% is added, to account for container overhead.
Neither of these bitrates may be known, and if the encoder is
running in VBR mode, there is no such value to be known. And
the container overhead may be more or less than the given
constant factor of 10%.
Instead, calculate the maximum bitrate per segment based on
what actually gets output from the muxer, and average bitrate
across all segments.
When muxing of the file finishes, update the master playlist
with these values, exposing both the maximum (which previously
was a guesstimate based on the nominal values) via
EXT-X-STREAM-INF BANDWIDTH, and the average via
EXT-X-STREAM-INF AVERAGE-BANDWIDTH.
This makes it possible to use the hlsenc muxer with VBR
encodes, for VOD style muxing.
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-20 13:36:46 +00:00
|
|
|
int avg_bandwidth,
|
2020-05-25 17:11:34 +00:00
|
|
|
const char *filename, const char *agroup,
|
|
|
|
const char *codecs, const char *ccgroup,
|
|
|
|
const char *sgroup);
|
2017-11-29 11:44:15 +00:00
|
|
|
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
|
|
|
|
int target_duration, int64_t sequence,
|
2019-06-02 14:03:17 +00:00
|
|
|
uint32_t playlist_type, int iframe_mode);
|
2020-05-25 17:11:34 +00:00
|
|
|
void ff_hls_write_init_file(AVIOContext *out, const char *filename,
|
2017-11-29 11:44:15 +00:00
|
|
|
int byterange_mode, int64_t size, int64_t pos);
|
2017-12-04 04:03:37 +00:00
|
|
|
int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
|
2020-05-25 18:33:40 +00:00
|
|
|
int byterange_mode, double duration,
|
|
|
|
int round_duration, int64_t size,
|
|
|
|
int64_t pos /* Used only if HLS_SINGLE_FILE flag is set */,
|
2020-05-25 17:11:34 +00:00
|
|
|
const char *baseurl /* Ignored if NULL */,
|
|
|
|
const char *filename, double *prog_date_time,
|
2020-05-25 18:33:40 +00:00
|
|
|
int64_t video_keyframe_size, int64_t video_keyframe_pos,
|
|
|
|
int iframe_mode);
|
2017-11-29 11:44:15 +00:00
|
|
|
void ff_hls_write_end_list (AVIOContext *out);
|
|
|
|
|
|
|
|
#endif /* AVFORMAT_HLSPLAYLIST_H_ */
|