FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
segment.c File Reference
#include "config_components.h"
#include <time.h>
#include "avformat.h"
#include "internal.h"
#include "mux.h"
#include "libavutil/avassert.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/parseutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/timecode.h"
#include "libavutil/time_internal.h"
#include "libavutil/timestamp.h"

Go to the source code of this file.

Data Structures

struct  SegmentListEntry
 
struct  SegmentContext
 

Macros

#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_FFCONCAT, LIST_TYPE_NB
}
 

Functions

static void print_csv_escaped_str (AVIOContext *ctx, const char *str)
 
static int segment_mux_init (AVFormatContext *s)
 
static int set_segment_filename (AVFormatContext *s)
 
static int segment_start (AVFormatContext *s, int write_header)
 
static int segment_list_open (AVFormatContext *s)
 
static void segment_list_print_entry (AVIOContext *list_ioctx, ListType list_type, const SegmentListEntry *list_entry, void *log_ctx)
 
static int segment_end (AVFormatContext *s, int write_trailer, int is_last)
 
static int parse_times (void *log_ctx, int64_t **times, int *nb_times, const char *times_str)
 
static int parse_frames (void *log_ctx, int **frames, int *nb_frames, const char *frames_str)
 
static int open_null_ctx (AVIOContext **ctx)
 
static void close_null_ctxp (AVIOContext **pb)
 
static int select_reference_stream (AVFormatContext *s)
 
static void seg_free (AVFormatContext *s)
 
static int seg_init (AVFormatContext *s)
 
static int seg_write_header (AVFormatContext *s)
 
static int seg_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int seg_write_trailer (struct AVFormatContext *s)
 
static int seg_check_bitstream (AVFormatContext *s, AVStream *st, const AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass seg_class
 

Macro Definition Documentation

◆ SEGMENT_LIST_FLAG_CACHE

#define SEGMENT_LIST_FLAG_CACHE   1

Definition at line 67 of file segment.c.

◆ SEGMENT_LIST_FLAG_LIVE

#define SEGMENT_LIST_FLAG_LIVE   2

Definition at line 68 of file segment.c.

◆ FAIL

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

◆ OFFSET

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

Definition at line 1038 of file segment.c.

◆ E

Definition at line 1039 of file segment.c.

Enumeration Type Documentation

◆ ListType

enum ListType
Enumerator
LIST_TYPE_UNDEFINED 
LIST_TYPE_FLAT 
LIST_TYPE_CSV 
LIST_TYPE_M3U8 
LIST_TYPE_EXT 

deprecated

LIST_TYPE_FFCONCAT 
LIST_TYPE_NB 

Definition at line 57 of file segment.c.

Function Documentation

◆ print_csv_escaped_str()

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

Definition at line 131 of file segment.c.

Referenced by segment_list_print_entry().

◆ segment_mux_init()

static int segment_mux_init ( AVFormatContext s)
static

Definition at line 147 of file segment.c.

Referenced by seg_init(), and segment_start().

◆ set_segment_filename()

static int set_segment_filename ( AVFormatContext s)
static

Definition at line 192 of file segment.c.

Referenced by seg_init(), and segment_start().

◆ segment_start()

static int segment_start ( AVFormatContext s,
int  write_header 
)
static

Definition at line 236 of file segment.c.

Referenced by seg_write_packet().

◆ segment_list_open()

static int segment_list_open ( AVFormatContext s)
static

Definition at line 281 of file segment.c.

Referenced by seg_init(), and segment_end().

◆ segment_list_print_entry()

static void segment_list_print_entry ( AVIOContext list_ioctx,
ListType  list_type,
const SegmentListEntry list_entry,
void *  log_ctx 
)
static

Definition at line 316 of file segment.c.

Referenced by segment_end().

◆ segment_end()

static int segment_end ( AVFormatContext s,
int  write_trailer,
int  is_last 
)
static

Definition at line 351 of file segment.c.

Referenced by seg_write_packet(), and seg_write_trailer().

◆ parse_times()

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

Definition at line 463 of file segment.c.

Referenced by seg_init().

◆ parse_frames()

static int parse_frames ( void *  log_ctx,
int **  frames,
int nb_frames,
const char *  frames_str 
)
static

Definition at line 521 of file segment.c.

Referenced by seg_init().

◆ open_null_ctx()

static int open_null_ctx ( AVIOContext **  ctx)
static

Definition at line 572 of file segment.c.

Referenced by seg_init(), and seg_write_trailer().

◆ close_null_ctxp()

static void close_null_ctxp ( AVIOContext **  pb)
static

Definition at line 586 of file segment.c.

Referenced by seg_free(), and seg_write_header().

◆ select_reference_stream()

static int select_reference_stream ( AVFormatContext s)
static

Definition at line 592 of file segment.c.

Referenced by seg_init().

◆ seg_free()

static void seg_free ( AVFormatContext s)
static

Definition at line 649 of file segment.c.

◆ seg_init()

static int seg_init ( AVFormatContext s)
static

Definition at line 676 of file segment.c.

◆ seg_write_header()

static int seg_write_header ( AVFormatContext s)
static

Definition at line 824 of file segment.c.

◆ seg_write_packet()

static int seg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 853 of file segment.c.

◆ seg_write_trailer()

static int seg_write_trailer ( struct AVFormatContext s)
static

Definition at line 997 of file segment.c.

◆ seg_check_bitstream()

static int seg_check_bitstream ( AVFormatContext s,
AVStream st,
const AVPacket pkt 
)
static

Definition at line 1019 of file segment.c.

Variable Documentation

◆ options

const AVOption options[]
static

Definition at line 1040 of file segment.c.

Referenced by seg_init(), and segment_start().

◆ seg_class

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

Definition at line 1085 of file segment.c.

LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
options
static const AVOption options[]
Definition: segment.c:1040