segment.c File Reference
#include <float.h>
#include "avformat.h"
#include "internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/parseutils.h"
#include "libavutil/mathematics.h"

Go to the source code of this file.

Data Structures

struct  SegmentContext

Macros

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

Enumerations

enum  { LIST_FLAT, LIST_HLS }

Functions

static int segment_mux_init (AVFormatContext *s)
static int segment_hls_window (AVFormatContext *s, int last)
static int segment_start (AVFormatContext *s, int write_header)
static int segment_end (AVFormatContext *oc, int write_trailer)
static int open_null_ctx (AVIOContext **ctx)
static void close_null_ctx (AVIOContext *pb)
static int seg_write_header (AVFormatContext *s)
static int seg_write_packet (AVFormatContext *s, AVPacket *pkt)
static int seg_write_trailer (struct AVFormatContext *s)

Variables

static const AVOption options []
static const AVClass seg_class
AVOutputFormat ff_segment_muxer

Macro Definition Documentation

Definition at line 356 of file segment.c.

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

Definition at line 355 of file segment.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
LIST_FLAT 
LIST_HLS 

Definition at line 52 of file segment.c.

Function Documentation

static void close_null_ctx ( AVIOContext pb)
static

Definition at line 173 of file segment.c.

Referenced by seg_write_header(), and seg_write_trailer().

static int open_null_ctx ( AVIOContext **  ctx)
static

Definition at line 159 of file segment.c.

Referenced by seg_write_header(), and seg_write_trailer().

static int seg_write_header ( AVFormatContext s)
static

Definition at line 179 of file segment.c.

static int seg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 269 of file segment.c.

static int seg_write_trailer ( struct AVFormatContext s)
static

Definition at line 326 of file segment.c.

static int segment_end ( AVFormatContext oc,
int  write_trailer 
)
static

Definition at line 147 of file segment.c.

Referenced by seg_write_packet(), and seg_write_trailer().

static int segment_hls_window ( AVFormatContext s,
int  last 
)
static

Definition at line 81 of file segment.c.

Referenced by seg_write_header(), seg_write_packet(), and seg_write_trailer().

static int segment_mux_init ( AVFormatContext s)
static

Definition at line 57 of file segment.c.

Referenced by seg_write_header(), and segment_start().

static int segment_start ( AVFormatContext s,
int  write_header 
)
static

Definition at line 111 of file segment.c.

Referenced by seg_write_packet().

Variable Documentation

AVOutputFormat ff_segment_muxer
Initial value:
{
.name = "segment",
.long_name = NULL_IF_CONFIG_SMALL("segment"),
.priv_data_size = sizeof(SegmentContext),
.flags = AVFMT_NOFILE,
.priv_class = &seg_class,
}

Definition at line 379 of file segment.c.

const AVOption options[]
static
Initial value:
{
{ "segment_format", "container format used for the segments", OFFSET(format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
{ "segment_time", "segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E },
{ "segment_list", "output the segment list", OFFSET(list), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
{ "segment_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E },
{ "segment_list_type", "segment list format", OFFSET(list_type), AV_OPT_TYPE_INT, {.i64 = LIST_FLAT}, 0, 2, E, "list_type" },
{ "flat", "plain list (default)", 0, AV_OPT_TYPE_CONST, {.i64 = LIST_FLAT}, 0, 0, E, "list_type" },
{ "hls", "Apple HTTP Live Streaming compatible", 0, AV_OPT_TYPE_CONST, {.i64 = LIST_HLS}, 0, 0, E, "list_type" },
{ "segment_wrap", "number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
{ "individual_header_trailer", "write header/trailer to each segment", OFFSET(individual_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{ "write_header_trailer", "write a header to the first segment and a trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{ NULL },
}

Definition at line 357 of file segment.c.

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

Definition at line 371 of file segment.c.