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

xine-lib 1.2.12

Macros | Functions
demux.c File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include <pthread.h>`
`#include <sched.h>`
`#include <sys/time.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <errno.h>`
`#include <xine/xine_internal.h>`
`#include <xine/demux.h>`
`#include <xine/buffer.h>`
`#include "xine_private.h"`

## Macros
#define | LOG_MODULE "demux"
#define | LOG_VERBOSE

## Functions
void | _x_demux_flush_engine (xine_stream_t *s)
void | _x_demux_control_newpts (xine_stream_t *s, int64_t pts, uint32_t flags)
static int | demux_unstick_ao_loop (xine_stream_t *s)
void | _x_demux_control_headers_done (xine_stream_t *s)
void | _x_demux_control_start (xine_stream_t *s)
void | _x_demux_control_end (xine_stream_t *s, uint32_t flags)
void | _x_demux_control_nop (xine_stream_t *s, uint32_t flags)
static void * | demux_loop (void *stream_gen)
int | _x_demux_called_from (xine_stream_t *s)
int | _x_demux_start_thread (xine_stream_t *s)
int | _x_demux_stop_thread (xine_stream_t *s)
int | _x_demux_read_header (input_plugin_t *input, void *buffer, off_t size)
int | _x_demux_check_extension (const char *mrl, const char *extensions)
off_t | _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo)
int | _x_action_pending (xine_stream_t *s)
void | _x_action_raise (xine_stream_t *s)
void | _x_action_lower (xine_stream_t *s)
void | _x_demux_send_data (fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, int input_normpos, int input_time, int total_time, uint32_t frame_number)
int | _x_demux_read_send_data (fifo_buffer_t *fifo, input_plugin_t *input, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, off_t input_normpos, int input_time, int total_time, uint32_t frame_number)
void | _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, const char *mrl, const char *title, int start_time, int duration)
int | _x_demux_seek (xine_stream_t *s, off_t start_pos, int start_time, int playing)

## Macro Definition Documentation

## ◆ LOG_MODULE

#define LOG_MODULE "demux"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Function Documentation

## ◆ _x_action_lower()

void _x_action_lower | ( | xine_stream_t * | s | ) |

References xine_stream_private_st::action_lock, xine_stream_private_st::action_pending, xine_stream_private_st::demux, and xine_stream_private_st::resume.

Referenced by _x_demux_control_headers_done(), _x_demux_start_thread(), and _x_demux_stop_thread().

## ◆ _x_action_pending()

int _x_action_pending | ( | xine_stream_t * | s | ) |

References xine_stream_private_st::action_lock, xine_stream_private_st::action_pending, and xine_stream_private_st::demux.

Referenced by _ftp_read(), _read(), _scp_channel_init(), _scp_read(), _sftp_get_length(), _sftp_open(), _sftp_read(), _sftp_session_init(), _ssh_connect(), _x_io_select(), _x_read_abort(), _x_spu_decoder_sleep(), bluray_plugin_read(), get_input_buffer(), http_plugin_handshake(), http_plugin_read_int(), sync_next(), and vdr_main_read().

## ◆ _x_action_raise()

void _x_action_raise | ( | xine_stream_t * | s | ) |

References xine_stream_private_st::action_lock, xine_stream_private_st::action_pending, and xine_stream_private_st::demux.

Referenced by _x_demux_control_headers_done(), _x_demux_start_thread(), and _x_demux_stop_thread().

## ◆ _x_demux_called_from()

int _x_demux_called_from | ( | xine_stream_t * | s | ) |

References xine_stream_private_st::demux, xine_stream_private_st::thread, and xine_stream_private_st::thread_running.

Referenced by file_input_read().

## ◆ _x_demux_check_extension()

int _x_demux_check_extension | ( | const char * | mrl,
|  | const char * | extensions
| ) |  |

References NULL, and xine_strsep.

Referenced by _x_find_demux_plugin(), _x_find_demux_plugin_by_name(), and _x_find_demux_plugin_last_probe().

## ◆ _x_demux_control_end()

void _x_demux_control_end | ( | xine_stream_t * | s,
|  | uint32_t | flags
| ) |  |

References xine_stream_s::audio_fifo, BUF_CONTROL_END, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_flags, xine_stream_private_st::demux, xine_stream_private_st::pair, fifo_buffer_s::put, xine_stream_private_st::s, xine_stream_private_st::side_streams, buf_element_s::type, and xine_stream_s::video_fifo.

