xine-lib: xine-lib-1.2.13/src/input/input_mpegdash.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
input_mpegdash.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <sys/types.h>`
`#include <sys/time.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <pthread.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/compat.h>`
`#include <xine/input_plugin.h>`
`#include <xine/stree.h>`
`#include <xine/mfrag.h>`
`#include <xine/io_helper.h>`
`#include "http_helper.h"`
`#include "input_helper.h"`
`#include "group_network.h"`
`#include "multirate_pref.c"`

## Data Structures
struct | mpd_input_class_t
struct | mpd_stream_info_t
struct | mpd_input_plugin_s

## Macros
#define | LOG_MODULE "input_mpegdash"
#define | LOG_VERBOSE
#define | MPD_TYPE_AUDIO 1
#define | MPD_TYPE_VIDEO 2
#define | MPD_TYPE_SUBT 4
#define | MPD_IS_LIVE(this) ((this->mode == MPD_LIVE) || (this->mode == MPD_SINGLE_LIVE) || (this->mode == MPD_INIT_LIVE))
#define | MPD_MAX_SIDES 4
#define | MPD_MAX_REPR 16
#define | MPD_MAX_STREAMS 32
#define | MPD_MAX_MRL 4096
#define | MPD_PREVIEW_SIZE (32 << 10)

## Typedefs
typedef struct mpd_input_plugin_s | mpd_input_plugin_t

## Enumerations
enum | mpd_mode_t { MPD_LIVE = 0 , MPD_SINGLE_LIVE , MPD_INIT_LIVE , MPD_VOD , MPD_SINGLE_VOD , MPD_INIT_VOD , MPD_MODE_LAST }

## Functions
static int | xine_gettime (struct timespec *ts)
static uint32_t | str2uint32 (char **s)
static char * | mpd_strcasestr (const char *haystack, const char *needle)
static int | mpd_build_mrl (mpd_input_plugin_t *this, const char *name)
static void | mpd_prepare_fragnum (mpd_input_plugin_t *this)
static void | mpd_apply_fragnum (mpd_input_plugin_t *this)
static int | mpd_input_switch_mrl (mpd_input_plugin_t *this)
static int | mpd_set_start_time (mpd_input_plugin_t *this)
static int | mpd_set_frag_index (mpd_input_plugin_t *this, uint32_t index, int wait)
static void | mpd_frag_seen (mpd_input_plugin_t *this)
static void | mpd_frag_end (mpd_input_plugin_t *this)
static ssize_t | mpd_read_int (mpd_input_plugin_t *this, void *buf, size_t len, int wait)
static int | mpd_input_get_mrl_ext (const char *mrl, const char **ext)
static int | mpd_input_is_mpd (const char *mrl)
static uint32_t | mpd_stree_find (mpd_input_plugin_t *this, const char *path, uint32_t base)
static int | mpd_input_load_manifest (mpd_input_plugin_t *this)
static uint32_t | mpd_input_get_capabilities (input_plugin_t *this_gen)
static off_t | mpd_input_read (input_plugin_t *this_gen, void *buf, off_t len)
static buf_element_t * | mpd_input_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo)
static off_t | mpd_input_time_seek (input_plugin_t *this_gen, int time_offs, int origin)
static off_t | mpd_input_seek (input_plugin_t *this_gen, off_t offset, int origin)
static off_t | mpd_input_get_current_pos (input_plugin_t *this_gen)
static off_t | mpd_input_get_length (input_plugin_t *this_gen)
static const char * | mpd_input_get_mrl (input_plugin_t *this_gen)
static void | mpd_input_dispose (input_plugin_t *this_gen)
static int | mpd_input_open (input_plugin_t *this_gen)
static input_plugin_t * | mpd_get_side (mpd_input_plugin_t *this, int side_index)
static int | mpd_input_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
static input_plugin_t * | mpd_input_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl)
static void | mpd_input_class_dispose (input_class_t *this_gen)
void * | input_mpegdash_init_class (xine_t *xine, const void *data)

## Variables
static const char * | mpd_mode_names [MPD_MODE_LAST]

## Macro Definition Documentation

