libavformat/segment.c File Reference

#include <float.h>
#include "avformat.h"
#include "internal.h"
#include "libavutil/avassert.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

Defines

#define SEGMENT_LIST_FLAG_CACHE   1
#define SEGMENT_LIST_FLAG_LIVE   2
#define FAIL(err)   ret = err; goto end
#define OFFSET(x)   offsetof(SegmentContext, x)
#define E   AV_OPT_FLAG_ENCODING_PARAM

Enumerations

enum  ListType {
  LIST_TYPE_UNDEFINED = -1, LIST_TYPE_FLAT = 0, LIST_TYPE_CSV, LIST_TYPE_M3U8,
  LIST_TYPE_EXT, LIST_TYPE_NB
}

Functions

static void print_csv_escaped_str (AVIOContext *ctx, const char *str)
static int segment_start (AVFormatContext *s)
static int segment_list_open (AVFormatContext *s)
static void segment_list_close (AVFormatContext *s)
static int segment_end (AVFormatContext *s)
static int parse_times (void *log_ctx, int64_t **times, int *nb_times, const char *times_str)
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
static const AVClass sseg_class
AVOutputFormat ff_stream_segment_muxer


Define Documentation

#define E   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 458 of file segment.c.

#define FAIL ( err   )     ret = err; goto end

#define OFFSET (  )     offsetof(SegmentContext, x)

Definition at line 457 of file segment.c.

#define SEGMENT_LIST_FLAG_CACHE   1

Definition at line 49 of file segment.c.

Referenced by segment_list_open().

#define SEGMENT_LIST_FLAG_LIVE   2

Definition at line 50 of file segment.c.

Referenced by seg_write_header(), segment_list_close(), and segment_list_open().


Enumeration Type Documentation

enum ListType

Enumerator:
LIST_TYPE_UNDEFINED 
LIST_TYPE_FLAT 
LIST_TYPE_CSV 
LIST_TYPE_M3U8 
LIST_TYPE_EXT  deprecated
LIST_TYPE_NB 

Definition at line 39 of file segment.c.


Function Documentation

static int parse_times ( void *  log_ctx,
int64_t **  times,
int nb_times,
const char *  times_str 
) [static]

Definition at line 222 of file segment.c.

Referenced by seg_write_header().

static void print_csv_escaped_str ( AVIOContext ctx,
const char *  str 
) [static]

Definition at line 77 of file segment.c.

Referenced by segment_end().

static int seg_write_header ( AVFormatContext s  )  [static]

Definition at line 275 of file segment.c.

static int seg_write_packet ( AVFormatContext s,
AVPacket pkt 
) [static]

Definition at line 394 of file segment.c.

static int seg_write_trailer ( struct AVFormatContext s  )  [static]

Definition at line 440 of file segment.c.

static int segment_end ( AVFormatContext s  )  [static]

Definition at line 180 of file segment.c.

Referenced by seg_write_packet(), and seg_write_trailer().

static void segment_list_close ( AVFormatContext s  )  [static]

Definition at line 165 of file segment.c.

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

static int segment_list_open ( AVFormatContext s  )  [static]

Definition at line 140 of file segment.c.

Referenced by seg_write_header(), and segment_end().

static int segment_start ( AVFormatContext s  )  [static]

Definition at line 93 of file segment.c.

Referenced by seg_write_packet().


Variable Documentation

Initial value:

 {
    .name           = "segment",
    .long_name      = NULL_IF_CONFIG_SMALL("segment"),
    .priv_data_size = sizeof(SegmentContext),
    .flags          = AVFMT_GLOBALHEADER | AVFMT_NOFILE,
    .write_header   = seg_write_header,
    .write_packet   = seg_write_packet,
    .write_trailer  = seg_write_trailer,
    .priv_class     = &seg_class,
}

Definition at line 487 of file segment.c.

Initial value:

 {
    .name           = "stream_segment,ssegment",
    .long_name      = NULL_IF_CONFIG_SMALL("streaming segment muxer"),
    .priv_data_size = sizeof(SegmentContext),
    .flags          = AVFMT_NOFILE,
    .write_header   = seg_write_header,
    .write_packet   = seg_write_packet,
    .write_trailer  = seg_write_trailer,
    .priv_class     = &sseg_class,
}

Definition at line 505 of file segment.c.

const AVOption options[] [static]

Initial value:

 {
    { "segment_format",    "set container format used for the segments", OFFSET(format),  AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E },
    { "segment_list",      "set the segment list filename",              OFFSET(list),    AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E },

    { "segment_list_flags","set flags affecting segment list generation", OFFSET(list_flags), AV_OPT_TYPE_FLAGS, {.i64 = SEGMENT_LIST_FLAG_CACHE }, 0, UINT_MAX, E, "list_flags"},
    { "cache",             "allow list caching",                                    0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_CACHE }, INT_MIN, INT_MAX,   E, "list_flags"},
    { "live",              "enable live-friendly list generation (useful for HLS)", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, INT_MAX,    E, "list_flags"},

    { "segment_list_size", "set the maximum number of playlist entries", OFFSET(list_size), AV_OPT_TYPE_INT,  {.i64 = 0},     0, INT_MAX, E },
    { "segment_list_type", "set the segment list type",                  OFFSET(list_type), AV_OPT_TYPE_INT,  {.i64 = LIST_TYPE_UNDEFINED}, -1, LIST_TYPE_NB-1, E, "list_type" },
    { "flat", "flat format",     0, AV_OPT_TYPE_CONST, {.i64=LIST_TYPE_FLAT }, INT_MIN, INT_MAX, 0, "list_type" },
    { "csv",  "csv format",      0, AV_OPT_TYPE_CONST, {.i64=LIST_TYPE_CSV  }, INT_MIN, INT_MAX, 0, "list_type" },
    { "ext",  "extended format", 0, AV_OPT_TYPE_CONST, {.i64=LIST_TYPE_EXT  }, INT_MIN, INT_MAX, 0, "list_type" },
    { "m3u8", "M3U8 format",     0, AV_OPT_TYPE_CONST, {.i64=LIST_TYPE_M3U8 }, INT_MIN, INT_MAX, 0, "list_type" },
    { "segment_time",      "set segment duration",                       OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E },
    { "segment_time_delta","set approximation value used for the segment times", OFFSET(time_delta_str), AV_OPT_TYPE_STRING, {.str = "0"}, 0, 0, E },
    { "segment_times",     "set segment split time points",              OFFSET(times_str),AV_OPT_TYPE_STRING,{.str = NULL},  0, 0,       E },
    { "segment_wrap",      "set number after which the index wraps",     OFFSET(segment_idx_wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
    { NULL },
}

Definition at line 459 of file segment.c.

const AVClass seg_class [static]

Initial value:

 {
    .class_name = "segment muxer",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
}

Definition at line 480 of file segment.c.

const AVClass sseg_class [static]

Initial value:

 {
    .class_name = "stream_segment muxer",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
}

Definition at line 498 of file segment.c.


Generated on Fri Oct 26 02:50:11 2012 for FFmpeg by  doxygen 1.5.8