133 int target_duration = 0;
141 for (en = hls->
list; en; en = en->
next) {
148 avio_printf(hls->
pb,
"#EXT-X-TARGETDURATION:%d\n", target_duration);
149 avio_printf(hls->
pb,
"#EXT-X-MEDIA-SEQUENCE:%"PRId64
"\n", sequence);
154 for (en = hls->
list; en; en = en->
next) {
195 const char *pattern =
"%d.ts";
196 int basename_size = strlen(s->
filename) + strlen(pattern) + 1;
208 "More than a single video stream present, " 209 "expect issues decoding it.\n");
259 int ret, can_split = 1;
321 #define OFFSET(x) offsetof(HLSContext, x) 322 #define E AV_OPT_FLAG_ENCODING_PARAM 343 .extensions =
"m3u8",
351 .priv_class = &hls_class,
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
static int hls_write_trailer(struct AVFormatContext *s)
int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
#define AVIO_FLAG_WRITE
write-only
static int append_entry(HLSContext *hls, uint64_t duration)
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
Copy the settings of the source AVCodecContext into the destination AVCodecContext.
static int hls_window(AVFormatContext *s, int last)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const char * av_basename(const char *path)
Thread safe basename.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
#define AV_LOG_VERBOSE
Detailed information.
struct AVOutputFormat * oformat
The output container format.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static const AVOption options[]
static int hls_write_header(AVFormatContext *s)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
void av_log(void *avcl, int level, const char *fmt,...)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
int flags
A combination of AV_PKT_FLAG values.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare 2 timestamps each in its own timebases.
AVCodecContext * codec
Codec context associated with this stream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static void free_entries(HLSContext *hls)
char filename[1024]
input or output filename
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_TIME_BASE
Internal time base represented as integer.
static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
Return in 'buf' the path with 'd' replaced by a number.
if(ac->has_optimized_func)
enum AVMediaType codec_type
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
AVIOContext * pb
I/O context.
Describe the class of an AVClass context structure.
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
static int hls_mux_init(AVFormatContext *s)
static int hls_start(AVFormatContext *s)
void * priv_data
Format private data.
static const uint8_t start_sequence[]
static void write_header(FFV1Context *f)
AVOutputFormat ff_hls_muxer
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
#define AVERROR_MUXER_NOT_FOUND
Muxer not found.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
static const AVClass hls_class
This structure stores compressed data.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2