## ◆ LOG_MODULE

#define LOG_MODULE "input_mpegdash"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MPD_IS_LIVE

#define MPD_IS_LIVE | ( |  | this | ) | ((this->mode == MPD_LIVE) || (this->mode == MPD_SINGLE_LIVE) || (this->mode == MPD_INIT_LIVE))

Referenced by mpd_input_get_capabilities(), mpd_input_get_length(), mpd_input_seek(), mpd_set_frag_index(), and mpd_set_start_time().

## ◆ MPD_MAX_MRL

#define MPD_MAX_MRL 4096

Referenced by mpd_build_mrl(), and mpd_input_get_instance().

## ◆ MPD_MAX_REPR

#define MPD_MAX_REPR 16

Referenced by mpd_input_load_manifest(), and mpd_input_open().

## ◆ MPD_MAX_SIDES

#define MPD_MAX_SIDES 4

<< foo/ber_12345[.mp4]

Referenced by mpd_input_load_manifest().

## ◆ MPD_MAX_STREAMS

#define MPD_MAX_STREAMS 32

Referenced by mpd_input_load_manifest().

## ◆ MPD_PREVIEW_SIZE

#define MPD_PREVIEW_SIZE (32 << 10)

## ◆ MPD_TYPE_AUDIO

#define MPD_TYPE_AUDIO 1

<< offs into stree buf

Referenced by mpd_input_load_manifest().

## ◆ MPD_TYPE_SUBT

#define MPD_TYPE_SUBT 4

Referenced by mpd_input_load_manifest().

## ◆ MPD_TYPE_VIDEO

#define MPD_TYPE_VIDEO 2

Referenced by mpd_input_load_manifest(), and mpd_input_open().

## Typedef Documentation

## ◆ mpd_input_plugin_t

typedef struct mpd_input_plugin_s mpd_input_plugin_t

## Enumeration Type Documentation

## ◆ mpd_mode_t

enum mpd_mode_t

Enumerator
MPD_LIVE |
MPD_SINGLE_LIVE |
MPD_INIT_LIVE |
MPD_VOD |
MPD_SINGLE_VOD |
MPD_INIT_VOD |
MPD_MODE_LAST |

## Function Documentation

## ◆ input_mpegdash_init_class()

void * input_mpegdash_init_class | ( | xine_t * | xine,
|  | const void * | data )

References xine_s::config, mpd_input_class_dispose(), mpd_input_get_instance(), multirate_pref_get(), N_, and NULL.

## ◆ mpd_apply_fragnum()

static void mpd_apply_fragnum | ( | mpd_input_plugin_t * | this | ) |
| static

Referenced by mpd_read_int(), and mpd_set_frag_index().

## ◆ mpd_build_mrl()

static int mpd_build_mrl | ( | mpd_input_plugin_t * | this,
|  | const char * | name )
| static

References _x_merge_mrl(), MPD_MAX_MRL, mpd_strcasestr(), and name.

Referenced by mpd_read_int(), and mpd_set_start_time().

## ◆ mpd_frag_end()

static void mpd_frag_end | ( | mpd_input_plugin_t * | this | ) |
| static

References xine_mfrag_set_index_frag().

Referenced by mpd_input_seek(), and mpd_read_int().

## ◆ mpd_frag_seen()

static void mpd_frag_seen | ( | mpd_input_plugin_t * | this | ) |
| static

References NULL, xine_mfrag_get_index_frag(), and xine_mfrag_set_index_frag().

Referenced by mpd_input_seek(), mpd_input_time_seek(), and mpd_read_int().

## ◆ mpd_get_side()

static input_plugin_t * mpd_get_side | ( | mpd_input_plugin_t * | this,
|  | int | side_index )
| static

References mpd_input_plugin_s::caps1, mpd_input_plugin_s::fraglist, mpd_input_plugin_s::in1, mpd_input_plugin_s::init, mpd_input_plugin_s::input_plugin, mpd_input_plugin_s::list_buf, mpd_input_plugin_s::mutex, mpd_input_plugin_s::nbc, NULL, mpd_input_plugin_s::refs, mpd_input_plugin_s::side_index, mpd_input_plugin_s::stream, mpd_input_plugin_s::sync, mpd_input_plugin_s::tree, xine_get_side_stream(), and xine_nbc_init().