Referenced by asf_parse_packet_align(), asf_parse_packet_ecd(), demux_loop(), demux_ogg_send_chunk(), dvb_plugin_read(), and stop_internal().

## ◆ _x_demux_control_headers_done()

void _x_demux_control_headers_done | ( | xine_stream_t * | s | ) |

References _, _x_action_lower(), _x_action_raise(), xine_stream_s::audio_fifo, xine_stream_private_st::audio_thread_created, BUF_CONTROL_HEADERS_DONE, fifo_buffer_s::buffer_pool_alloc, xine_stream_private_st::changed, xine_stream_private_st::counter, xine_stream_private_st::demux, demux_unstick_ao_loop(), xine_stream_private_st::emergency_brake, xine_stream_private_st::headers_audio, xine_stream_private_st::headers_video, xine_stream_private_st::lock, lprintf, xine_stream_private_st::pair, fifo_buffer_s::put, xine_stream_private_st::s, xine_stream_private_st::side_streams, buf_element_s::type, xine_stream_s::video_fifo, xine_stream_private_st::video_thread_created, xine_stream_s::xine, xine_gettime(), xine_log(), and XINE_LOG_MSG.

Referenced by _x_demux_flush_engine(), and open_internal().

## ◆ _x_demux_control_newpts()

void _x_demux_control_newpts | ( | xine_stream_t * | s,
|  | int64_t | pts,
|  | uint32_t | flags
| ) |  |

References xine_stream_s::audio_fifo, BUF_CONTROL_NEWPTS, BUF_FLAG_SEEK, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_flags, xine_stream_private_st::demux, buf_element_s::disc_off, xine_stream_private_st::max_seek_bufs, xine_stream_private_st::pair, fifo_buffer_s::put, xine_stream_private_st::s, xine_stream_private_st::side_streams, buf_element_s::type, and xine_stream_s::video_fifo.

Referenced by check_newpts(), demux_aac_seek(), demux_ac3_send_chunk(), demux_aiff_send_chunk(), demux_cdda_send_chunk(), demux_dts_send_chunk(), demux_eawve_seek(), demux_film_send_chunk(), demux_flac_seek(), demux_flac_send_chunk(), demux_fli_seek(), demux_flv_seek(), demux_fourxm_seek(), demux_idcin_seek(), demux_ipmovie_seek(), demux_ivf_send_chunk(), demux_mng_send_headers(), demux_mod_send_chunk(), demux_mpc_seek(), demux_mpgaudio_seek(), demux_mve_send_chunk(), demux_nsf_seek(), demux_nsf_send_chunk(), demux_nsv_seek(), demux_qt_send_chunk(), demux_ra_send_chunk(), demux_raw_dv_seek(), demux_roq_seek(), demux_shn_seek(), demux_slave_next(), demux_snd_send_chunk(), demux_sputext_seek(), demux_str_send_chunk(), demux_tta_seek(), demux_voc_send_chunk(), demux_vox_seek(), demux_wav_send_chunk(), demux_wv_seek(), demux_yuv4mpeg2_seek(), demux_yuv4mpeg2_send_chunk(), newpts_test(), parse_private_stream_2(), switch_buf(), vdr_class_get_instance(), and vdr_execute_rpc_command().

## ◆ _x_demux_control_nop()

void _x_demux_control_nop | ( | xine_stream_t * | s,
|  | uint32_t | flags
| ) |  |

References xine_stream_s::audio_fifo, BUF_CONTROL_NOP, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_flags, xine_stream_private_st::demux, xine_stream_private_st::pair, fifo_buffer_s::put, xine_stream_private_st::s, xine_stream_private_st::side_streams, buf_element_s::type, and xine_stream_s::video_fifo.

Referenced by demux_loop(), open_internal(), and switch_channel().

## ◆ _x_demux_control_start()

void _x_demux_control_start | ( | xine_stream_t * | s | ) |

