FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
dashenc.c File Reference
#include "config.h"
#include "config_components.h"
#include <time.h>
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/rational.h"
#include "libavutil/time_internal.h"
#include "libavcodec/avcodec.h"
#include "av1.h"
#include "avc.h"
#include "avformat.h"
#include "avio_internal.h"
#include "hlsplaylist.h"
#include "internal.h"
#include "isom.h"
#include "mux.h"
#include "os_support.h"
#include "url.h"
#include "vpcc.h"
#include "dash.h"

Go to the source code of this file.

Data Structures

struct   Segment
 
struct   AdaptationSet
 
struct   OutputStream
 
struct   DASHContext
 
struct   codec_string
 

Macros

#define  MPD_PROFILE_DASH   1
 
#define  MPD_PROFILE_DVB   2
 
#define  OFFSET(x)   offsetof(DASHContext, x)
 
#define  E   AV_OPT_FLAG_ENCODING_PARAM
 

Enumerations

 
 

Functions

static int  dashenc_io_open (AVFormatContext *s, AVIOContext **pb, char *filename, AVDictionary **options)
 
static void  dashenc_io_close (AVFormatContext *s, AVIOContext **pb, char *filename)
 
static const char *  get_format_str (SegmentType segment_type)
 
static const char *  get_extension_str (SegmentType type, int single_file)
 
static int  handle_io_open_error (AVFormatContext *s, int err, char *url)
 
 
 
static void  set_vp9_codec_str (AVFormatContext *s, AVCodecParameters *par, AVRational *frame_rate, char *str, int size)
 
static void  set_codec_str (AVFormatContext *s, AVCodecParameters *par, AVRational *frame_rate, char *str, int size)
 
static int  flush_dynbuf (DASHContext *c, OutputStream *os, int *range_length)
 
 
static void  get_hls_playlist_name (char *playlist_name, int string_size, const char *base_url, int id)
 
static void  get_start_index_number (OutputStream *os, DASHContext *c, int *start_index, int *start_number)
 
static void  write_hls_media_playlist (OutputStream *os, AVFormatContext *s, int representation_id, int final, char *prefetch_url)
 
 
static void  dash_free (AVFormatContext *s)
 
static void  output_segment_list (OutputStream *os, AVIOContext *out, AVFormatContext *s, int representation_id, int final)
 
static char *  xmlescape (const char *str)
 
static void  write_time (AVIOContext *out, int64_t time)
 
static void  format_date (char *buf, int size, int64_t time_us)
 
static int  write_adaptation_set (AVFormatContext *s, AVIOContext *out, int as_index, int final)
 
 
static int  adaptation_set_add_stream (AVFormatContext *s, int as_idx, int i)
 
 
static int  write_manifest (AVFormatContext *s, int final)
 
static int  dict_copy_entry (AVDictionary **dst, const AVDictionary *src, const char *key)
 
static int  dash_init (AVFormatContext *s)
 
 
static int  add_segment (OutputStream *os, const char *file, int64_t time, int64_t duration, int64_t start_pos, int64_t range_length, int64_t index_length, int next_exp_index)
 
static void  write_styp (AVIOContext *pb)
 
static void  find_index_range (AVFormatContext *s, const char *full_path, int64_t pos, int *index_length)
 
 
static void  dashenc_delete_file (AVFormatContext *s, char *filename)
 
static int  dashenc_delete_segment_file (AVFormatContext *s, const char *file)
 
static void  dashenc_delete_media_segments (AVFormatContext *s, OutputStream *os, int remove_count)
 
static int  dash_flush (AVFormatContext *s, int final, int stream)
 
 
 
 
static int  dash_check_bitstream (AVFormatContext *s, AVStream *st, const AVPacket *avpkt)
 

Variables

static const struct codec_string  codecs []
 
static const AVOption  options []
 
static const AVClass  dash_class
 
 

Macro Definition Documentation

MPD_PROFILE_DASH

#define MPD_PROFILE_DASH   1

Definition at line 76 of file dashenc.c.