Referenced by mpd_input_get_optional_data().

## ◆ mpd_input_class_dispose()

static void mpd_input_class_dispose | ( | input_class_t * | this_gen | ) |
| static

References NULL, and config_values_s::unregister_callbacks.

Referenced by input_mpegdash_init_class().

## ◆ mpd_input_dispose()

static void mpd_input_dispose | ( | input_plugin_t * | this_gen | ) |
| static

References _x_free_input_plugin(), _x_freep(), NULL, mpd_input_plugin_s::refs, xine_mfrag_list_close(), xine_nbc_close(), and xine_stree_delete().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_get_capabilities()

static uint32_t mpd_input_get_capabilities | ( | input_plugin_t * | this_gen | ) |
| static

References input_plugin_s::get_capabilities, INPUT_CAP_LIVE, INPUT_CAP_PREVIEW, INPUT_CAP_SEEKABLE, INPUT_CAP_SIZED_PREVIEW, INPUT_CAP_SLOW_SEEKABLE, INPUT_CAP_TIME_SEEKABLE, and MPD_IS_LIVE.

Referenced by mpd_input_get_instance().

## ◆ mpd_input_get_current_pos()

static off_t mpd_input_get_current_pos | ( | input_plugin_t * | this_gen | ) |
| static

Referenced by mpd_input_get_instance().

## ◆ mpd_input_get_instance()

static input_plugin_t * mpd_input_get_instance | ( | input_class_t * | cls_gen,
|  | xine_stream_t * | stream,
|  | const char * | mrl )
| static

