xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Functions
input_vdr.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <errno.h>
#include <pthread.h>
#include <resolv.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/input_plugin.h>
#include <xine/vdr.h>
#include "combined_vdr.h"

Data Structures

struct  vdr_metronom_t
 
struct  vdr_osd_s
 
struct  vdr_vpts_offset_t
 
struct  vdr_input_plugin_s
 

Macros

#define LOG_MODULE   "input_vdr"
 
#define LOG_VERBOSE
 
#define VDR_DISC_START   (('V' << 24) | ('D' << 16) | ('R' << 8) | 1)
 
#define VDR_DISC_STOP   (('V' << 24) | ('D' << 16) | ('R' << 8) | 0)
 
#define VDR_MAX_NUM_WINDOWS   16
 
#define VDR_ABS_FIFO_DIR   "/tmp/vdr-xine"
 
#define BUF_SIZE   1024
 
#define LOG_OSD(x)
 
#define OFFS_RING_LD   7
 
#define OFFS_RING_NUM   (1 << OFFS_RING_LD)
 
#define OFFS_RING_MASK   (OFFS_RING_NUM - 1)
 
#define READ_DATA_OR_FAIL(kind, log)
 

Typedefs

typedef struct vdr_input_plugin_s vdr_input_plugin_t
 
typedef struct vdr_osd_s vdr_osd_t
 

Functions

static void input_vdr_dummy (fifo_buffer_t *fifo, void *data)
 
static void trick_speed_send_event (vdr_input_plugin_t *this, int mode)
 
static int vdr_write (int f, void *b, int n)
 
static int internal_write_event_play_external (vdr_input_plugin_t *this, uint32_t key)
 
static void event_handler_external (void *user_data, const xine_event_t *event)
 
static void external_stream_stop (vdr_input_plugin_t *this)
 
static void external_stream_play (vdr_input_plugin_t *this, char *file_name)
 
static ssize_t vdr_read_abort (xine_stream_t *stream, int fd, uint8_t *buf, size_t todo)
 
static double _now ()
 
static void adjust_zoom (vdr_input_plugin_t *this)
 
static void vdr_vpts_offset_queue_init (vdr_input_plugin_t *this)
 
static void vdr_vpts_offset_queue_deinit (vdr_input_plugin_t *this)
 
static void vdr_vpts_offset_queue_process (vdr_input_plugin_t *this, int64_t vpts)
 
static void vdr_vpts_offset_queue_add_int (vdr_input_plugin_t *this, int64_t pts)
 
static int vdr_vpts_offset_queue_ask (vdr_input_plugin_t *this, int64_t *pts)
 
static void vdr_vpts_offset_queue_purge (vdr_input_plugin_t *this)
 
static void vdr_start_buffers (vdr_input_plugin_t *this)
 
static ssize_t vdr_execute_rpc_command (vdr_input_plugin_t *this)
 
static void * vdr_rpc_thread_loop (void *arg)
 
static int internal_write_event_key (vdr_input_plugin_t *this, uint32_t key)
 
static int internal_write_event_frame_size (vdr_input_plugin_t *this)
 
static int internal_write_event_discontinuity (vdr_input_plugin_t *this, int32_t type)
 
static ssize_t vdr_main_read (vdr_input_plugin_t *this, uint8_t *buf, ssize_t len)
 
static off_t vdr_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
 
static buf_element_tvdr_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo)
 
static off_t vdr_plugin_get_current_pos (input_plugin_t *this_gen)
 
static off_t vdr_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin)
 
static off_t vdr_plugin_get_length (input_plugin_t *this_gen)
 
static uint32_t vdr_plugin_get_capabilities (input_plugin_t *this_gen)
 
static uint32_t vdr_plugin_get_blocksize (input_plugin_t *this_gen)
 
static const char * vdr_plugin_get_mrl (input_plugin_t *this_gen)
 
static void vdr_plugin_dispose (input_plugin_t *this_gen)
 
static int vdr_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
 
static const char * mrl_to_fifo (const char *mrl)
 
static const char * mrl_to_host (const char *mrl)
 