MPD_PROFILE_DVB

#define MPD_PROFILE_DVB   2

Definition at line 77 of file dashenc.c.

OFFSET

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

Definition at line 2354 of file dashenc.c.

E

Definition at line 2355 of file dashenc.c.

Enumeration Type Documentation

SegmentType

Enumerator
PALETTE_SEGMENT 
OBJECT_SEGMENT 
PRESENTATION_SEGMENT 
WINDOW_SEGMENT 
DISPLAY_SEGMENT 
SEGMENT_TYPE_AUTO 
SEGMENT_TYPE_MP4 
SEGMENT_TYPE_WEBM 
SEGMENT_TYPE_NB 
SEGMENT_TYPE_MPEGTS 
SEGMENT_TYPE_FMP4 

Definition at line 61 of file dashenc.c.

anonymous enum

anonymous enum
Enumerator
FRAG_TYPE_NONE 
FRAG_TYPE_EVERY_FRAME 
FRAG_TYPE_DURATION 
FRAG_TYPE_PFRAMES 
FRAG_TYPE_NB 

Definition at line 68 of file dashenc.c.

Function Documentation

dashenc_io_open()

static int dashenc_io_open ( AVFormatContexts,
AVIOContext **  pb,
char *  filename,
AVDictionary **  options 
)
static

Definition at line 221 of file dashenc.c.

Referenced by dash_write_packet(), dashenc_delete_file(), write_hls_media_playlist(), and write_manifest().

dashenc_io_close()

static void dashenc_io_close ( AVFormatContexts,
AVIOContext **  pb,
char *  filename 
)
static

get_format_str()

static const char* get_format_str ( SegmentType  segment_type )
static

Definition at line 259 of file dashenc.c.

Referenced by init_segment_types().

get_extension_str()

static const char* get_extension_str ( SegmentType  type,
int  single_file 
)
static

Definition at line 268 of file dashenc.c.

Referenced by init_segment_types().

handle_io_open_error()

static int handle_io_open_error ( AVFormatContexts,
int  err,
char *  url 
)
static

Definition at line 278 of file dashenc.c.

Referenced by dash_write_packet(), write_hls_media_playlist(), and write_manifest().

select_segment_type()

static SegmentType select_segment_type ( SegmentType  segment_type,
enum AVCodecID  codec_id 
)
inlinestatic

Definition at line 285 of file dashenc.c.

Referenced by init_segment_types().

init_segment_types()

static int init_segment_types ( AVFormatContexts )
static

Definition at line 299 of file dashenc.c.

Referenced by dash_init().

set_vp9_codec_str()

static void set_vp9_codec_str ( AVFormatContexts,
AVRationalframe_rate,
char *  str,
int  size 
)
static

Definition at line 330 of file dashenc.c.

Referenced by set_codec_str().

set_codec_str()

static void set_codec_str ( AVFormatContexts,
AVRationalframe_rate,
char *  str,
int  size 
)
static

Definition at line 345 of file dashenc.c.

Referenced by dash_init(), and update_stream_extradata().

flush_dynbuf()

static int flush_dynbuf ( DASHContextc,
OutputStreamos,
int *  range_length 
)
static

Definition at line 441 of file dashenc.c.

Referenced by dash_flush(), and flush_init_segment().

set_http_options()

static void set_http_options ( AVDictionary **  options,
DASHContextc 
)
static

get_hls_playlist_name()

static void get_hls_playlist_name ( char *  playlist_name,
int  string_size,
const char *  base_url,
int  id 
)
static

Definition at line 483 of file dashenc.c.

Referenced by dash_write_trailer(), write_hls_media_playlist(), and write_manifest().

get_start_index_number()

static void get_start_index_number ( OutputStreamos,
DASHContextc,
int *  start_index,
int *  start_number 
)
static

Definition at line 491 of file dashenc.c.

Referenced by dash_flush(), output_segment_list(), and write_hls_media_playlist().

write_hls_media_playlist()