References xine_stream_s::audio_fifo, BUF_CONTROL_START, BUF_FLAG_GAPLESS_SW, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_flags, xine_stream_private_st::demux, xine_stream_private_st::finished_naturally, xine_stream_private_st::gapless_switch, xine_stream_private_st::id_flag, xine_stream_private_st::pair, fifo_buffer_s::put, xine_stream_private_st::s, xine_stream_private_st::side_streams, xine_stream_private_st::start_buffers_sent, buf_element_s::type, xine_stream_s::video_fifo, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_aac_send_headers(), demux_ac3_send_headers(), demux_aiff_send_headers(), demux_asf_send_headers(), demux_asf_send_headers_common(), demux_aud_send_headers(), demux_avformat_send_headers(), demux_cdda_send_headers(), demux_dts_send_headers(), demux_eawve_send_headers(), demux_film_send_headers(), demux_flac_send_headers(), demux_fli_send_headers(), demux_flv_send_headers(), demux_fourxm_send_headers(), demux_idcin_send_headers(), demux_iff_send_headers(), demux_image_send_headers(), demux_ipmovie_send_headers(), demux_ivf_send_headers(), demux_matroska_send_headers(), demux_mng_send_headers(), demux_mod_send_headers(), demux_mpc_send_headers(), demux_mpeg_block_send_headers(), demux_mpeg_elem_send_headers(), demux_mpeg_pes_send_headers(), demux_mpeg_send_headers(), demux_mpgaudio_send_headers(), demux_mve_send_headers(), demux_nsf_send_headers(), demux_nsv_send_headers(), demux_ogg_send_chunk(), demux_ogg_send_headers(), demux_playlist_send_headers(), demux_pva_send_headers(), demux_qt_send_headers(), demux_ra_send_headers(), demux_raw_dv_send_headers(), demux_roq_send_headers(), demux_shn_send_headers(), demux_slave_send_headers(), demux_smjpeg_send_headers(), demux_snd_send_headers(), demux_sputext_send_headers(), demux_str_send_headers(), demux_ts_event_handler(), demux_ts_send_headers(), demux_tta_send_headers(), demux_vc1_es_send_headers(), demux_vmd_send_headers(), demux_voc_send_headers(), demux_vox_send_headers(), demux_vqa_send_headers(), demux_wav_send_headers(), demux_wv_send_headers(), demux_yuv4mpeg2_send_headers(), demux_yuv_frames_send_headers(), dvb_plugin_read(), real_parse_headers(), and vdr_start_buffers().

## ◆ _x_demux_flush_engine()

void _x_demux_flush_engine | ( | xine_stream_t * | s | ) |

References _x_demux_control_headers_done(), xine_ticket_s::acquire, AO_PROP_DISCARD_BUFFERS, xine_stream_s::audio_fifo, xine_stream_s::audio_out, BUF_CONTROL_RESET_DECODER, fifo_buffer_s::buffer_pool_alloc, fifo_buffer_s::clear, xine_stream_private_st::demux, xine_stream_private_st::finished_naturally, xine_audio_port_s::flush, xine_video_port_s::flush, video_overlay_manager_s::flush_events, xine_stream_private_st::gapless_switch, xine_video_port_s::get_overlay_manager, xine_stream_s::master, xine_stream_private_st::pair, xine_private_t::port_ticket, fifo_buffer_s::put, xine_ticket_s::release, xine_stream_private_st::s, xine_audio_port_s::set_property, xine_video_port_s::set_property, xine_stream_private_st::side_streams, buf_element_s::type, xine_stream_s::video_fifo, xine_stream_s::video_out, VO_PROP_DISCARD_FRAMES, and xine_stream_s::xine.

Referenced by _x_demux_stop_thread(), demux_ac3_seek(), demux_aiff_seek(), demux_asf_seek(), demux_aud_seek(), demux_avformat_seek(), demux_avi_seek_internal(), demux_cdda_seek(), demux_dts_seek(), demux_film_seek(), demux_flac_seek(), demux_flv_seek(), demux_iff_seek(), demux_ivf_seek(), demux_matroska_seek(), demux_mod_seek(), demux_mpeg_block_seek(), demux_mpeg_elem_seek(), demux_mpeg_pes_seek(), demux_mpeg_seek(), demux_mpgaudio_seek(), demux_mve_seek(), demux_nsf_seek(), demux_ogg_seek(), demux_pva_seek(), demux_qt_seek(), demux_ra_seek(), demux_raw_dv_seek(), demux_real_seek(), demux_slave_next(), demux_snd_seek(), demux_sputext_seek(), demux_str_seek(), demux_ts_seek(), demux_tta_seek(), demux_vc1_es_seek(), demux_voc_seek(), demux_wav_seek(), demux_yuv4mpeg2_seek(), dvd_plugin_read_block(), external_stream_stop(), pvr_event_handler(), stream_reset(), switch_channel(), v4l_event_handler(), vcd_flush_buffers(), vcd_handle_events(), and vdr_execute_rpc_command().