static int vdr_plugin_open_fifo_mrl (input_plugin_t *this_gen)
 
static int vdr_plugin_open_socket (vdr_input_plugin_t *this, struct hostent *host, unsigned short port)
 
static int vdr_plugin_open_sockets (vdr_input_plugin_t *this)
 
static int vdr_plugin_open_socket_mrl (input_plugin_t *this_gen)
 
static void vdr_vpts_offset_queue_add (vdr_input_plugin_t *this, int type, int64_t disc_off)
 
static int vdr_plugin_open (input_plugin_t *this_gen)
 
static void event_handler (void *user_data, const xine_event_t *event)
 
static void vdr_metronom_handle_audio_discontinuity (metronom_t *self, int type, int64_t disc_off)
 
static void vdr_metronom_handle_video_discontinuity (metronom_t *self, int type, int64_t disc_off)
 
static void vdr_metronom_got_video_frame (metronom_t *self, vo_frame_t *frame)
 
static int64_t vdr_metronom_got_audio_samples (metronom_t *self, int64_t pts, int nsamples)
 
static int64_t vdr_metronom_got_spu_packet (metronom_t *self, int64_t pts)
 
static void vdr_metronom_set_audio_rate (metronom_t *self, int64_t pts_per_smpls)
 
static void vdr_metronom_set_option (metronom_t *self, int option, int64_t value)
 
static int64_t vdr_metronom_get_option (metronom_t *self, int option)
 
static void vdr_metronom_set_master (metronom_t *self, metronom_t *master)
 
static void vdr_metronom_exit (metronom_t *self)
 
static input_plugin_tvdr_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data)
 
static const char *const * vdr_class_get_autoplay_list (input_class_t *this_gen, int *num_files)
 
void * vdr_input_init_plugin (xine_t *xine, const void *data)
 

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE   1024

◆ LOG_MODULE

#define LOG_MODULE   "input_vdr"

◆ LOG_OSD

#define LOG_OSD ( x)

Referenced by vdr_execute_rpc_command().

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ OFFS_RING_LD

#define OFFS_RING_LD   7

◆ OFFS_RING_MASK

#define OFFS_RING_MASK   (OFFS_RING_NUM - 1)

◆ OFFS_RING_NUM

#define OFFS_RING_NUM   (1 << OFFS_RING_LD)

◆ READ_DATA_OR_FAIL

#define READ_DATA_OR_FAIL ( kind,
log )
Value:
data_##kind##_t *data = &data_union.kind; \
{ \
log; \
n = vdr_read_abort (this->stream, this->fh_control, (uint8_t *)data + sizeof (data->header), sizeof (*data) - sizeof (data->header)); \
if (n != sizeof (*data) - sizeof (data->header)) \
return -1; \
\
this->cur_size -= n; \
}
static ssize_t vdr_read_abort(xine_stream_t *stream, int fd, uint8_t *buf, size_t todo)
Definition input_vdr.c:321

Referenced by vdr_execute_rpc_command().

◆ VDR_ABS_FIFO_DIR

#define VDR_ABS_FIFO_DIR   "/tmp/vdr-xine"

◆ VDR_DISC_START

#define VDR_DISC_START   (('V' << 24) | ('D' << 16) | ('R' << 8) | 1)

◆ VDR_DISC_STOP

#define VDR_DISC_STOP   (('V' << 24) | ('D' << 16) | ('R' << 8) | 0)

◆ VDR_MAX_NUM_WINDOWS

#define VDR_MAX_NUM_WINDOWS   16

Typedef Documentation

◆ vdr_input_plugin_t

◆ vdr_osd_t

typedef struct vdr_osd_s vdr_osd_t

Function Documentation

◆ _now()

static double _now ( )
static

Referenced by vdr_execute_rpc_command().

◆ adjust_zoom()

static void adjust_zoom ( vdr_input_plugin_t * this)
static

◆ event_handler()

static void event_handler ( void * user_data,
const xine_event_t * event )
static

