FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
dashdec.c File Reference
#include <libxml/parser.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/parseutils.h"
#include "internal.h"
#include "avio_internal.h"
#include "dash.h"

Go to the source code of this file.

Data Structures

struct  fragment
 
struct  timeline
 
struct  representation
 
struct  DASHContext
 

Macros

#define INITIAL_BUFFER_SIZE   32768
 
#define OFFSET(x)   offsetof(DASHContext, x)
 
#define FLAGS   AV_OPT_FLAG_DECODING_PARAM
 

Enumerations

enum  ReadFromURLMode { READ_NORMAL, READ_COMPLETE, READ_NORMAL, READ_COMPLETE }
 

Functions

static uint64_t get_current_time_in_sec (void)
 
static uint64_t get_utc_date_time_insec (AVFormatContext *s, const char *datetime)
 
static uint32_t get_duration_insec (AVFormatContext *s, const char *duration)
 
static int64_t get_segment_start_time_based_on_timeline (struct representation *pls, int64_t cur_seq_no)
 
static int64_t calc_next_seg_no_from_timelines (struct representation *pls, int64_t cur_time)
 
static void free_fragment (struct fragment **seg)
 
static void free_fragment_list (struct representation *pls)
 
static void free_timelines_list (struct representation *pls)
 
static void free_representation (struct representation *pls)
 
static void set_httpheader_options (DASHContext *c, AVDictionary *opts)
 
static void update_options (char **dest, const char *name, void *src)
 
static int open_url (AVFormatContext *s, AVIOContext **pb, const char *url, AVDictionary *opts, AVDictionary *opts2, int *is_http)
 
static char * get_content_url (xmlNodePtr *baseurl_nodes, int n_baseurl_nodes, char *rep_id_val, char *rep_bandwidth_val, char *val)
 
static char * get_val_from_nodes_tab (xmlNodePtr *nodes, const int n_nodes, const char *attrname)
 
static xmlNodePtr find_child_node_by_name (xmlNodePtr rootnode, const char *nodename)
 
static enum AVMediaType get_content_type (xmlNodePtr node)
 
static int parse_manifest_segmenturlnode (AVFormatContext *s, struct representation *rep, xmlNodePtr fragmenturl_node, xmlNodePtr *baseurl_nodes, char *rep_id_val, char *rep_bandwidth_val)
 
static int parse_manifest_segmenttimeline (AVFormatContext *s, struct representation *rep, xmlNodePtr fragment_timeline_node)
 
static int parse_manifest_representation (AVFormatContext *s, const char *url, xmlNodePtr node, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, xmlNodePtr adaptionset_baseurl_node)
 
static int parse_manifest_adaptationset (AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node)
 
static int parse_manifest (AVFormatContext *s, const char *url, AVIOContext *in)
 
static int64_t calc_cur_seg_no (AVFormatContext *s, struct representation *pls)
 
static int64_t calc_min_seg_no (AVFormatContext *s, struct representation *pls)
 
static int64_t calc_max_seg_no (struct representation *pls)
 
static void move_timelines (struct representation *rep_src, struct representation *rep_dest)
 
static void move_segments (struct representation *rep_src, struct representation *rep_dest)
 
static int refresh_manifest (AVFormatContext *s)
 
static struct fragmentget_current_fragment (struct representation *pls)
 
static int read_from_url (struct representation *pls, struct fragment *seg, uint8_t *buf, int buf_size, enum ReadFromURLMode mode)
 
static int open_input (DASHContext *c, struct representation *pls, struct fragment *seg)
 
static int update_init_section (struct representation *pls)
 
static int64_t seek_data (void *opaque, int64_t offset, int whence)
 
static int read_data (void *opaque, uint8_t *buf, int buf_size)
 
static int save_avio_options (AVFormatContext *s)
 
static int nested_io_open (AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **opts)
 
static int reopen_demux_for_component (AVFormatContext *s, struct representation *pls)
 
static int open_demux_for_component (AVFormatContext *s, struct representation *pls)
 
static int dash_read_header (AVFormatContext *s)
 
static int dash_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int dash_close (AVFormatContext *s)
 
static int dash_seek (AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int flags)
 
static int dash_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 
static int dash_probe (AVProbeData *p)
 

Variables

static const AVOption dash_options []
 
static const AVClass dash_class
 
AVInputFormat ff_dash_demuxer
 

Macro Definition Documentation

#define INITIAL_BUFFER_SIZE   32768

Definition at line 31 of file dashdec.c.

Referenced by reopen_demux_for_component().

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

Definition at line 1820 of file dashdec.c.

#define FLAGS   AV_OPT_FLAG_DECODING_PARAM

Definition at line 1821 of file dashdec.c.

Enumeration Type Documentation

