FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
hlsenc.c File Reference
#include <float.h>
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/log.h"
#include "avformat.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  HLSSegment
 
struct  HLSContext
 

Macros

#define OFFSET(x)   offsetof(HLSContext, x)
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Enumerations

enum  HLSFlags { HLS_SINGLE_FILE = (1 << 0) }
 

Functions

static int hls_mux_init (AVFormatContext *s)
 
static int hls_append_segment (HLSContext *hls, double duration, int64_t pos, int64_t size)
 
static void hls_free_segments (HLSContext *hls)
 
static int hls_window (AVFormatContext *s, int last)
 
static int hls_start (AVFormatContext *s)
 
static int hls_write_header (AVFormatContext *s)
 
static int hls_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int hls_write_trailer (struct AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass hls_class
 
AVOutputFormat ff_hls_muxer
 

Macro Definition Documentation

#define OFFSET (   x)    offsetof(HLSContext, x)

Definition at line 403 of file hlsenc.c.

Definition at line 404 of file hlsenc.c.

Enumeration Type Documentation

enum HLSFlags
Enumerator:
HLS_SINGLE_FILE 

Definition at line 44 of file hlsenc.c.

Function Documentation

static int hls_mux_init ( AVFormatContext s)
static

Definition at line 84 of file hlsenc.c.

Referenced by hls_write_header().

static int hls_append_segment ( HLSContext hls,
double  duration,
int64_t  pos,
int64_t  size 
)
static

Definition at line 114 of file hlsenc.c.

Referenced by hls_write_packet(), and hls_write_trailer().

static void hls_free_segments ( HLSContext hls)
static

Definition at line 148 of file hlsenc.c.

Referenced by hls_write_trailer().

static int hls_window ( AVFormatContext s,
int  last 
)
static

Definition at line 159 of file hlsenc.c.

Referenced by hls_write_packet(), and hls_write_trailer().

static int hls_start ( AVFormatContext s)
static

Definition at line 206 of file hlsenc.c.

Referenced by hls_write_header(), and hls_write_packet().

static int hls_write_header ( AVFormatContext s)
static

Definition at line 233 of file hlsenc.c.

static int hls_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 319 of file hlsenc.c.

static int hls_write_trailer ( struct AVFormatContext s)
static

Definition at line 384 of file hlsenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"start_number", "set first number in the sequence", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E},
{"hls_time", "set segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E},
{"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E},
{"hls_ts_options","set hls mpegts list of options for the container format used for hls", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
{"hls_wrap", "set number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E},
{"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, E},
{"hls_base_url", "url to prepend to each playlist entry", OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
{"hls_flags", "set flags affecting HLS playlist and media file generation", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, 0, UINT_MAX, E, "flags"},
{"single_file", "generate a single media file indexed with byte ranges", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SINGLE_FILE }, 0, UINT_MAX, E, "flags"},
{ NULL },
}

Definition at line 405 of file hlsenc.c.

const AVClass hls_class
static
Initial value:
= {
.class_name = "hls muxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 419 of file hlsenc.c.

AVOutputFormat ff_hls_muxer
Initial value:
= {
.name = "hls",
.long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
.extensions = "m3u8",
.priv_data_size = sizeof(HLSContext),
.audio_codec = AV_CODEC_ID_AAC,
.video_codec = AV_CODEC_ID_H264,
.priv_class = &hls_class,
}

Definition at line 427 of file hlsenc.c.