References _, adjust_zoom(), vdr_select_audio_data_s::channels, xine_event_t::data, xine_event_t::data_length, internal_write_event_discontinuity(), internal_write_event_frame_size(), internal_write_event_key(), key, key_0, key_1, key_2, key_3, key_4, key_5, key_6, key_7, key_8, key_9, key_audio, key_back, key_blue, key_channel_minus, key_channel_plus, key_channel_previous, key_channels, key_commands, key_down, key_fast_fwd, key_fast_rew, key_green, key_info, key_left, key_menu, key_mute, key_next, key_none, key_ok, key_pause, key_play, key_power, key_previous, key_record, key_recordings, key_red, key_right, key_schedule, key_setup, key_stop, key_subtitles, key_timers, key_up, key_user0, key_user1, key_user2, key_user3, key_user4, key_user5, key_user6, key_user7, key_user8, key_user9, key_volume_minus, key_volume_plus, key_yellow, LOG_MODULE, lprintf, NULL, xine_event_t::type, user_data(), XINE_EVENT_INPUT_DOWN, XINE_EVENT_INPUT_LEFT, XINE_EVENT_INPUT_MENU1, XINE_EVENT_INPUT_NEXT, XINE_EVENT_INPUT_NUMBER_0, XINE_EVENT_INPUT_NUMBER_1, XINE_EVENT_INPUT_NUMBER_2, XINE_EVENT_INPUT_NUMBER_3, XINE_EVENT_INPUT_NUMBER_4, XINE_EVENT_INPUT_NUMBER_5, XINE_EVENT_INPUT_NUMBER_6, XINE_EVENT_INPUT_NUMBER_7, XINE_EVENT_INPUT_NUMBER_8, XINE_EVENT_INPUT_NUMBER_9, XINE_EVENT_INPUT_PREVIOUS, XINE_EVENT_INPUT_RIGHT, XINE_EVENT_INPUT_SELECT, XINE_EVENT_INPUT_UP, xine_event_send(), XINE_EVENT_VDR_AUDIO, XINE_EVENT_VDR_BACK, XINE_EVENT_VDR_BLUE, XINE_EVENT_VDR_CHANNELMINUS, XINE_EVENT_VDR_CHANNELPLUS, XINE_EVENT_VDR_CHANNELPREVIOUS, XINE_EVENT_VDR_CHANNELS, XINE_EVENT_VDR_COMMANDS, XINE_EVENT_VDR_DISCONTINUITY, XINE_EVENT_VDR_FASTFWD, XINE_EVENT_VDR_FASTREW, XINE_EVENT_VDR_FRAMESIZECHANGED, XINE_EVENT_VDR_GREEN, XINE_EVENT_VDR_INFO, XINE_EVENT_VDR_MUTE, XINE_EVENT_VDR_PAUSE, XINE_EVENT_VDR_PLAY, XINE_EVENT_VDR_PLUGINSTARTED, XINE_EVENT_VDR_POWER, XINE_EVENT_VDR_RECORD, XINE_EVENT_VDR_RECORDINGS, XINE_EVENT_VDR_RED, XINE_EVENT_VDR_SCHEDULE, XINE_EVENT_VDR_SELECTAUDIO, XINE_EVENT_VDR_SETUP, XINE_EVENT_VDR_STOP, XINE_EVENT_VDR_SUBTITLES, XINE_EVENT_VDR_TIMERS, XINE_EVENT_VDR_TRICKSPEEDMODE, XINE_EVENT_VDR_USER0, XINE_EVENT_VDR_USER1, XINE_EVENT_VDR_USER2, XINE_EVENT_VDR_USER3, XINE_EVENT_VDR_USER4, XINE_EVENT_VDR_USER5, XINE_EVENT_VDR_USER6, XINE_EVENT_VDR_USER7, XINE_EVENT_VDR_USER8, XINE_EVENT_VDR_USER9, XINE_EVENT_VDR_VOLMINUS, XINE_EVENT_VDR_VOLPLUS, XINE_EVENT_VDR_YELLOW, XINE_VERBOSITY_LOG, and xprintf.

Referenced by vdr_class_get_instance().

◆ event_handler_external()

