Libav
Data Structures | Macros | Enumerations | Functions | Variables
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

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

Definition at line 362 of file segment.c.

Definition at line 363 of file segment.c.

Enumeration Type Documentation

anonymous enum
Enumerator
LIST_FLAT 
LIST_HLS 

Definition at line 53 of file segment.c.

Function Documentation

static int segment_mux_init ( AVFormatContext s)
static

Definition at line 58 of file segment.c.

Referenced by seg_write_header(), and segment_start().

static int segment_hls_window ( AVFormatContext s,
int  last 
)
static

Definition at line 82 of file segment.c.

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

static int segment_start ( AVFormatContext s,
int  write_header 
)
static

Definition at line 118 of file segment.c.

Referenced by seg_write_packet().

static int segment_end ( AVFormatContext oc,
int  write_trailer 
)
static

Definition at line 154 of file segment.c.

Referenced by seg_write_packet(), and seg_write_trailer().

static int open_null_ctx ( AVIOContext **  ctx)
static

Definition at line 166 of file segment.c.

Referenced by seg_write_header(), and seg_write_trailer().

static void close_null_ctx ( AVIOContext pb)
static

Definition at line 180 of file segment.c.

Referenced by seg_write_header(), and seg_write_trailer().

static int seg_write_header ( AVFormatContext s)
static

Definition at line 186 of file segment.c.

static int seg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 276 of file segment.c.

static int seg_write_trailer ( struct AVFormatContext s)
static

Definition at line 333 of file segment.c.

Variable Documentation

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 },
{ "segment_list_entry_prefix", "base url prefix for segments", OFFSET(entry_prefix), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, 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 },
}
int size
#define wrap(func)
Definition: neontest.h:62
#define OFFSET(x)
Definition: segment.c:362
NULL
Definition: eval.c:55
#define E
Definition: segment.c:363

Definition at line 364 of file segment.c.

const AVClass seg_class
static
Initial value:
= {
.class_name = "segment muxer",
.item_name = av_default_item_name,
.option = options,
}
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
av_default_item_name
Definition: dnxhdenc.c:52
static const AVOption options[]
Definition: segment.c:364

Definition at line 379 of file segment.c.

AVOutputFormat ff_segment_muxer
Initial value:
= {
.name = "segment",
.long_name = NULL_IF_CONFIG_SMALL("segment"),
.priv_data_size = sizeof(SegmentContext),
.priv_class = &seg_class,
}
static int write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: assenc.c:58
static int seg_write_header(AVFormatContext *s)
Definition: segment.c:186
static int seg_write_trailer(struct AVFormatContext *s)
Definition: segment.c:333
static int flags
Definition: log.c:44
static int write_trailer(AVFormatContext *s)
Definition: assenc.c:64
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:150
static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: segment.c:276
static const AVClass seg_class
Definition: segment.c:379
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:409
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:380

Definition at line 387 of file segment.c.