FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
segment.c File Reference
#include <float.h>
#include <time.h>
#include "avformat.h"
#include "avio_internal.h"
#include "internal.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 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 (struct AVFormatContext *s, const AVPacket *pkt)
 

Variables

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

Macro Definition Documentation

#define SEGMENT_LIST_FLAG_CACHE   1

Definition at line 66 of file segment.c.

Referenced by segment_list_open().

#define SEGMENT_LIST_FLAG_LIVE   2

Definition at line 67 of file segment.c.

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

Referenced by parse_frames(), and parse_times().

#define FAIL (   err)    ret = err; goto end
#define OFFSET (   x)    offsetof(SegmentContext, x)

Definition at line 1015 of file segment.c.

Definition at line 1016 of file segment.c.

Enumeration Type Documentation

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 56 of file segment.c.

Function Documentation

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

Definition at line 129 of file segment.c.

Referenced by segment_list_print_entry().

static int segment_mux_init ( AVFormatContext s)
static

Definition at line 145 of file segment.c.

Referenced by seg_init(), and segment_start().

static int set_segment_filename ( AVFormatContext s)
static

Definition at line 189 of file segment.c.

Referenced by seg_init(), and segment_start().

static int segment_start ( AVFormatContext s,
int  write_header 
)
static

Definition at line 227 of file segment.c.

Referenced by seg_write_packet().

static int segment_list_open ( AVFormatContext s)
static

Definition at line 272 of file segment.c.

Referenced by seg_init(), and segment_end().

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

Definition at line 307 of file segment.c.

Referenced by segment_end().

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

Definition at line 342 of file segment.c.

Referenced by seg_write_packet(), and seg_write_trailer().

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

Definition at line 438 of file segment.c.

Referenced by seg_init().

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

Definition at line 496 of file segment.c.

Referenced by seg_init().

static int open_null_ctx ( AVIOContext **  ctx)
static

Definition at line 555 of file segment.c.

Referenced by seg_init(), and seg_write_trailer().

static void close_null_ctxp ( AVIOContext **  pb)
static

Definition at line 569 of file segment.c.

Referenced by seg_write_header(), and seg_write_trailer().

static int select_reference_stream ( AVFormatContext s)
static

Definition at line 575 of file segment.c.

Referenced by seg_init().

static void seg_free ( AVFormatContext s)
static

Definition at line 632 of file segment.c.

static int seg_init ( AVFormatContext s)
static

Definition at line 640 of file segment.c.

static int seg_write_header ( AVFormatContext s)
static

Definition at line 797 of file segment.c.

static int seg_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 842 of file segment.c.

static int seg_write_trailer ( struct AVFormatContext s)
static

Definition at line 953 of file segment.c.

static int seg_check_bitstream ( struct AVFormatContext s,
const AVPacket pkt 
)
static

Definition at line 996 of file segment.c.

Variable Documentation

const AVOption options[]
static

Definition at line 1017 of file segment.c.

Referenced by seg_init(), and segment_start().

const AVClass seg_class
static
Initial value:
= {
.class_name = "segment muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
av_default_item_name
static const AVOption options[]
Definition: segment.c:1017

Definition at line 1061 of file segment.c.

AVOutputFormat ff_segment_muxer
Initial value:
= {
.name = "segment",
.long_name = NULL_IF_CONFIG_SMALL("segment"),
.priv_data_size = sizeof(SegmentContext),
.deinit = seg_free,
.check_bitstream = seg_check_bitstream,
.priv_class = &seg_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:671
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int seg_write_header(AVFormatContext *s)
Definition: segment.c:797
static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
Definition: segment.c:996
static int seg_write_trailer(struct AVFormatContext *s)
Definition: segment.c:953
static int flags
Definition: log.c:57
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int seg_init(AVFormatContext *s)
Definition: segment.c:640
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:485
static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: segment.c:842
static void seg_free(AVFormatContext *s)
Definition: segment.c:632
static const AVClass seg_class
Definition: segment.c:1061
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337

Definition at line 1068 of file segment.c.

const AVClass sseg_class
static
Initial value:
= {
.class_name = "stream_segment muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
av_default_item_name
static const AVOption options[]
Definition: segment.c:1017

Definition at line 1082 of file segment.c.

AVOutputFormat ff_stream_segment_muxer
Initial value:
= {
.name = "stream_segment,ssegment",
.long_name = NULL_IF_CONFIG_SMALL("streaming segment muxer"),
.priv_data_size = sizeof(SegmentContext),
.deinit = seg_free,
.check_bitstream = seg_check_bitstream,
.priv_class = &sseg_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:671
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int seg_write_header(AVFormatContext *s)
Definition: segment.c:797
static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
Definition: segment.c:996
static int seg_write_trailer(struct AVFormatContext *s)
Definition: segment.c:953
static int flags
Definition: log.c:57
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int seg_init(AVFormatContext *s)
Definition: segment.c:640
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static const AVClass sseg_class
Definition: segment.c:1082
static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: segment.c:842
static void seg_free(AVFormatContext *s)
Definition: segment.c:632
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337

Definition at line 1089 of file segment.c.