xine-lib: xine-lib-1.2.12/src/xine-engine/net_buf_ctrl.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Functions
net_buf_ctrl.c File Reference
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <pthread.h>`
`#include <errno.h>`
`#include "xine_private.h"`

## Data Structures
struct | xine_nbc_fifo_info_t
struct | xine_nbc_st

## Macros
#define | LOG_MODULE "net_buf_ctrl"
#define | LOG_VERBOSE
#define | XINE_LIVE_PAUSE_ON 0x7ffffffd
#define | DEFAULT_HIGH_WATER_MARK 5000 /* in 1/1000 s */
#define | FULL_FIFO_MARK 5 /* buffers free */
#define | FIFO_PUT 0
#define | FIFO_GET 1
#define | NBC_HSIZE_LD 10
#define | NBC_HSIZE_NUM (1 << NBC_HSIZE_LD)
#define | NBC_HSIZE_MASK (NBC_HSIZE_NUM - 1)

## Functions
static void | nbc_set_speed (xine_nbc_t *this, int speed_val)
static void | nbc_delay_init (xine_nbc_t *this)
static void | nbc_delay_unpause (xine_nbc_t *this, int delay)
static void * | nbc_delay_thread (void *data)
static void | nbc_delay_base (xine_nbc_t *this)
static void | nbc_delay_set (xine_nbc_t *this, uint32_t pts)
static void | nbc_delay_clean (xine_nbc_t *this)
static void | nbc_delay_stop (xine_nbc_t *this)
static void | nbc_stats_reset (xine_nbc_t *this)
static void | nbc_stats_flat (xine_nbc_t *this, int pts)
static int | nbc_stats_add (xine_nbc_t *this, int pts)
static void | report_progress (xine_stream_t *stream, int p)
static void | dvbspeed_init (xine_nbc_t *this)
static void | dvbspeed_close (xine_nbc_t *this)
static int | dvbspeed_put (xine_nbc_fifo_info_t *fifo_info)
static int | dvbspeed_get (xine_nbc_fifo_info_t *fifo_info)
void | xine_nbc_event (xine_stream_private_t *stream, uint32_t type)
static void | display_stats (xine_nbc_t *this)
static void | report_stats (xine_nbc_t *this, int type)
static void | nbc_compute_fifo_length (xine_nbc_t *this, fifo_buffer_t *fifo, buf_element_t *buf, int action)
static void | nbc_alloc_cb (fifo_buffer_t *fifo, void *data)
static void | nbc_put_cb (fifo_buffer_t *fifo, buf_element_t *buf, void *data)
static void | nbc_get_cb (fifo_buffer_t *fifo, buf_element_t *buf, void *data)
int64_t | xine_nbc_get_pos_pts (xine_nbc_t *this)
xine_nbc_t * | xine_nbc_init (xine_stream_t *stream)
void | xine_nbc_close (xine_nbc_t *this)

## Macro Definition Documentation

## ◆ DEFAULT_HIGH_WATER_MARK

#define DEFAULT_HIGH_WATER_MARK 5000 /* in 1/1000 s */

## ◆ FIFO_GET

#define FIFO_GET 1

## ◆ FIFO_PUT

#define FIFO_PUT 0

## ◆ FULL_FIFO_MARK

#define FULL_FIFO_MARK 5 /* buffers free */

## ◆ LOG_MODULE

#define LOG_MODULE "net_buf_ctrl"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ NBC_HSIZE_LD

#define NBC_HSIZE_LD 10

## ◆ NBC_HSIZE_MASK

#define NBC_HSIZE_MASK (NBC_HSIZE_NUM - 1)

## ◆ NBC_HSIZE_NUM

#define NBC_HSIZE_NUM (1 << NBC_HSIZE_LD)

## ◆ XINE_LIVE_PAUSE_ON

#define XINE_LIVE_PAUSE_ON 0x7ffffffd

## Function Documentation

## ◆ display_stats()

static void display_stats | ( | xine_nbc_t * | this | ) |
| static

References enabled, and isatty().

Referenced by nbc_get_cb(), and nbc_put_cb().

## ◆ dvbspeed_close()

static void dvbspeed_close | ( | xine_nbc_t * | this | ) |
| static