static void event_handler_external ( void * user_data,
const xine_event_t * event )
static

◆ external_stream_play()

static void external_stream_play ( vdr_input_plugin_t * this,
char * file_name )
static

◆ external_stream_stop()

static void external_stream_stop ( vdr_input_plugin_t * this)
static

◆ input_vdr_dummy()

static void input_vdr_dummy ( fifo_buffer_t * fifo,
void * data )
static

◆ internal_write_event_discontinuity()

static int internal_write_event_discontinuity ( vdr_input_plugin_t * this,
int32_t type )
static

◆ internal_write_event_frame_size()

static int internal_write_event_frame_size ( vdr_input_plugin_t * this)
static

◆ internal_write_event_key()

static int internal_write_event_key ( vdr_input_plugin_t * this,
uint32_t key )
static

References event_key_t, func_key, key, and vdr_write().

Referenced by event_handler().

◆ internal_write_event_play_external()

static int internal_write_event_play_external ( vdr_input_plugin_t * this,
uint32_t key )
static

◆ mrl_to_fifo()

static const char * mrl_to_fifo ( const char * mrl)
inlinestatic

◆ mrl_to_host()

static const char * mrl_to_host ( const char * mrl)
inlinestatic

◆ trick_speed_send_event()

static void trick_speed_send_event ( vdr_input_plugin_t * this,
int mode )
static

◆ vdr_class_get_autoplay_list()

static const char *const * vdr_class_get_autoplay_list ( input_class_t * this_gen,
int * num_files )
static

References NULL, and VDR_ABS_FIFO_DIR.

Referenced by vdr_input_init_plugin().

◆ vdr_class_get_instance()

static input_plugin_t * vdr_class_get_instance ( input_class_t * cls_gen,
xine_stream_t * stream,
const char * data )
static

◆ vdr_execute_rpc_command()

static ssize_t vdr_execute_rpc_command ( vdr_input_plugin_t * this)
static