Enumerator
READ_NORMAL 
READ_COMPLETE 
READ_NORMAL 
READ_COMPLETE 

Definition at line 1270 of file dashdec.c.

Function Documentation

static uint64_t get_current_time_in_sec ( void  )
static

Definition at line 146 of file dashdec.c.

Referenced by calc_cur_seg_no(), calc_max_seg_no(), and calc_min_seg_no().

static uint64_t get_utc_date_time_insec ( AVFormatContext s,
const char *  datetime 
)
static

Definition at line 151 of file dashdec.c.

Referenced by parse_manifest().

static uint32_t get_duration_insec ( AVFormatContext s,
const char *  duration 
)
static

Definition at line 181 of file dashdec.c.

Referenced by parse_manifest().

static int64_t get_segment_start_time_based_on_timeline ( struct representation pls,
int64_t  cur_seq_no 
)
static

Definition at line 225 of file dashdec.c.

Referenced by calc_cur_seg_no(), get_current_fragment(), and refresh_manifest().

static int64_t calc_next_seg_no_from_timelines ( struct representation pls,
int64_t  cur_time 
)
static

Definition at line 254 of file dashdec.c.

Referenced by calc_cur_seg_no(), and refresh_manifest().

static void free_fragment ( struct fragment **  seg)
static

Definition at line 284 of file dashdec.c.

Referenced by free_fragment_list(), free_representation(), and read_data().

static void free_fragment_list ( struct representation pls)
static

Definition at line 293 of file dashdec.c.

Referenced by free_representation(), and move_segments().

static void free_timelines_list ( struct representation pls)
static

Definition at line 304 of file dashdec.c.

Referenced by free_representation(), and move_timelines().

static void free_representation ( struct representation pls)
static
static void set_httpheader_options ( DASHContext c,
AVDictionary opts 
)
static

Definition at line 334 of file dashdec.c.

Referenced by open_input(), and parse_manifest().

static void update_options ( char **  dest,
const char *  name,
void src 
)
static

Definition at line 344 of file dashdec.c.

Referenced by dash_read_header().

static int open_url ( AVFormatContext s,
AVIOContext **  pb,
const char *  url,
AVDictionary opts,
AVDictionary opts2,
int is_http 
)
static

Definition at line 352 of file dashdec.c.

Referenced by open_input().

static char* get_content_url ( xmlNodePtr *  baseurl_nodes,
int  n_baseurl_nodes,
char *  rep_id_val,
char *  rep_bandwidth_val,
char *  val 
)
static

Definition at line 419 of file dashdec.c.

Referenced by parse_manifest_representation(), and parse_manifest_segmenturlnode().

static char* get_val_from_nodes_tab ( xmlNodePtr *  nodes,
const int  n_nodes,
const char *  attrname 
)
static

Definition at line 468 of file dashdec.c.

Referenced by parse_manifest_representation().

static xmlNodePtr find_child_node_by_name ( xmlNodePtr  rootnode,
const char *  nodename 
)
static

Definition at line 484 of file dashdec.c.

Referenced by parse_manifest(), and parse_manifest_representation().

static enum AVMediaType get_content_type ( xmlNodePtr  node)
static

Definition at line 501 of file dashdec.c.

Referenced by parse_manifest_representation().

static int parse_manifest_segmenturlnode ( AVFormatContext s,
struct representation rep,
xmlNodePtr  fragmenturl_node,
xmlNodePtr *  baseurl_nodes,
char *  rep_id_val,
char *  rep_bandwidth_val 
)
static

Definition at line 525 of file dashdec.c.

Referenced by parse_manifest_representation().

static int parse_manifest_segmenttimeline ( AVFormatContext s,
struct representation rep,
xmlNodePtr  fragment_timeline_node 
)
static

Definition at line 580 of file dashdec.c.

Referenced by parse_manifest_representation().

static int parse_manifest_representation ( AVFormatContext s,
const char *  url,
xmlNodePtr  node,
xmlNodePtr  adaptionset_node,
xmlNodePtr  mpd_baseurl_node,
xmlNodePtr  period_baseurl_node,
xmlNodePtr  fragment_template_node,
xmlNodePtr  content_component_node,
xmlNodePtr  adaptionset_baseurl_node 
)
static

Definition at line 616 of file dashdec.c.

Referenced by parse_manifest_adaptationset().

static int parse_manifest_adaptationset ( AVFormatContext s,
const char *  url,
xmlNodePtr  adaptionset_node,
xmlNodePtr  mpd_baseurl_node,
xmlNodePtr  period_baseurl_node 
)
static

Definition at line 826 of file dashdec.c.

Referenced by parse_manifest().

static int parse_manifest ( AVFormatContext s,
const char *  url,
AVIOContext in 
)
static

Definition at line 862 of file dashdec.c.

Referenced by dash_read_header(), and refresh_manifest().