static void write_hls_media_playlist ( OutputStreamos,
int  representation_id,
int  final,
char *  prefetch_url 
)
static

Definition at line 501 of file dashenc.c.

Referenced by dash_write_packet(), and output_segment_list().

flush_init_segment()

static int flush_init_segment ( AVFormatContexts,
OutputStreamos 
)
static

Definition at line 580 of file dashenc.c.

Referenced by dash_write_header(), and dash_write_packet().

dash_free()

static void dash_free ( AVFormatContexts )
static

Definition at line 598 of file dashenc.c.

output_segment_list()

static void output_segment_list ( OutputStreamos,
AVIOContextout,
int  representation_id,
int  final 
)
static

Definition at line 640 of file dashenc.c.

Referenced by write_adaptation_set().

xmlescape()

static char* xmlescape ( const char *  str )
static

Definition at line 715 of file dashenc.c.

Referenced by write_manifest().

write_time()

static void write_time ( AVIOContextout,
int64_t  time 
)
static

Definition at line 755 of file dashenc.c.

Referenced by write_manifest().

format_date()

static void format_date ( char *  buf,
int  size,
int64_t  time_us 
)
static

Definition at line 771 of file dashenc.c.

Referenced by dash_write_packet(), and write_manifest().

write_adaptation_set()

static int write_adaptation_set ( AVFormatContexts,
AVIOContextout,
int  as_index,
int  final 
)
static

Definition at line 789 of file dashenc.c.

Referenced by write_manifest().

add_adaptation_set()

static int add_adaptation_set ( AVFormatContexts,
AdaptationSet **  as,
enum AVMediaType  type 
)
static

Definition at line 878 of file dashenc.c.

Referenced by parse_adaptation_sets().

adaptation_set_add_stream()

static int adaptation_set_add_stream ( AVFormatContexts,
int  as_idx,
int  i 
)
static

Definition at line 902 of file dashenc.c.

Referenced by parse_adaptation_sets().

parse_adaptation_sets()

static int parse_adaptation_sets ( AVFormatContexts )
static

Definition at line 925 of file dashenc.c.

Referenced by dash_init().

write_manifest()

static int write_manifest ( AVFormatContexts,
int  final 
)
static

Definition at line 1129 of file dashenc.c.

Referenced by dash_flush(), and dash_write_packet().

dict_copy_entry()

static int dict_copy_entry ( AVDictionary **  dst,
const AVDictionarysrc,
const char *  key 
)
static

Definition at line 1365 of file dashenc.c.

Referenced by dash_init().

dash_init()

static int dash_init ( AVFormatContexts )
static

Definition at line 1373 of file dashenc.c.

dash_write_header()

static int dash_write_header ( AVFormatContexts )
static

Definition at line 1728 of file dashenc.c.

add_segment()

static int add_segment ( OutputStreamos,
const char *  file,
int64_t  time,
int64_t  duration,
int64_t  start_pos,
int64_t  range_length,
int64_t  index_length,
int  next_exp_index 
)
static

Definition at line 1747 of file dashenc.c.

Referenced by dash_flush().

write_styp()

static void write_styp ( AVIOContextpb )
static

Definition at line 1787 of file dashenc.c.

Referenced by dash_write_packet().

find_index_range()

static void find_index_range ( AVFormatContexts,
const char *  full_path,
int64_t  pos,
int *  index_length 
)
static

Definition at line 1797 of file dashenc.c.

Referenced by dash_flush().

update_stream_extradata()

static int update_stream_extradata ( AVFormatContexts,
OutputStreamos,
AVPacketpkt,
AVRationalframe_rate 
)
static

Definition at line 1820 of file dashenc.c.

Referenced by dash_write_packet().

dashenc_delete_file()

static void dashenc_delete_file ( AVFormatContexts,
char *  filename 
)
static

Definition at line 1846 of file dashenc.c.

Referenced by dash_write_trailer(), and dashenc_delete_segment_file().

dashenc_delete_segment_file()

