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

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
input_hls.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <sys/types.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/mfrag.h>`
`#include "http_helper.h"`
`#include "input_helper.h"`
`#include "group_network.h"`
`#include "multirate_pref.c"`

## Data Structures
struct | hls_input_class_t
struct | hls_byterange_t
struct | hls_input_plugin_s

## Macros
#define | LOG_MODULE "input_hls"
#define | LOG_VERBOSE
#define | HLS_NO_FRAGMENT (~0u)
#define | HLS_MAX_ITEMS 20
#define | HLS_MAX_MRL 4096

## Typedefs
typedef struct hls_input_plugin_s | hls_input_plugin_t

## Enumerations
enum | hls_arg_type_t { HLS_A_none = 0 , HLS_A_AUDIO , HLS_A_AUTOSELECT , HLS_A_AVERAGE_BANDWIDTH , HLS_A_BANDWIDTH , HLS_A_BYTERANGE , HLS_A_CODECS , HLS_A_DEFAULT , HLS_A_FRAME_RATE , HLS_A_GROUP_ID , HLS_A_LANGUAGE , HLS_A_NAME , HLS_A_RESOLUTION , HLS_A_TYPE , HLS_A_URI , HLS_A_VIDEO_RANGE , HLS_A_last }

## Functions
static int | xine_gettime (struct timespec *ts)
static int | hls_get_duration (hls_input_plugin_t *this)
static off_t | hls_get_size (hls_input_plugin_t *this)
static uint32_t | hls_frag_start (hls_input_plugin_t *this)
static void | hls_frag_end (hls_input_plugin_t *this)
static int | hls_bump_find (hls_input_plugin_t *this, const char *item1, const char *seq)
static int | hls_bump_guess (hls_input_plugin_t *this, const char *item1, const char *item2)
static void | hls_bump_inc (hls_input_plugin_t *this)
static int | hls_input_switch_mrl (hls_input_plugin_t *this)
static int | hls_input_open_bump (hls_input_plugin_t *this)
static int | hls_input_open_item (hls_input_plugin_t *this, uint32_t n)
static int | hls_input_get_mrl_ext (const char *mrl, const char **ext)
static int | hls_input_is_hls (const char *mrl)
static void | hls_skip_spc (char **s)
static void | hls_skip_newline_spc (char **s)
static void | hls_skip_line (char **s)
static void | hls_reset_args (char **a)
static int | hls_parse_args (char **a, char **s)
static uint32_t | str2uint32 (char **s)
static uint64_t | str2uint64 (char **s)
static uint32_t | str2usec (char **s)
static void | hls_parse_byterange (hls_byterange_t *r, char **s)
static int | hls_input_load_list (hls_input_plugin_t *this)
static uint32_t | hls_input_get_capabilities (input_plugin_t *this_gen)
static void | hls_live_start (hls_input_plugin_t *this)
static int | hls_live_wait (hls_input_plugin_t *this)
static off_t | hls_input_read (input_plugin_t *this_gen, void *buf, off_t len)
static buf_element_t * | hls_input_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo)
static off_t | hls_input_time_seek (input_plugin_t *this_gen, int time_offs, int origin)
static off_t | hls_input_seek (input_plugin_t *this_gen, off_t offset, int origin)
static off_t | hls_input_get_current_pos (input_plugin_t *this_gen)
static off_t | hls_input_get_length (input_plugin_t *this_gen)
static const char * | hls_input_get_mrl (input_plugin_t *this_gen)
static void | hls_input_dispose (input_plugin_t *this_gen)
static int | hls_input_open (input_plugin_t *this_gen)
static input_plugin_t * | hls_get_side (hls_input_plugin_t *this, int side_index)
static int | hls_input_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
static input_plugin_t * | hls_input_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *mrl)
static void | hls_input_class_dispose (input_class_t *this_gen)
void * | input_hls_init_class (xine_t *xine, const void *data)

## Variables
static const uint8_t | hls_tab_char [256]

## Macro Definition Documentation

## ◆ HLS_MAX_ITEMS

#define HLS_MAX_ITEMS 20

<< seconds

Referenced by hls_input_load_list().

## ◆ HLS_MAX_MRL

#define HLS_MAX_MRL 4096

Referenced by hls_input_get_instance(), hls_input_open(), hls_input_open_bump(), and hls_input_open_item().

## ◆ HLS_NO_FRAGMENT

#define HLS_NO_FRAGMENT (~0u)

Referenced by hls_input_get_instance(), and hls_input_read().

## ◆ LOG_MODULE

#define LOG_MODULE "input_hls"