## ◆ _x_demux_read_header()

int _x_demux_read_header | ( | input_plugin_t * | input,
|  | void * | buffer,
|  | off_t | size
| ) |  |

References input(), INPUT_CAP_PREVIEW, INPUT_CAP_SEEKABLE, INPUT_CAP_SIZED_PREVIEW, INPUT_OPTIONAL_DATA_PREVIEW, INPUT_OPTIONAL_DATA_SIZED_PREVIEW, and MAX_PREVIEW_SIZE.

Referenced by detect_anx_content(), detect_by_content(), detect_mpgaudio_file(), detect_ogg_content(), hls_input_get_instance(), mpd_input_get_instance(), open_ac3_file(), open_aud_file(), open_dts_file(), open_flac_file(), open_fli_file(), open_idcin_file(), open_iff_file(), open_ipmovie_file(), open_mpc_file(), open_nsv_file(), open_plugin(), open_ra_file(), open_smjpeg_file(), open_snd_file(), open_vmd_file(), open_wv_file(), open_yuv4mpeg2_file(), probe_aac_file(), probe_aiff_file(), probe_film_file(), probe_fourxm_file(), probe_mod_file(), probe_mve_file(), probe_shn_file(), probe_snd_file(), probe_tta_file(), probe_voc_file(), probe_vqa_file(), probe_wav_file(), and real_check_stream_type().

## ◆ _x_demux_read_send_data()

int _x_demux_read_send_data | ( | fifo_buffer_t * | fifo,
|  | input_plugin_t * | input,
|  | int | size,
|  | int64_t | pts,
|  | uint32_t | type,
|  | uint32_t | decoder_flags,
|  | off_t | input_normpos,
|  | int | input_time,
|  | int | total_time,
|  | uint32_t | frame_number
| ) |  |

References _x_assert, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, fifo_buffer_s::buffer_pool_size_alloc, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::extra_info, extra_info_s::frame_number, buf_element_s::free_buffer, input(), extra_info_s::input_normpos, extra_info_s::input_time, buf_element_s::max_size, buf_element_s::pts, fifo_buffer_s::put, buf_element_s::size, extra_info_s::total_time, buf_element_s::type, and type.

Referenced by demux_ivf_send_chunk(), demux_ra_send_chunk(), demux_real_send_chunk(), and demux_tta_send_chunk().

## ◆ _x_demux_seek()

int _x_demux_seek | ( | xine_stream_t * | s,
|  | off_t | start_pos,
|  | int | start_time,
|  | int | playing
| ) |  |

References xine_stream_private_st::demux, xine_stream_private_st::frontend_lock, xine_stream_private_st::plugin, demux_plugin_s::seek, and xine_stream_private_st::side_streams.

Referenced by trick_speed_send_event(), and vdr_execute_rpc_command().

## ◆ _x_demux_send_data()

void _x_demux_send_data | ( | fifo_buffer_t * | fifo,
|  | uint8_t * | data,
|  | int | size,
|  | int64_t | pts,
|  | uint32_t | type,
|  | uint32_t | decoder_flags,
|  | int | input_normpos,
|  | int | input_time,
|  | int | total_time,
|  | uint32_t | frame_number
| ) |  |

References _x_assert, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, fifo_buffer_s::buffer_pool_size_alloc, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::extra_info, extra_info_s::frame_number, extra_info_s::input_normpos, extra_info_s::input_time, buf_element_s::max_size, buf_element_s::pts, fifo_buffer_s::put, buf_element_s::size, extra_info_s::total_time, buf_element_s::type, type, and xine_fast_memcpy.

Referenced by demux_ra_send_chunk(), demux_real_send_chunk(), handle_dvbsub(), handle_hdmv_pgs(), handle_realvideo(), handle_vp9(), parse_block(), send_avpacket(), and send_ogg_buf().

## ◆ _x_demux_send_mrl_reference()

void _x_demux_send_mrl_reference | ( | xine_stream_t * | stream,
|  | int | alternative,
|  | const char * | mrl,
|  | const char * | title,
|  | int | start_time,
|  | int | duration
| ) |  |