static int dashenc_delete_segment_file ( AVFormatContexts,
const char *  file 
)
static

Definition at line 1872 of file dashenc.c.

Referenced by dash_write_trailer(), and dashenc_delete_media_segments().

dashenc_delete_media_segments()

static void dashenc_delete_media_segments ( AVFormatContexts,
OutputStreamos,
int  remove_count 
)
inlinestatic

Definition at line 1892 of file dashenc.c.

Referenced by dash_flush(), and dash_write_trailer().

dash_flush()

static int dash_flush ( AVFormatContexts,
int  final,
int  stream 
)
static

Definition at line 1905 of file dashenc.c.

Referenced by dash_write_packet(), and dash_write_trailer().

dash_parse_prft()

static int dash_parse_prft ( DASHContextc,
AVPacketpkt 
)
static

Definition at line 2039 of file dashenc.c.

Referenced by dash_write_packet().

dash_write_packet()

static int dash_write_packet ( AVFormatContexts,
AVPacketpkt 
)
static

Definition at line 2065 of file dashenc.c.

dash_write_trailer()

static int dash_write_trailer ( AVFormatContexts )
static

Definition at line 2291 of file dashenc.c.

dash_check_bitstream()

static int dash_check_bitstream ( AVFormatContexts,
AVStreamst,
const AVPacketavpkt 
)
static

Definition at line 2333 of file dashenc.c.

Variable Documentation

codecs

const struct codec_string codecs[]
static
Initial value:
= {
{ AV_CODEC_ID_VP8, "vp8" },
{ AV_CODEC_ID_VP9, "vp9" },
{ AV_CODEC_ID_VORBIS, "vorbis" },
{ AV_CODEC_ID_OPUS, "opus" },
{ AV_CODEC_ID_FLAC, "flac" },
}

Referenced by ff_hls_write_stream_info(), get_codecs_sorted(), print_codecs(), set_codec_str(), and show_codecs().

options

const AVOption options[]
static

Definition at line 2356 of file dashenc.c.

dash_class

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

Definition at line 2405 of file dashenc.c.

ff_dash_muxer

const FFOutputFormat ff_dash_muxer
Initial value:
= {
.p.name = "dash",
.p.long_name = NULL_IF_CONFIG_SMALL("DASH Muxer"),
.p.extensions = "mpd",
.p.audio_codec = AV_CODEC_ID_AAC,
.p.video_codec = AV_CODEC_ID_H264,
.p.priv_class = &dash_class,
.priv_data_size = sizeof(DASHContext),
}

Definition at line 2412 of file dashenc.c.

static const AVOption options[]
Definition: dashenc.c:2356
static int dash_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *avpkt)
Definition: dashenc.c:2333
static void deinit(AVFormatContext *s)
Definition: chromaprint.c:52
static int dash_init(AVFormatContext *s)
Definition: dashenc.c:1373
@ AV_CODEC_ID_FLAC
Definition: codec_id.h:471
@ AV_CODEC_ID_VP9
Definition: codec_id.h:222
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dashenc.c:2065
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:101
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:241
@ AV_CODEC_ID_AAC
Definition: codec_id.h:461
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
@ AV_CODEC_ID_OPUS
Definition: codec_id.h:519
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:477
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
static int check_bitstream(AVFormatContext *s, FFStream *sti, AVPacket *pkt)
Definition: mux.c:1056
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:209
#define AVFMT_TS_NEGATIVE
Format allows muxing negative timestamps.
Definition: avformat.h:490
static int dash_write_header(AVFormatContext *s)
Definition: dashenc.c:1728
static int dash_write_trailer(AVFormatContext *s)
Definition: dashenc.c:2291
@ AV_CODEC_ID_VP8
Definition: codec_id.h:192
static const AVClass dash_class
Definition: dashenc.c:2405
@ AV_CODEC_ID_VORBIS
Definition: codec_id.h:464
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:384
static void dash_free(AVFormatContext *s)
Definition: dashenc.c:598

Generated on Fri Oct 17 2025 19:24:11 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /