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/mem.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, const 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 551 of file hdsenc.c.

◆ E

Definition at line 552 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 79 of file hdsenc.c.

Referenced by hds_write().

◆ hds_write()

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

Definition at line 116 of file hdsenc.c.

Referenced by hds_write_header().

◆ hds_free()

static void hds_free ( AVFormatContext s)
static

Definition at line 133 of file hdsenc.c.

◆ write_manifest()

static int write_manifest ( AVFormatContext s,
int  final 
)
static

Definition at line 158 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 206 of file hdsenc.c.

Referenced by write_abst().

◆ write_abst()

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

Definition at line 217 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 286 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 302 of file hdsenc.c.

Referenced by hds_flush().

◆ hds_write_header()

static int hds_write_header ( AVFormatContext s)
static

Definition at line 311 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 421 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 449 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 497 of file hdsenc.c.

◆ hds_write_trailer()

static int hds_write_trailer ( AVFormatContext s)
static

Definition at line 528 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 553 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 561 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 568 of file hdsenc.c.

hds_write_header
static int hds_write_header(AVFormatContext *s)
Definition: hdsenc.c:311
deinit
static void deinit(AVFormatContext *s)
Definition: chromaprint.c:52
hds_free
static void hds_free(AVFormatContext *s)
Definition: hdsenc.c:133
hds_write_packet
static int hds_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: hdsenc.c:497
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
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:561
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:447
E
#define E
Definition: hdsenc.c:552
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:94
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:68
hds_write_trailer
static int hds_write_trailer(AVFormatContext *s)
Definition: hdsenc.c:528
write_packet
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:209
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
OFFSET
#define OFFSET(x)
Definition: hdsenc.c:551
options
static const AVOption options[]
Definition: hdsenc.c:553
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:348