References xine_event_t::data_length, XINE_DISABLE_DEPRECATION_WARNINGS, XINE_ENABLE_DEPRECATION_WARNINGS, XINE_EVENT_MRL_REFERENCE, XINE_EVENT_MRL_REFERENCE_EXT, and xine_event_send().

Referenced by demux_asf_parse_asf_references(), demux_asf_parse_asx_references(), demux_asf_parse_http_references(), demux_qt_send_chunk(), demux_real_parse_references(), parse_asx(), parse_m3u(), parse_pls(), parse_qtl(), parse_ram(), parse_ref(), parse_rss(), parse_smi(), and parse_xspf().

## ◆ _x_demux_start_thread()

int _x_demux_start_thread | ( | xine_stream_t * | s | ) |

References _x_action_lower(), _x_action_raise(), xine_stream_private_st::demux, demux_loop(), xine_stream_private_st::lock, lprintf, NULL, xine_stream_private_st::s, xine_stream_private_st::thread, xine_stream_private_st::thread_created, xine_stream_private_st::thread_running, XINE_VERBOSITY_LOG, and xprintf.

## ◆ _x_demux_stop_thread()

int _x_demux_stop_thread | ( | xine_stream_t * | s | ) |

References _x_action_lower(), _x_action_raise(), _x_demux_flush_engine(), xine_stream_private_st::demux, xine_stream_private_st::first_frame, xine_stream_private_st::flag, xine_stream_private_st::lock, lprintf, xine_stream_private_st::reached, xine_stream_private_st::s, xine_stream_private_st::side_streams, xine_stream_private_st::thread, xine_stream_private_st::thread_created, and xine_stream_private_st::thread_running.

Referenced by stop_internal().

## ◆ _x_read_abort()

off_t _x_read_abort | ( | xine_stream_t * | stream,
|  | int | fd,
|  | char * | buf,
|  | off_t | todo
| ) |  |

References _x_action_pending(), and NULL.

Referenced by vdr_read_abort().

## ◆ demux_loop()

static void * demux_loop | ( | void * | stream_gen | ) |
| static

References _, _x_demux_control_end(), _x_demux_control_nop(), _x_handle_stream_end(), xine_stream_private_st::action_lock, xine_stream_private_st::action_pending, xine_stream_s::audio_fifo, xine_stream_private_st::audio_thread_created, BUF_FLAG_END_STREAM, xine_stream_private_st::changed, xine_stream_private_st::counter, xine_stream_private_st::delay_finish_event, xine_stream_private_st::demux, DEMUX_CAP_STOP, DEMUX_FINISHED, DEMUX_OK, DEMUX_OPTIONAL_DATA_STOP, demux_unstick_ao_loop(), xine_stream_private_st::demuxers_running, xine_stream_private_st::emergency_brake, xine_stream_private_st::finisheds_audio, xine_stream_private_st::finisheds_video, xine_stream_private_st::first_frame, xine_stream_private_st::flag, demux_plugin_s::get_capabilities, input_plugin_s::get_capabilities, demux_plugin_s::get_optional_data, demux_plugin_s::get_status, xine_stream_private_st::input_caps, xine_stream_s::input_plugin, xine_stream_private_st::lock, lprintf, NULL, xine_stream_private_st::plugin, xine_stream_private_st::reached, xine_stream_private_st::resume, xine_stream_private_st::s, demux_plugin_s::send_chunk, xine_stream_private_st::side_streams, fifo_buffer_s::size, xine_stream_private_st::thread_running, xine_stream_s::video_fifo, xine_stream_private_st::video_thread_created, xine_stream_s::xine, xine_gettime(), xine_log(), XINE_LOG_MSG, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_demux_start_thread().

## ◆ demux_unstick_ao_loop()

static int demux_unstick_ao_loop | ( | xine_stream_t * | s | ) |
| static

References xine_stream_s::audio_out, xine_stream_private_st::demux, DEMUX_FINISHED, xine_audio_port_s::get_buffer, demux_plugin_s::get_status, lprintf, NULL, audio_buffer_s::num_frames, xine_stream_private_st::plugin, xine_audio_port_s::put_buffer, xine_stream_private_st::s, audio_buffer_s::stream, xine_get_status(), XINE_STATUS_QUIT, and XINE_STATUS_STOP.

Referenced by _x_demux_control_headers_done(), and demux_loop().