References _x_demux_read_header(), _x_find_input_plugin(), _x_free_input_plugin(), _x_input_default_get_blocksize(), mpd_input_class_t::input_class, lprintf, mpd_input_dispose(), mpd_input_get_capabilities(), mpd_input_get_current_pos(), mpd_input_get_length(), mpd_input_get_mrl(), mpd_input_get_optional_data(), mpd_input_is_mpd(), mpd_input_open(), mpd_input_read(), mpd_input_read_block(), mpd_input_seek(), mpd_input_time_seek(), MPD_MAX_MRL, NULL, input_plugin_s::open, xine_stream_s::xine, xine_nbc_init(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by input_mpegdash_init_class().

## ◆ mpd_input_get_length()

static off_t mpd_input_get_length | ( | input_plugin_t * | this_gen | ) |
| static

References MPD_IS_LIVE, NULL, xine_mfrag_get_frag_count(), and xine_mfrag_get_index_start().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_get_mrl()

static const char * mpd_input_get_mrl | ( | input_plugin_t * | this_gen | ) |
| static

References NULL.

Referenced by mpd_input_get_instance().

## ◆ mpd_input_get_mrl_ext()

static int mpd_input_get_mrl_ext | ( | const char * | mrl,
|  | const char ** | ext )
| static

Referenced by mpd_input_is_mpd().

## ◆ mpd_input_get_optional_data()

static int mpd_input_get_optional_data | ( | input_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type )
| static

References INPUT_OPTIONAL_DATA_DURATION, INPUT_OPTIONAL_DATA_FRAGLIST, INPUT_OPTIONAL_DATA_PREVIEW, INPUT_OPTIONAL_DATA_PTSOFFS, INPUT_OPTIONAL_DATA_REWIND, INPUT_OPTIONAL_DATA_SIDE, INPUT_OPTIONAL_DATA_SIZED_PREVIEW, INPUT_OPTIONAL_SUCCESS, INPUT_OPTIONAL_UNSUPPORTED, MAX_PREVIEW_SIZE, mpd_get_side(), NULL, xine_mfrag_get_frag_count(), and xine_mfrag_get_index_start().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_is_mpd()

static int mpd_input_is_mpd | ( | const char * | mrl | ) |
| static

References mpd_input_get_mrl_ext().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_load_manifest()

static int mpd_input_load_manifest | ( | mpd_input_plugin_t * | this | ) |
| static

References _x_freep(), mpd_stream_info_t::bitrate, mpd_stream_info_t::frag_duration, mpd_stream_info_t::frag_start, mpd_stream_info_t::h, mpd_stream_info_t::id, mpd_stream_info_t::index_as, mpd_stream_info_t::index_p, mpd_stream_info_t::index_r, mpd_stream_info_t::init, mpd_stream_info_t::media, mpd_stream_info_t::mime, MPD_MAX_REPR, MPD_MAX_SIDES, MPD_MAX_STREAMS, mpd_strcasestr(), mpd_stree_find(), MPD_TYPE_AUDIO, MPD_TYPE_SUBT, MPD_TYPE_VIDEO, mpd_stream_info_t::samplerate, mpd_stream_info_t::sfile, str2uint32(), mpd_stream_info_t::timebase, mpd_stream_info_t::type, mpd_stream_info_t::w, XINE_STREE_AUTO, xine_stree_delete(), xine_stree_find(), xine_stree_load(), xine_ts_from_string(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by mpd_input_open().

## ◆ mpd_input_open()

static int mpd_input_open | ( | input_plugin_t * | this_gen | ) |
| static

References mpd_stream_info_t::bitrate, multirate_pref_t::bitrate, mpd_stream_info_t::h, mpd_input_class_t::input_class, multirate_pref_t::lang, mode(), MPD_INIT_LIVE, MPD_INIT_VOD, mpd_input_load_manifest(), MPD_LIVE, MPD_MAX_REPR, mpd_mode_names, mpd_read_int(), MPD_SINGLE_LIVE, MPD_SINGLE_VOD, mpd_strcasestr(), MPD_TYPE_VIDEO, MPD_VOD, multirate_autoselect(), NULL, mpd_input_class_t::pref, type, v, multirate_pref_t::video_height, multirate_pref_t::video_width, mpd_stream_info_t::w, xine_mfrag_list_open(), xine_mfrag_set_index_frag(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by mpd_input_get_instance().

## ◆ mpd_input_read()

static off_t mpd_input_read | ( | input_plugin_t * | this_gen,
|  | void * | buf,
|  | off_t | len )
| static

References mpd_read_int().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_read_block()

static buf_element_t * mpd_input_read_block | ( | input_plugin_t * | this_gen,
|  | fifo_buffer_t * | fifo,
|  | off_t | todo )
| static

References NULL.

Referenced by mpd_input_get_instance().

## ◆ mpd_input_seek()

static off_t mpd_input_seek | ( | input_plugin_t * | this_gen,
|  | off_t | offset,
|  | int | origin )
| static

References INPUT_CAP_SEEKABLE, INPUT_CAP_SLOW_SEEKABLE, mpd_frag_end(), mpd_frag_seen(), MPD_IS_LIVE, mpd_read_int(), mpd_set_frag_index(), NULL, xine_mfrag_find_pos(), xine_mfrag_get_frag_count(), and xine_mfrag_get_index_start().

Referenced by mpd_input_get_instance().

## ◆ mpd_input_switch_mrl()

static int mpd_input_switch_mrl | ( | mpd_input_plugin_t * | this | ) |
| static

References _x_find_input_plugin(), _x_free_input_plugin(), INPUT_CAP_NEW_MRL, INPUT_OPTIONAL_DATA_NEW_MRL, INPUT_OPTIONAL_SUCCESS, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by mpd_read_int(), mpd_set_frag_index(), and mpd_set_start_time().

## ◆ mpd_input_time_seek()

static off_t mpd_input_time_seek | ( | input_plugin_t * | this_gen,
|  | int | time_offs,
|  | int | origin )
| static

References mpd_frag_seen(), mpd_set_frag_index(), NULL, xine_mfrag_find_time(), xine_mfrag_get_frag_count(), and xine_mfrag_get_index_start().

Referenced by mpd_input_get_instance().

## ◆ mpd_prepare_fragnum()

static void mpd_prepare_fragnum | ( | mpd_input_plugin_t * | this | ) |
| static

References mpd_strcasestr().

Referenced by mpd_set_start_time().

## ◆ mpd_read_int()

static ssize_t mpd_read_int | ( | mpd_input_plugin_t * | this,
|  | void * | buf,
|  | size_t | len,
|  | int | wait )
| static

References mode(), mpd_apply_fragnum(), mpd_build_mrl(), mpd_frag_end(), mpd_frag_seen(), mpd_input_switch_mrl(), mpd_set_frag_index(), mpd_set_start_time(), MPD_SINGLE_LIVE, and MPD_SINGLE_VOD.

Referenced by mpd_input_open(), mpd_input_read(), and mpd_input_seek().

## ◆ mpd_set_frag_index()

static int mpd_set_frag_index | ( | mpd_input_plugin_t * | this,
|  | uint32_t | index,
|  | int | wait )
| static

References _x_io_select(), INPUT_CAP_NEW_MRL, INPUT_OPTIONAL_DATA_NEW_MRL, mpd_apply_fragnum(), mpd_input_switch_mrl(), MPD_IS_LIVE, now(), xine_gettime(), xine_ts_add(), xine_ts_sub(), xine_ts_to_timebase(), and XIO_TIMEOUT.

Referenced by mpd_input_seek(), mpd_input_time_seek(), and mpd_read_int().

## ◆ mpd_set_start_time()

static int mpd_set_start_time | ( | mpd_input_plugin_t * | this | ) |
| static

References xine_rats_t::den, mpd_input_plugin_s::init, mpd_input_plugin_s::lag, mpd_build_mrl(), mpd_input_switch_mrl(), MPD_IS_LIVE, mpd_prepare_fragnum(), xine_rats_t::num, mpd_input_plugin_s::play_start, mpd_input_plugin_s::sync, mpd_input_plugin_s::type, xine_gettime(), xine_rats_shorten(), xine_ts_from_string(), xine_ts_sub(), xine_ts_to_timebase(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by mpd_read_int().

## ◆ mpd_strcasestr()

static char * mpd_strcasestr | ( | const char * | haystack,
|  | const char * | needle )
| static

References NULL, and z.

Referenced by mpd_build_mrl(), mpd_input_load_manifest(), mpd_input_open(), and mpd_prepare_fragnum().

## ◆ mpd_stree_find()

static uint32_t mpd_stree_find | ( | mpd_input_plugin_t * | this,
|  | const char * | path,
|  | uint32_t | base )
| static

References xine_stree_find().

Referenced by mpd_input_load_manifest().

## ◆ str2uint32()

static uint32_t str2uint32 | ( | char ** | s | ) |
| static

References v, and z.

Referenced by mpd_input_load_manifest().

## ◆ xine_gettime()

static int xine_gettime | ( | struct timespec * | ts | ) |
| inlinestatic

References NULL.

Referenced by mpd_set_frag_index(), and mpd_set_start_time().

## Variable Documentation

## ◆ mpd_mode_names

const char* mpd_mode_names[MPD_MODE_LAST]
| static

Initial value:
= {
[MPD_LIVE] = "non seekable live mode",
[MPD_SINGLE_LIVE] = "non seekable single file live mode",
[MPD_INIT_LIVE] = "non seekable live mode with init fragment",
[MPD_VOD] = "seekable VOD mode",
[MPD_SINGLE_VOD] = "seekable single file VOD mode",
[MPD_INIT_VOD] = "seekable VOD mode with init fragment"
}
MPD_VOD
@ MPD_VOD
Definition input_mpegdash.c:81
MPD_INIT_VOD
@ MPD_INIT_VOD
Definition input_mpegdash.c:83
MPD_SINGLE_VOD
@ MPD_SINGLE_VOD
Definition input_mpegdash.c:82
MPD_INIT_LIVE
@ MPD_INIT_LIVE
Definition input_mpegdash.c:80
MPD_SINGLE_LIVE
@ MPD_SINGLE_LIVE
Definition input_mpegdash.c:79
MPD_LIVE
@ MPD_LIVE
Definition input_mpegdash.c:78

Referenced by mpd_input_open().