Referenced by hls_frag_start(), hls_input_get_instance(), hls_input_load_list(), hls_input_open(), hls_input_open_item(), hls_input_read(), and hls_input_switch_mrl().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Typedef Documentation

## ◆ hls_input_plugin_t

typedef struct hls_input_plugin_s hls_input_plugin_t

## Enumeration Type Documentation

## ◆ hls_arg_type_t

enum hls_arg_type_t

Enumerator
HLS_A_none |
HLS_A_AUDIO |
HLS_A_AUTOSELECT |
HLS_A_AVERAGE_BANDWIDTH |
HLS_A_BANDWIDTH |
HLS_A_BYTERANGE |
HLS_A_CODECS |
HLS_A_DEFAULT |
HLS_A_FRAME_RATE |
HLS_A_GROUP_ID |
HLS_A_LANGUAGE |
HLS_A_NAME |
HLS_A_RESOLUTION |
HLS_A_TYPE |
HLS_A_URI |
HLS_A_VIDEO_RANGE |
HLS_A_last |

## Function Documentation

## ◆ hls_bump_find()

static int hls_bump_find | ( | hls_input_plugin_t * | this,
|  | const char * | item1,
|  | const char * | seq )
| static

References v, and z.

Referenced by hls_input_open().

## ◆ hls_bump_guess()

static int hls_bump_guess | ( | hls_input_plugin_t * | this,
|  | const char * | item1,
|  | const char * | item2 )
| static

References z.

Referenced by hls_input_open().

## ◆ hls_bump_inc()

static void hls_bump_inc | ( | hls_input_plugin_t * | this | ) |
| static

References z.

Referenced by hls_input_read().

## ◆ hls_frag_end()

static void hls_frag_end | ( | hls_input_plugin_t * | this | ) |
| static

References xine_mfrag_set_index_frag().

Referenced by hls_input_read().

## ◆ hls_frag_start()

static uint32_t hls_frag_start | ( | hls_input_plugin_t * | this | ) |
| static