References nbc_delay_stop(), nbc_set_speed(), XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by nbc_put_cb().

## ◆ dvbspeed_get()

static int dvbspeed_get | ( | xine_nbc_fifo_info_t * | fifo_info | ) |
| static

References BUF_VIDEO_BASE, xine_nbc_fifo_info_t::fifo_fill, xine_nbc_fifo_info_t::fill_pts, name, xine_nbc_fifo_info_t::nbc, nbc_delay_clean(), nbc_stats_add(), nbc_stats_reset(), xine_nbc_fifo_info_t::out_pts, xine_nbc_fifo_info_t::type, XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by nbc_get_cb().

## ◆ dvbspeed_init()

static void dvbspeed_init | ( | xine_nbc_t * | this | ) |
| static

References xine_s::config, INPUT_CAP_LIVE, nbc_delay_init(), xine_cfg_entry_s::num_value, config_values_s::update_num, xine_config_lookup_entry(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by nbc_put_cb().

## ◆ dvbspeed_put()

static int dvbspeed_put | ( | xine_nbc_fifo_info_t * | fifo_info | ) |
| static

References _x_get_fine_speed(), BUF_VIDEO_BASE, fifo_buffer_s::buffer_pool_capacity, xine_nbc_fifo_info_t::fifo, xine_nbc_fifo_info_t::fifo_fill, xine_nbc_fifo_info_t::fill_pts, name, xine_nbc_fifo_info_t::nbc, nbc_delay_base(), nbc_delay_set(), nbc_stats_add(), nbc_stats_flat(), xine_nbc_fifo_info_t::out_pts, xine_nbc_fifo_info_t::type, XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by nbc_put_cb().

## ◆ nbc_alloc_cb()

static void nbc_alloc_cb | ( | fifo_buffer_t * | fifo,
|  | void * | data
| ) |  |
| static

References fifo_buffer_s::buffer_pool_num_free, enabled, FULL_FIFO_MARK, lprintf, nbc_set_speed(), report_progress(), XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by xine_nbc_close(), and xine_nbc_init().

## ◆ nbc_compute_fifo_length()

static void nbc_compute_fifo_length | ( | xine_nbc_t * | this,
|  | fifo_buffer_t * | fifo,
|  | buf_element_t * | buf,
|  | int | action
| ) |  |
| static

References xine_nbc_fifo_info_t::br, fifo_buffer_s::buffer_pool_num_free, fifo_buffer_s::fifo_data_size, xine_nbc_fifo_info_t::fifo_fill, xine_nbc_fifo_info_t::fifo_free, xine_nbc_fifo_info_t::fifo_length, xine_nbc_fifo_info_t::fifo_length_int, FIFO_PUT, fifo_buffer_s::fifo_size, xine_nbc_fifo_info_t::fifo_size, xine_nbc_fifo_info_t::first_pts, xine_nbc_fifo_info_t::in_disc, xine_stream_private_st::info_lock, xine_nbc_fifo_info_t::last_pts, buf_element_s::pts, xine_nbc_fifo_info_t::stream_br, xine_stream_private_st::stream_info, xine_rwlock_rdlock, xine_rwlock_unlock, XINE_STREAM_INFO_AUDIO_BITRATE, XINE_STREAM_INFO_HAS_AUDIO, XINE_STREAM_INFO_HAS_VIDEO, and XINE_STREAM_INFO_VIDEO_BITRATE.

Referenced by nbc_get_cb(), and nbc_put_cb().

## ◆ nbc_delay_base()

static void nbc_delay_base | ( | xine_nbc_t * | this | ) |
| static

References xine_gettime().

Referenced by dvbspeed_put().

## ◆ nbc_delay_clean()

static void nbc_delay_clean | ( | xine_nbc_t * | this | ) |
| static

Referenced by dvbspeed_get().

## ◆ nbc_delay_init()

static void nbc_delay_init | ( | xine_nbc_t * | this | ) |
| static

Referenced by dvbspeed_init().

## ◆ nbc_delay_set()

static void nbc_delay_set | ( | xine_nbc_t * | this,
|  | uint32_t | pts
| ) |  |
| static

References nbc_delay_thread(), nbc_delay_unpause(), NULL, and xine_gettime().

Referenced by dvbspeed_put().

## ◆ nbc_delay_stop()

static void nbc_delay_stop | ( | xine_nbc_t * | this | ) |
| static

References nbc_set_speed(), and XINE_FINE_SPEED_NORMAL.

Referenced by dvbspeed_close().

## ◆ nbc_delay_thread()

static void * nbc_delay_thread | ( | void * | data | ) |
| static

References nbc_delay_unpause(), and NULL.

Referenced by nbc_delay_set().

## ◆ nbc_delay_unpause()

static void nbc_delay_unpause | ( | xine_nbc_t * | this,
|  | int | delay
| ) |  |
| static

References _x_lock_port_rewiring(), _x_unlock_port_rewiring(), AO_PROP_PTS_IN_FIFO, nbc_set_speed(), XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by nbc_delay_set(), and nbc_delay_thread().

## ◆ nbc_get_cb()

static void nbc_get_cb | ( | fifo_buffer_t * | fifo,
|  | buf_element_t * | buf,
|  | void * | data
| ) |  |
| static

References _x_lock_port_rewiring(), _x_unlock_port_rewiring(), AO_PROP_PTS_IN_FIFO, BUF_AUDIO_BASE, BUF_CONTROL_BASE, BUF_CONTROL_NEWPTS, BUF_MAJOR_MASK, fifo_buffer_s::buffer_pool_num_free, display_stats(), dvbspeed_get(), enabled, fifo_buffer_s::fifo_data_size, xine_nbc_fifo_info_t::fifo_fill, xine_nbc_fifo_info_t::fifo_free, FIFO_GET, fifo_buffer_s::fifo_size, xine_nbc_fifo_info_t::fifo_size, xine_nbc_fifo_info_t::fill_pts, FULL_FIFO_MARK, xine_nbc_fifo_info_t::last_out_pts, lprintf, xine_nbc_fifo_info_t::nbc, nbc_compute_fifo_length(), nbc_set_speed(), xine_nbc_fifo_info_t::out_pts, buf_element_s::pts, report_progress(), report_stats(), buf_element_s::type, xine_nbc_fifo_info_t::type, type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by xine_nbc_close(), and xine_nbc_init().

## ◆ nbc_put_cb()

static void nbc_put_cb | ( | fifo_buffer_t * | fifo,
|  | buf_element_t * | buf,
|  | void * | data
| ) |  |
| static

References _x_lock_port_rewiring(), _x_unlock_port_rewiring(), AO_PROP_PTS_IN_FIFO, BUF_AUDIO_BASE, BUF_CONTROL_BASE, BUF_CONTROL_END, BUF_CONTROL_NEWPTS, BUF_CONTROL_NOP, BUF_CONTROL_QUIT, BUF_CONTROL_START, BUF_FLAG_END_STREAM, BUF_FLAG_END_USER, BUF_MAJOR_MASK, fifo_buffer_s::buffer_pool_num_free, buf_element_s::decoder_flags, display_stats(), dvbspeed_close(), dvbspeed_init(), dvbspeed_put(), enabled, fifo_buffer_s::fifo_data_size, xine_nbc_fifo_info_t::fifo_fill, xine_nbc_fifo_info_t::fifo_free, FIFO_PUT, fifo_buffer_s::fifo_size, xine_nbc_fifo_info_t::fifo_size, xine_nbc_fifo_info_t::fill_pts, xine_nbc_fifo_info_t::last_in_pts, xine_nbc_fifo_info_t::last_out_pts, lprintf, xine_nbc_fifo_info_t::nbc, nbc_compute_fifo_length(), nbc_set_speed(), xine_nbc_fifo_info_t::out_pts, xine_nbc_fifo_info_t::pos_pts, buf_element_s::pts, report_progress(), report_stats(), buf_element_s::type, xine_nbc_fifo_info_t::type, type, XINE_FINE_SPEED_NORMAL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by xine_nbc_close(), and xine_nbc_init().

## ◆ nbc_set_speed()

static void nbc_set_speed | ( | xine_nbc_t * | this,
|  | int | speed_val
| ) |  |
| static

References _x_set_fine_speed(), and XINE_LIVE_PAUSE_ON.

Referenced by dvbspeed_close(), nbc_alloc_cb(), nbc_delay_stop(), nbc_delay_unpause(), nbc_get_cb(), nbc_put_cb(), and xine_nbc_event().

## ◆ nbc_stats_add()

static int nbc_stats_add | ( | xine_nbc_t * | this,
|  | int | pts
| ) |  |
| static

References NBC_HSIZE_MASK, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by dvbspeed_get(), and dvbspeed_put().

## ◆ nbc_stats_flat()

static void nbc_stats_flat | ( | xine_nbc_t * | this,
|  | int | pts
| ) |  |
| static

References NBC_HSIZE_NUM.

Referenced by dvbspeed_put().

## ◆ nbc_stats_reset()

static void nbc_stats_reset | ( | xine_nbc_t * | this | ) |
| static

References NBC_HSIZE_NUM.

Referenced by dvbspeed_get(), xine_nbc_event(), and xine_nbc_init().

## ◆ report_progress()

static void report_progress | ( | xine_stream_t * | stream,
|  | int | p
| ) |  |
| static

References _, xine_progress_data_t::description, xine_progress_data_t::percent, XINE_EVENT_PROGRESS, and xine_event_send().

Referenced by nbc_alloc_cb(), nbc_get_cb(), and nbc_put_cb().

## ◆ report_stats()

static void report_stats | ( | xine_nbc_t * | this,
|  | int | type
| ) |  |
| static

References xine_nbc_stats_data_t::a_bitrate, xine_nbc_stats_data_t::a_in_disc, xine_nbc_stats_data_t::a_percent, xine_nbc_stats_data_t::a_remaining, xine_nbc_stats_data_t::buffering, xine_nbc_stats_data_t::enabled, enabled, xine_nbc_stats_data_t::type, type, xine_nbc_stats_data_t::v_bitrate, xine_nbc_stats_data_t::v_in_disc, xine_nbc_stats_data_t::v_percent, xine_nbc_stats_data_t::v_remaining, XINE_EVENT_NBC_STATS, and xine_event_send().

Referenced by nbc_get_cb(), and nbc_put_cb().

## ◆ xine_nbc_close()

void xine_nbc_close | ( | xine_nbc_t * | this | ) |

References xine_stream_private_st::counter, xine_stream_private_st::lock, xine_stream_private_st::nbc, nbc_alloc_cb(), nbc_get_cb(), nbc_put_cb(), xine_stream_private_st::nbc_refs, NULL, xine_stream_private_st::refs, fifo_buffer_s::unregister_alloc_cb, fifo_buffer_s::unregister_get_cb, fifo_buffer_s::unregister_put_cb, xine_refs_sub(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_dispose(), and xine_nbc_event().

## ◆ xine_nbc_event()

void xine_nbc_event | ( | xine_stream_private_t * | stream,
|  | uint32_t | type
| ) |  |

References xine_stream_private_st::counter, xine_stream_private_st::lock, xine_stream_private_st::nbc, xine_stream_private_st::nbc_refs, nbc_set_speed(), nbc_stats_reset(), xine_stream_private_st::side_streams, type, xine_nbc_close(), XINE_NBC_EVENT_AUDIO_DRY, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_out_fifo_get().

## ◆ xine_nbc_get_pos_pts()

int64_t xine_nbc_get_pos_pts | ( | xine_nbc_t * | this | ) |

Referenced by hls_live_start(), and hls_live_wait().

## ◆ xine_nbc_init()

xine_nbc_t * xine_nbc_init | ( | xine_stream_t * | stream | ) |

References _x_get_fine_speed(), xine_stream_s::audio_fifo, BUF_AUDIO_BASE, BUF_VIDEO_BASE, xine_s::config, xine_stream_private_st::counter, DEFAULT_HIGH_WATER_MARK, xine_stream_private_st::lock, config_values_s::lookup_entry, lprintf, xine_stream_private_st::nbc, nbc_alloc_cb(), nbc_get_cb(), nbc_put_cb(), xine_stream_private_st::nbc_refs, nbc_stats_reset(), NULL, cfg_entry_s::num_default, xine_stream_private_st::refs, xine_stream_private_st::s, xine_stream_private_st::side_streams, xine_stream_s::video_fifo, xine_stream_s::xine, xine_refs_add(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by hls_input_get_instance().