References _, _now(), _x_demux_control_newpts(), _x_demux_flush_engine(), _x_demux_seek(), _x_meta_info_reset(), _x_query_buffer_usage(), _x_query_unprocessed_osd_events(), _x_reset_relaxed_frame_drop_mode(), _x_stream_info_reset(), _x_trigger_relaxed_frame_drop_mode(), adjust_zoom(), vdr_osd_s::argb_buffer, BUF_CONTROL_FLUSH_DECODER, BUF_CONTROL_RESET_TRACK_MAP, BUF_SIZE, vdr_select_audio_data_s::channels, xine_current_frame_data_s::crop_bottom, xine_current_frame_data_s::crop_left, xine_current_frame_data_s::crop_right, xine_current_frame_data_s::crop_top, data_union_t, DISC_STREAMSTART, external_stream_play(), external_stream_stop(), xine_current_frame_data_s::format, func_clear, func_first_frame, func_flush, func_get_pts, func_get_version, func_grab_image, func_metronom, func_mute, func_nop, func_osd_draw_bitmap, func_osd_flush, func_osd_free, func_osd_hide, func_osd_new, func_osd_set_position, func_osd_show, func_play_external, func_query_capabilities, func_reset_audio, func_select_audio, func_set_color, func_set_prebuffer, func_set_speed, func_set_video_window, func_set_volume, func_setup, func_start, func_still_frame, func_trick_speed_mode, func_video_size, func_wait, get_pts(), xine_current_frame_data_s::height, height, vdr_osd_s::height, xine_current_frame_data_s::img, xine_current_frame_data_s::img_size, xine_current_frame_data_s::interlaced, xine_audio_level_data_t::left, LOG_MODULE, LOG_OSD, lprintf, MAX_SHOWING, xine_audio_level_data_t::mute, now(), NULL, osd_draw_bitmap(), osd_hide(), osd_set_position(), xine_current_frame_data_s::ratio_code, READ_DATA_OR_FAIL, result_flush_t, result_get_pts_t, result_get_version_t, result_grab_image_t, result_query_capabilities_t, result_video_size_t, result_wait_t, xine_audio_level_data_t::right, trick_speed_send_event(), xine_event_t::type, buf_element_s::type, VDR_MAX_NUM_WINDOWS, vdr_read_abort(), vdr_start_buffers(), vdr_vpts_offset_queue_ask(), vdr_write(), xine_current_frame_data_s::width, width, vdr_osd_s::width, vdr_osd_s::window, XINE_EVENT_AUDIO_LEVEL, xine_event_send(), XINE_EVENT_VDR_SELECTAUDIO, XINE_EVENT_VDR_SETVIDEOWINDOW, xine_fast_memcpy, XINE_FINE_SPEED_NORMAL, XINE_FRAME_DATA_ALLOCATE_IMG, xine_get_current_frame_data(), xine_get_current_frame_s(), xine_get_param(), xine_get_stream_info(), XINE_LIVE_PAUSE_ON, XINE_META_INFO_AUDIOCODEC, xine_osd_draw_bitmap(), xine_osd_free(), xine_osd_get_palette(), xine_osd_hide(), xine_osd_new(), xine_osd_set_argb_buffer(), xine_osd_set_extent(), xine_osd_set_palette(), xine_osd_set_position(), xine_osd_set_video_window(), xine_osd_show(), xine_osd_show_unscaled(), XINE_PARAM_AUDIO_AMP_LEVEL, XINE_PARAM_AUDIO_AMP_MUTE, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, XINE_PARAM_AUDIO_MUTE, XINE_PARAM_AUDIO_VOLUME, XINE_PARAM_FINE_SPEED, XINE_PARAM_IGNORE_AUDIO, XINE_PARAM_METRONOM_PREBUFFER, XINE_PARAM_VO_ZOOM_X, XINE_PARAM_VO_ZOOM_Y, xine_set_param(), XINE_STREAM_INFO_AUDIO_BITRATE, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL, xine_usec_sleep(), XINE_VDR_MUTE_EXECUTE, XINE_VDR_MUTE_IGNORE, XINE_VDR_MUTE_SIMULATE, XINE_VDR_VERSION, XINE_VDR_VOLUME_CHANGE_SW, XINE_VDR_VOLUME_IGNORE, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, XINE_VO_ASPECT_4_3, XINE_VO_ASPECT_ANAMORPHIC, XINE_VO_ASPECT_DVB, XINE_VO_ASPECT_SQUARE, and xprintf.

Referenced by vdr_rpc_thread_loop().

◆ vdr_input_init_plugin()

void * vdr_input_init_plugin ( xine_t * xine,
const void * data )

◆ vdr_main_read()

static ssize_t vdr_main_read ( vdr_input_plugin_t * this,
uint8_t * buf,
ssize_t len )
static

◆ vdr_metronom_exit()

static void vdr_metronom_exit ( metronom_t * self)
static

References _x_assert.

Referenced by vdr_class_get_instance().

◆ vdr_metronom_get_option()

static int64_t vdr_metronom_get_option ( metronom_t * self,
int option )
static

◆ vdr_metronom_got_audio_samples()

static int64_t vdr_metronom_got_audio_samples ( metronom_t * self,
int64_t pts,
int nsamples )
static

◆ vdr_metronom_got_spu_packet()

static int64_t vdr_metronom_got_spu_packet ( metronom_t * self,
int64_t pts )
static

◆ vdr_metronom_got_video_frame()

static void vdr_metronom_got_video_frame ( metronom_t * self,
vo_frame_t * frame )
static

◆ vdr_metronom_handle_audio_discontinuity()

static void vdr_metronom_handle_audio_discontinuity ( metronom_t * self,
int type,
int64_t disc_off )
static

◆ vdr_metronom_handle_video_discontinuity()

static void vdr_metronom_handle_video_discontinuity ( metronom_t * self,
int type,
int64_t disc_off )
static

◆ vdr_metronom_set_audio_rate()

static void vdr_metronom_set_audio_rate ( metronom_t * self,
int64_t pts_per_smpls )
static

◆ vdr_metronom_set_master()

static void vdr_metronom_set_master ( metronom_t * self,
metronom_t * master )
static

◆ vdr_metronom_set_option()

