FFmpeg
Data Structures | Macros | Functions | Variables
hdsenc.c File Reference
#include "config.h"
#include "avformat.h"
#include "internal.h"
#include "mux.h"
#include "os_support.h"
#include "libavutil/avstring.h"
#include "libavutil/base64.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  Fragment
 
struct  OutputStream
 
struct  HDSContext
 

Macros

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

Functions

static int parse_header (OutputStream *os, const uint8_t *buf, int buf_size)
 
static int hds_write (void *opaque, uint8_t *buf, int buf_size)
 
static void hds_free (AVFormatContext *s)
 
static int write_manifest (AVFormatContext *s, int final)
 
static void update_size (AVIOContext *out, int64_t pos)
 
static int write_abst (AVFormatContext *s, OutputStream *os, int final)
 
static int init_file (AVFormatContext *s, OutputStream *os, int64_t start_ts)
 
static void close_file (AVFormatContext *s, OutputStream *os)
 
static int hds_write_header (AVFormatContext *s)
 
static int add_fragment (OutputStream *os, const char *file, int64_t start_time, int64_t duration)
 
static int hds_flush (AVFormatContext *s, OutputStream *os, int final, int64_t end_ts)
 
static int hds_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int hds_write_trailer (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass hds_class
 
const FFOutputFormat ff_hds_muxer
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 550 of file hdsenc.c.

◆ E

Definition at line 551 of file hdsenc.c.

Function Documentation

◆ parse_header()

static int parse_header ( OutputStream os,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 78 of file hdsenc.c.

Referenced by hds_write().

◆ hds_write()

static int hds_write ( void *  opaque,
uint8_t *  buf,
int  buf_size 
)
static

Definition at line 115 of file hdsenc.c.

Referenced by hds_write_header().

◆ hds_free()

static void hds_free ( AVFormatContext s)
static

Definition at line 132 of file hdsenc.c.

◆ write_manifest()

static int write_manifest ( AVFormatContext s,
int  final 
)
static

Definition at line 157 of file hdsenc.c.

Referenced by hds_write_header(), and hds_write_trailer().

◆ update_size()

static void update_size ( AVIOContext out,
int64_t  pos 
)
static

Definition at line 205 of file hdsenc.c.

Referenced by write_abst().

◆ write_abst()

static int write_abst ( AVFormatContext s,
OutputStream os,
int  final 
)
static

Definition at line 216 of file hdsenc.c.

Referenced by hds_flush(), and hds_write_header().

◆ init_file()

static int init_file ( AVFormatContext s,
OutputStream os,
int64_t  start_ts 
)
static

Definition at line 285 of file hdsenc.c.

Referenced by hds_flush(), and hds_write_header().

◆ close_file()

static void close_file ( AVFormatContext s,
OutputStream os 
)
static

Definition at line 301 of file hdsenc.c.

Referenced by hds_flush().

◆ hds_write_header()

static int hds_write_header ( AVFormatContext s)
static

Definition at line 310 of file hdsenc.c.

◆ add_fragment()

static int add_fragment ( OutputStream os,
const char *  file,
int64_t  start_time,
int64_t  duration 
)
static

Definition at line 420 of file hdsenc.c.

Referenced by hds_flush().

◆ hds_flush()

static int hds_flush ( AVFormatContext s,
OutputStream os,
int  final,
int64_t  end_ts 
)
static

Definition at line 448 of file hdsenc.c.

Referenced by hds_write_packet(), and hds_write_trailer().

◆ hds_write_packet()

static int hds_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 496 of file hdsenc.c.

◆ hds_write_trailer()

static int hds_write_trailer ( AVFormatContext s)
static

Definition at line 527 of file hdsenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "window_size", "number of fragments kept in the manifest", OFFSET(window_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E },
{ "extra_window_size", "number of fragments kept outside of the manifest before removing from disk", OFFSET(extra_window_size), AV_OPT_TYPE_INT, { .i64 = 5 }, 0, INT_MAX, E },
{ "min_frag_duration", "minimum fragment duration (in microseconds)", OFFSET(min_frag_duration), AV_OPT_TYPE_INT64, { .i64 = 10000000 }, 0, INT_MAX, E },
{ "remove_at_exit", "remove all fragments when finished", OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
{ NULL },
}

Definition at line 552 of file hdsenc.c.

◆ hds_class

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

Definition at line 560 of file hdsenc.c.

◆ ff_hds_muxer

const FFOutputFormat ff_hds_muxer
Initial value:
= {
.p.name = "hds",
.p.long_name = NULL_IF_CONFIG_SMALL("HDS Muxer"),
.p.audio_codec = AV_CODEC_ID_AAC,
.p.video_codec = AV_CODEC_ID_H264,
.p.priv_class = &hds_class,
.priv_data_size = sizeof(HDSContext),
}

Definition at line 567 of file hdsenc.c.

hds_write_header
static int hds_write_header(AVFormatContext *s)
Definition: hdsenc.c:310
deinit
static void deinit(AVFormatContext *s)
Definition: chromaprint.c:50
hds_free
static void hds_free(AVFormatContext *s)
Definition: hdsenc.c:132
hds_write_packet
static int hds_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: hdsenc.c:496
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:226
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
write_trailer
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:101
hds_class
static const AVClass hds_class
Definition: hdsenc.c:560
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:440
E
#define E
Definition: hdsenc.c:551
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:115
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
AVFMT_GLOBALHEADER
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:478
HDSContext
Definition: hdsenc.c:67
hds_write_trailer
static int hds_write_trailer(AVFormatContext *s)
Definition: hdsenc.c:527
write_packet
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:61
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
OFFSET
#define OFFSET(x)
Definition: hdsenc.c:550
options
static const AVOption options[]
Definition: hdsenc.c:552
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:346