static int64_t calc_cur_seg_no ( AVFormatContext s,
struct representation pls 
)
static

Definition at line 1035 of file dashdec.c.

Referenced by get_current_fragment(), and open_demux_for_component().

static int64_t calc_min_seg_no ( AVFormatContext s,
struct representation pls 
)
static

Definition at line 1069 of file dashdec.c.

Referenced by get_current_fragment().

static int64_t calc_max_seg_no ( struct representation pls)
static
static void move_timelines ( struct representation rep_src,
struct representation rep_dest 
)
static

Definition at line 1104 of file dashdec.c.

Referenced by refresh_manifest().

static void move_segments ( struct representation rep_src,
struct representation rep_dest 
)
static

Definition at line 1118 of file dashdec.c.

Referenced by refresh_manifest().

static int refresh_manifest ( AVFormatContext s)
static

Definition at line 1136 of file dashdec.c.

Referenced by get_current_fragment().

static struct fragment* get_current_fragment ( struct representation pls)
static

Definition at line 1198 of file dashdec.c.

Referenced by read_data().

static int read_from_url ( struct representation pls,
struct fragment seg,
uint8_t buf,
int  buf_size,
enum ReadFromURLMode  mode 
)
static

Definition at line 1275 of file dashdec.c.

Referenced by read_data(), and update_init_section().

static int open_input ( DASHContext c,
struct representation pls,
struct fragment seg 
)
static

Definition at line 1299 of file dashdec.c.

Referenced by read_data(), and update_init_section().

static int update_init_section ( struct representation pls)
static

Definition at line 1340 of file dashdec.c.

Referenced by read_data().

static int64_t seek_data ( void opaque,
int64_t  offset,
int  whence 
)
static

Definition at line 1387 of file dashdec.c.

Referenced by reopen_demux_for_component().

static int read_data ( void opaque,
uint8_t buf,
int  buf_size 
)
static
static int save_avio_options ( AVFormatContext s)
static

Definition at line 1458 of file dashdec.c.

Referenced by dash_read_header().

static int nested_io_open ( AVFormatContext s,
AVIOContext **  pb,
const char *  url,
int  flags,
AVDictionary **  opts 
)
static

Definition at line 1479 of file dashdec.c.

Referenced by reopen_demux_for_component().

static int reopen_demux_for_component ( AVFormatContext s,
struct representation pls 
)
static

Definition at line 1489 of file dashdec.c.

Referenced by dash_read_packet(), dash_seek(), and open_demux_for_component().

static int open_demux_for_component ( AVFormatContext s,
struct representation pls 
)
static

Definition at line 1556 of file dashdec.c.

Referenced by dash_read_header().

static int dash_read_header ( AVFormatContext s)
static

Definition at line 1586 of file dashdec.c.

static int dash_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1662 of file dashdec.c.

static int dash_close ( AVFormatContext s)
static

Definition at line 1704 of file dashdec.c.

static int dash_seek ( AVFormatContext s,
struct representation pls,
int64_t  seek_pos_msec,
int  flags 
)
static

Definition at line 1721 of file dashdec.c.

Referenced by dash_read_seek().

static int dash_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 1783 of file dashdec.c.

static int dash_probe ( AVProbeData p)
static

Definition at line 1802 of file dashdec.c.

Variable Documentation

const AVOption dash_options[]
static
Initial value:
= {
{"allowed_extensions", "List of file extensions that dash is allowed to access",
OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
{.str = "aac,m4a,m4s,m4v,mov,mp4"},
INT_MIN, INT_MAX, FLAGS},
{NULL}
}
#define FLAGS
Definition: dashdec.c:1821
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: dashdec.c:1820

Definition at line 1822 of file dashdec.c.

const AVClass dash_class
static
Initial value:
= {
.class_name = "dash",
.item_name = av_default_item_name,
.option = dash_options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
static const AVOption dash_options[]
Definition: dashdec.c:1822
av_default_item_name

Definition at line 1830 of file dashdec.c.

AVInputFormat ff_dash_demuxer
Initial value:
= {
.name = "dash",
.long_name = NULL_IF_CONFIG_SMALL("Dynamic Adaptive Streaming over HTTP"),
.priv_class = &dash_class,
.priv_data_size = sizeof(DASHContext),
}
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
static int dash_close(AVFormatContext *s)
Definition: dashdec.c:1704
static int flags
Definition: log.c:57
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: dashdec.c:1783
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:528
static int dash_probe(AVProbeData *p)
Definition: dashdec.c:1802
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
static int dash_read_header(AVFormatContext *s)
Definition: dashdec.c:1586
static int dash_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: dashdec.c:1662
static const AVClass dash_class
Definition: dashdec.c:1830
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:494

Definition at line 1837 of file dashdec.c.