static void vdr_metronom_set_option ( metronom_t * self,
int option,
int64_t value )
static

◆ vdr_plugin_dispose()

static void vdr_plugin_dispose ( input_plugin_t * this_gen)
static

◆ vdr_plugin_get_blocksize()

static uint32_t vdr_plugin_get_blocksize ( input_plugin_t * this_gen)
static

Referenced by vdr_class_get_instance().

◆ vdr_plugin_get_capabilities()

static uint32_t vdr_plugin_get_capabilities ( input_plugin_t * this_gen)
static

◆ vdr_plugin_get_current_pos()

static off_t vdr_plugin_get_current_pos ( input_plugin_t * this_gen)
static

Referenced by vdr_class_get_instance().

◆ vdr_plugin_get_length()

static off_t vdr_plugin_get_length ( input_plugin_t * this_gen)
static

Referenced by vdr_class_get_instance().

◆ vdr_plugin_get_mrl()

static const char * vdr_plugin_get_mrl ( input_plugin_t * this_gen)
static

Referenced by vdr_class_get_instance().

◆ vdr_plugin_get_optional_data()

static int vdr_plugin_get_optional_data ( input_plugin_t * this_gen,
void * data,
int data_type )
static

◆ vdr_plugin_open()

static int vdr_plugin_open ( input_plugin_t * this_gen)
static

◆ vdr_plugin_open_fifo_mrl()

static int vdr_plugin_open_fifo_mrl ( input_plugin_t * this_gen)
static

◆ vdr_plugin_open_socket()

static int vdr_plugin_open_socket ( vdr_input_plugin_t * this,
struct hostent * host,
unsigned short port )
static

◆ vdr_plugin_open_socket_mrl()

static int vdr_plugin_open_socket_mrl ( input_plugin_t * this_gen)
static

References lprintf, and vdr_plugin_open_sockets().

Referenced by vdr_plugin_open().

◆ vdr_plugin_open_sockets()

static int vdr_plugin_open_sockets ( vdr_input_plugin_t * this)
static

◆ vdr_plugin_read()

static off_t vdr_plugin_read ( input_plugin_t * this_gen,
void * buf_gen,
off_t len )
static

◆ vdr_plugin_read_block()

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

◆ vdr_plugin_seek()

static off_t vdr_plugin_seek ( input_plugin_t * this_gen,
off_t offset,
int origin )
static

◆ vdr_read_abort()

static ssize_t vdr_read_abort ( xine_stream_t * stream,
int fd,
uint8_t * buf,
size_t todo )
static

References _x_read_abort().

Referenced by vdr_execute_rpc_command().

◆ vdr_rpc_thread_loop()

static void * vdr_rpc_thread_loop ( void * arg)
static

◆ vdr_start_buffers()

static void vdr_start_buffers ( vdr_input_plugin_t * this)
static

◆ vdr_vpts_offset_queue_add()

static void vdr_vpts_offset_queue_add ( vdr_input_plugin_t * this,
int type,
int64_t disc_off )
static

◆ vdr_vpts_offset_queue_add_int()

static void vdr_vpts_offset_queue_add_int ( vdr_input_plugin_t * this,
int64_t pts )
static

◆ vdr_vpts_offset_queue_ask()

static int vdr_vpts_offset_queue_ask ( vdr_input_plugin_t * this,
int64_t * pts )
static

◆ vdr_vpts_offset_queue_deinit()

static void vdr_vpts_offset_queue_deinit ( vdr_input_plugin_t * this)
static

Referenced by vdr_plugin_dispose().

◆ vdr_vpts_offset_queue_init()

static void vdr_vpts_offset_queue_init ( vdr_input_plugin_t * this)
static

◆ vdr_vpts_offset_queue_process()

static void vdr_vpts_offset_queue_process ( vdr_input_plugin_t * this,
int64_t vpts )
static

◆ vdr_vpts_offset_queue_purge()

static void vdr_vpts_offset_queue_purge ( vdr_input_plugin_t * this)
static

◆ vdr_write()

static int vdr_write ( int f,
void * b,
int n )
static