References LOG_MODULE, NULL, xine_mfrag_get_index_frag(), xine_mfrag_set_index_frag(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_open_bump(), and hls_input_open_item().

## ◆ hls_get_duration()

static int hls_get_duration | ( | hls_input_plugin_t * | this | ) |
| static

References NULL, and xine_mfrag_get_index_start().

Referenced by hls_input_get_optional_data(), hls_input_open(), and hls_input_time_seek().

## ◆ hls_get_side()

static input_plugin_t * hls_get_side | ( | hls_input_plugin_t * | this,
|  | int | side_index )
| static

References hls_input_plugin_s::caps1, hls_input_plugin_s::current, hls_input_plugin_s::frag, hls_input_plugin_s::in1, hls_input_plugin_s::init, hls_input_plugin_s::input_offs, hls_input_plugin_s::input_plugin, hls_input_plugin_s::item_mrl, hls_input_plugin_s::items, hls_input_plugin_s::list, hls_input_plugin_s::list_bsize, hls_input_plugin_s::list_buf, hls_input_plugin_s::list_mrl, hls_input_plugin_s::list_seq, hls_input_plugin_s::list_strseq, hls_input_plugin_s::list_strtype, hls_input_plugin_s::mrl_offs, hls_input_plugin_s::mutex, hls_input_plugin_s::nbc, NULL, hls_input_plugin_s::num, hls_input_plugin_s::pos, hls_input_plugin_s::prev_item_mrl, hls_input_plugin_s::prev_size1, hls_input_plugin_s::prev_size2, hls_input_plugin_s::pts, hls_input_plugin_s::refs, hls_input_plugin_s::side_index, hls_input_plugin_s::size, hls_input_plugin_s::stream, hls_input_plugin_s::sync, xine_get_side_stream(), xine_mfrag_list_open(), and xine_nbc_init().

Referenced by hls_input_get_optional_data().

## ◆ hls_get_size()

static off_t hls_get_size | ( | hls_input_plugin_t * | this | ) |
| static

References NULL, and xine_mfrag_get_index_start().

Referenced by hls_input_get_length(), and hls_input_seek().

## ◆ hls_input_class_dispose()

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

References NULL, and config_values_s::unregister_callbacks.

Referenced by input_hls_init_class().

## ◆ hls_input_dispose()

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

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

Referenced by hls_input_get_instance().

## ◆ hls_input_get_capabilities()

static uint32_t hls_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, and INPUT_CAP_TIME_SEEKABLE.

Referenced by hls_input_get_instance().

## ◆ hls_input_get_current_pos()

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

Referenced by hls_input_get_instance().

## ◆ hls_input_get_instance()

static input_plugin_t * hls_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(), hls_input_dispose(), hls_input_get_capabilities(), hls_input_get_current_pos(), hls_input_get_length(), hls_input_get_mrl(), hls_input_get_optional_data(), hls_input_is_hls(), hls_input_open(), hls_input_read(), hls_input_read_block(), hls_input_seek(), hls_input_time_seek(), HLS_MAX_MRL, HLS_NO_FRAGMENT, hls_input_class_t::input_class, LOG_MODULE, lprintf, NULL, input_plugin_s::open, xine_stream_s::xine, xine_nbc_init(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by input_hls_init_class().

## ◆ hls_input_get_length()

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

References hls_get_size().

Referenced by hls_input_get_instance().

## ◆ hls_input_get_mrl()

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

References NULL.

Referenced by hls_input_get_instance().

## ◆ hls_input_get_mrl_ext()

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

Referenced by hls_input_is_hls().

## ◆ hls_input_get_optional_data()

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

References input_plugin_s::get_optional_data, hls_get_duration(), hls_get_side(), INPUT_OPTIONAL_DATA_DURATION, INPUT_OPTIONAL_DATA_FRAGLIST, INPUT_OPTIONAL_DATA_PREVIEW, INPUT_OPTIONAL_DATA_REWIND, INPUT_OPTIONAL_DATA_SIDE, INPUT_OPTIONAL_DATA_SIZED_PREVIEW, INPUT_OPTIONAL_SUCCESS, INPUT_OPTIONAL_UNSUPPORTED, MAX_PREVIEW_SIZE, and NULL.

Referenced by hls_input_get_instance().

## ◆ hls_input_is_hls()

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

References hls_input_get_mrl_ext().

Referenced by hls_input_get_instance().

## ◆ hls_input_load_list()

static int hls_input_load_list | ( | hls_input_plugin_t * | this | ) |
| static

References _x_freep(), HLS_A_AUDIO, HLS_A_BANDWIDTH, HLS_A_BYTERANGE, HLS_A_GROUP_ID, HLS_A_LANGUAGE, HLS_A_last, HLS_A_RESOLUTION, HLS_A_URI, HLS_MAX_ITEMS, hls_parse_args(), hls_parse_byterange(), hls_reset_args(), hls_skip_line(), hls_skip_newline_spc(), hls_skip_spc(), LOG_MODULE, NULL, str2uint32(), str2uint64(), str2usec(), xine_mfrag_list_close(), xine_mfrag_list_open(), xine_mfrag_set_index_frag(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_open(), and hls_input_read().

## ◆ hls_input_open()

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

References _x_merge_mrl(), hls_bump_find(), hls_bump_guess(), hls_get_duration(), hls_input_load_list(), hls_input_open_bump(), hls_input_open_item(), hls_input_read(), hls_input_seek(), hls_input_switch_mrl(), hls_live_start(), HLS_MAX_MRL, hls_input_class_t::input_class, LOG_MODULE, multirate_audio_autoselect(), multirate_autoselect(), NULL, hls_input_class_t::pref, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by hls_input_get_instance().

## ◆ hls_input_open_bump()

static int hls_input_open_bump | ( | hls_input_plugin_t * | this | ) |
| static

References _x_merge_mrl(), hls_frag_start(), hls_input_switch_mrl(), and HLS_MAX_MRL.

Referenced by hls_input_open(), and hls_input_read().

## ◆ hls_input_open_item()

static int hls_input_open_item | ( | hls_input_plugin_t * | this,
|  | uint32_t | n )
| static

References _x_merge_mrl(), hls_frag_start(), hls_input_switch_mrl(), HLS_MAX_MRL, INPUT_CAP_SEEKABLE, INPUT_CAP_SLOW_SEEKABLE, LOG_MODULE, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by hls_input_open(), hls_input_read(), hls_input_seek(), and hls_input_time_seek().

## ◆ hls_input_read()

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

References hls_bump_inc(), hls_frag_end(), hls_input_load_list(), hls_input_open_bump(), hls_input_open_item(), hls_input_switch_mrl(), hls_live_wait(), HLS_NO_FRAGMENT, LOG_MODULE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_get_instance(), and hls_input_open().

## ◆ hls_input_read_block()

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

References NULL.

Referenced by hls_input_get_instance().

## ◆ hls_input_seek()

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

References hls_get_size(), hls_input_open_item(), NULL, xine_mfrag_find_pos(), and xine_mfrag_get_index_start().

Referenced by hls_input_get_instance(), and hls_input_open().

## ◆ hls_input_switch_mrl()

static int hls_input_switch_mrl | ( | hls_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, LOG_MODULE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_open(), hls_input_open_bump(), hls_input_open_item(), and hls_input_read().

## ◆ hls_input_time_seek()

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

References hls_get_duration(), hls_input_open_item(), NULL, xine_mfrag_find_time(), and xine_mfrag_get_index_start().

Referenced by hls_input_get_instance().

## ◆ hls_live_start()

static void hls_live_start | ( | hls_input_plugin_t * | this | ) |
| static

References xine_gettime(), and xine_nbc_get_pos_pts().

Referenced by hls_input_open().

## ◆ hls_live_wait()

static int hls_live_wait | ( | hls_input_plugin_t * | this | ) |
| static

References _x_io_select(), INPUT_CAP_NEW_MRL, INPUT_OPTIONAL_DATA_NEW_MRL, now(), xine_gettime(), xine_nbc_get_pos_pts(), and XIO_TIMEOUT.

Referenced by hls_input_read().

## ◆ hls_parse_args()

static int hls_parse_args | ( | char ** | a,
|  | char ** | s )
| static

References HLS_A_AUDIO, HLS_A_AUTOSELECT, HLS_A_AVERAGE_BANDWIDTH, HLS_A_BANDWIDTH, HLS_A_BYTERANGE, HLS_A_CODECS, HLS_A_DEFAULT, HLS_A_FRAME_RATE, HLS_A_GROUP_ID, HLS_A_LANGUAGE, HLS_A_NAME, HLS_A_RESOLUTION, HLS_A_TYPE, HLS_A_URI, HLS_A_VIDEO_RANGE, hls_tab_char, key, and NULL.

Referenced by hls_input_load_list().

## ◆ hls_parse_byterange()

static void hls_parse_byterange | ( | hls_byterange_t * | r,
|  | char ** | s )
| static

References hls_skip_spc(), hls_byterange_t::len, hls_byterange_t::offs, str2uint32(), and str2uint64().

Referenced by hls_input_load_list().

## ◆ hls_reset_args()

static void hls_reset_args | ( | char ** | a | ) |
| static

References HLS_A_last, and NULL.

Referenced by hls_input_load_list().

## ◆ hls_skip_line()

static void hls_skip_line | ( | char ** | s | ) |
| static

References hls_tab_char.

Referenced by hls_input_load_list().

## ◆ hls_skip_newline_spc()

static void hls_skip_newline_spc | ( | char ** | s | ) |
| static

References hls_tab_char.

Referenced by hls_input_load_list().

## ◆ hls_skip_spc()

static void hls_skip_spc | ( | char ** | s | ) |
| static

References hls_tab_char.

Referenced by hls_input_load_list(), and hls_parse_byterange().

## ◆ input_hls_init_class()

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

References xine_s::config, hls_input_class_dispose(), hls_input_get_instance(), multirate_pref_get(), N_, and NULL.

## ◆ str2uint32()

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

References v, and z.

Referenced by hls_input_load_list(), and hls_parse_byterange().

## ◆ str2uint64()

static uint64_t str2uint64 | ( | char ** | s | ) |
| static

References v, and z.

Referenced by hls_input_load_list(), and hls_parse_byterange().

## ◆ str2usec()

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

References v, and z.

Referenced by hls_input_load_list().

## ◆ xine_gettime()

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

References NULL.

Referenced by _x_demux_control_headers_done(), _x_flush_events_queues(), ao_free_fifo_get(), ao_loop(), ao_out_fifo_get(), audio_decoder_loop(), demux_loop(), hls_live_start(), hls_live_wait(), lock_timeout(), metronom_sync_loop(), nbc_delay_base(), nbc_delay_set(), paused_loop(), play_internal(), ticket_lock_port_rewiring(), video_decoder_loop(), video_out_loop(), vo_free_queue_get(), vo_grab_grab_video_frame(), vo_set_property(), wait_first_frame(), xine_event_wait_locked(), xine_get_next_audio_frame(), and xine_get_next_video_frame().

## Variable Documentation

## ◆ hls_tab_char

const uint8_t hls_tab_char[256]
| static

Initial value:
= {
['\t'] = 1,
[' '] = 1,
['\r'] = 2,
['\n'] = 2,
['"'] = 4,
['\''] = 8,
[','] = 16,
['='] = 32,
[0] = 128
}

Referenced by hls_parse_args(), hls_skip_line(), hls_skip_newline_spc(), and hls_skip_spc().