FFmpeg
Data Structures | Macros | Functions | Variables
hdsenc.c File Reference
#include "config.h"
#include <float.h>
#include "avformat.h"
#include "avio_internal.h"
#include "internal.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
 
AVOutputFormat ff_hds_muxer
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 565 of file hdsenc.c.

◆ E

Definition at line 566 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,
uint8_t buf,
int  buf_size 
)
static

Definition at line 118 of file hdsenc.c.

Referenced by hds_write_header().

◆ hds_free()

static void hds_free ( AVFormatContext s)
static

Definition at line 135 of file hdsenc.c.

Referenced by hds_write_header(), and hds_write_trailer().

◆ write_manifest()

static int write_manifest ( AVFormatContext s,
int  final 
)
static

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

Referenced by write_abst().

◆ write_abst()

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

Definition at line 220 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 289 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 305 of file hdsenc.c.

Referenced by hds_flush().

◆ hds_write_header()

static int hds_write_header ( AVFormatContext s)
static

Definition at line 314 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 435 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 463 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 511 of file hdsenc.c.

◆ hds_write_trailer()

static int hds_write_trailer ( AVFormatContext s)
static

Definition at line 541 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 567 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 575 of file hdsenc.c.

◆ ff_hds_muxer

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

Definition at line 582 of file hdsenc.c.

hds_write_header
static int hds_write_header(AVFormatContext *s)
Definition: hdsenc.c:314
hds_write_packet
static int hds_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: hdsenc.c:511
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:224
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: avcodec.h:245
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:94
hds_class
static const AVClass hds_class
Definition: hdsenc.c:575
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: avcodec.h:566
E
#define E
Definition: hdsenc.c:566
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:188
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:463
write_packet
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:690
AVFMT_GLOBALHEADER
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:466
HDSContext
Definition: hdsenc.c:68
hds_write_trailer
static int hds_write_trailer(AVFormatContext *s)
Definition: hdsenc.c:541
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
OFFSET
#define OFFSET(x)
Definition: hdsenc.c:565
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
options
static const AVOption options[]
Definition: hdsenc.c:567
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337