xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Functions | Variables
input_pvr.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <pthread.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/compat.h>
#include <xine/input_plugin.h>

Data Structures

struct  ivtv_ioctl_codec
 
struct  pvr_input_plugin_t
 
struct  saved_show_t
 
struct  pvrscr_s
 

Macros

#define XINE_ENABLE_EXPERIMENTAL_FEATURES
 
#define LOG_MODULE   "input_pvr"
 
#define LOG_VERBOSE
 
#define PVR_DEVICE   "/dev/video0"
 
#define PVR_BLOCK_SIZE   2048 /* pvr works with dvd-like data */
 
#define BLOCKS_PER_PAGE   102400 /* 200MB per page. each session can have several pages */
 
#define MAX_PAGES   10000 /* maximum number of pages to keep track */
 
#define NUM_PREVIEW_BUFFERS   250 /* used in mpeg_block demuxer */
 
#define IVTV_IOC_G_CODEC   0xFFEE7703
 
#define IVTV_IOC_S_CODEC   0xFFEE7704
 
#define IVTV_STREAM_PS   0
 
#define IVTV_STREAM_TS   1
 
#define IVTV_STREAM_MPEG1   2
 
#define IVTV_STREAM_PES_AV   3
 
#define IVTV_STREAM_PES_V   5
 
#define IVTV_STREAM_PES_A   7
 
#define IVTV_STREAM_DVD   10
 
#define PVR_FILENAME   "%s%08d_%08d.vob"
 
#define SAVE_BASE_FILENAME   "ch%03d %02d-%02d-%04d %02d:%02d:%02d"
 
#define SAVE_FILENAME   "%s%s_%04d.vob"
 

Typedefs

typedef struct pvrscr_s pvrscr_t
 

Functions

static int pvrscr_get_priority (scr_plugin_t *scr)
 
static void pvrscr_set_pivot (pvrscr_t *this)
 
static int pvrscr_set_speed (scr_plugin_t *scr, int speed)
 
static void pvrscr_speed_tunning (pvrscr_t *this, double factor)
 
static void pvrscr_adjust (scr_plugin_t *scr, int64_t vpts)
 
static void pvrscr_start (scr_plugin_t *scr, int64_t start_vpts)
 
static int64_t pvrscr_get_current (scr_plugin_t *scr)
 
static void pvrscr_exit (scr_plugin_t *scr)
 
static pvrscr_tpvrscr_init (void)
 
static uint32_t block_to_page (pvr_input_plugin_t *this, uint32_t block)
 
static uint32_t pvr_plugin_get_capabilities (input_plugin_t *this_gen)
 
static off_t pvr_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
 
static void pvr_adjust_realtime_speed (pvr_input_plugin_t *this, fifo_buffer_t *fifo, int speed)
 
static char * make_temp_name (pvr_input_plugin_t *this, int page)
 
static char * make_base_save_name (int channel, time_t tm)
 
static char * make_save_name (pvr_input_plugin_t *this, char *base, int page)
 
static void pvr_report_realtime (pvr_input_plugin_t *this, int mode)
 
static int pvr_break_rec_page (pvr_input_plugin_t *this)
 
static int pvr_rec_file (pvr_input_plugin_t *this)
 
static int pvr_play_file (pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t *buffer, int speed)
 
static int pvr_mpeg_resync (int fd)
 
static void * pvr_loop (void *this_gen)
 
static void pvr_finish_recording (pvr_input_plugin_t *this)
 
static void pvr_event_handler (pvr_input_plugin_t *this)
 
static buf_element_tpvr_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo)
 
static off_t pvr_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin)
 
static off_t pvr_plugin_get_current_pos (input_plugin_t *this_gen)
 
static off_t pvr_plugin_get_length (input_plugin_t *this_gen)
 
static uint32_t pvr_plugin_get_blocksize (input_plugin_t *this_gen)
 
static const char * pvr_plugin_get_mrl (input_plugin_t *this_gen)
 
static int pvr_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
 
static void pvr_plugin_dispose (input_plugin_t *this_gen)
 
static int pvr_plugin_open (input_plugin_t *this_gen)
 
static input_plugin_tpvr_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, const char *data)
 
static void * init_plugin (xine_t *xine, const void *data)
 

Variables

const plugin_info_t xine_plugin_info[] EXPORTED
 

Macro Definition Documentation

◆ BLOCKS_PER_PAGE

#define BLOCKS_PER_PAGE   102400 /* 200MB per page. each session can have several pages */

Referenced by pvr_play_file(), and pvr_rec_file().

◆ IVTV_IOC_G_CODEC

#define IVTV_IOC_G_CODEC   0xFFEE7703

◆ IVTV_IOC_S_CODEC

#define IVTV_IOC_S_CODEC   0xFFEE7704

◆ IVTV_STREAM_DVD

#define IVTV_STREAM_DVD   10

◆ IVTV_STREAM_MPEG1

#define IVTV_STREAM_MPEG1   2

◆ IVTV_STREAM_PES_A

#define IVTV_STREAM_PES_A   7

◆ IVTV_STREAM_PES_AV

#define IVTV_STREAM_PES_AV   3

◆ IVTV_STREAM_PES_V

#define IVTV_STREAM_PES_V   5

◆ IVTV_STREAM_PS

#define IVTV_STREAM_PS   0

◆ IVTV_STREAM_TS

#define IVTV_STREAM_TS   1

◆ LOG_MODULE

#define LOG_MODULE   "input_pvr"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MAX_PAGES

#define MAX_PAGES   10000 /* maximum number of pages to keep track */

◆ NUM_PREVIEW_BUFFERS

#define NUM_PREVIEW_BUFFERS   250 /* used in mpeg_block demuxer */

Referenced by pvr_plugin_open().

◆ PVR_BLOCK_SIZE

#define PVR_BLOCK_SIZE   2048 /* pvr works with dvd-like data */

◆ PVR_DEVICE

#define PVR_DEVICE   "/dev/video0"

◆ PVR_FILENAME

#define PVR_FILENAME   "%s%08d_%08d.vob"

Referenced by make_temp_name().

◆ SAVE_BASE_FILENAME

#define SAVE_BASE_FILENAME   "ch%03d %02d-%02d-%04d %02d:%02d:%02d"

Referenced by make_base_save_name().

◆ SAVE_FILENAME

#define SAVE_FILENAME   "%s%s_%04d.vob"

Referenced by make_save_name().

◆ XINE_ENABLE_EXPERIMENTAL_FEATURES

#define XINE_ENABLE_EXPERIMENTAL_FEATURES

Typedef Documentation

◆ pvrscr_t

typedef struct pvrscr_s pvrscr_t

Function Documentation

◆ block_to_page()

static uint32_t block_to_page ( pvr_input_plugin_t * this,
uint32_t block )
static

Referenced by pvr_play_file(), and pvr_plugin_seek().

◆ init_plugin()

static void * init_plugin ( xine_t * xine,
const void * data )
static

◆ make_base_save_name()

static char * make_base_save_name ( int channel,
time_t tm )
static

References _x_asprintf(), and SAVE_BASE_FILENAME.

Referenced by pvr_finish_recording().

◆ make_save_name()

static char * make_save_name ( pvr_input_plugin_t * this,
char * base,
int page )
static

◆ make_temp_name()

static char * make_temp_name ( pvr_input_plugin_t * this,
int page )
static

◆ pvr_adjust_realtime_speed()

static void pvr_adjust_realtime_speed ( pvr_input_plugin_t * this,
fifo_buffer_t * fifo,
int speed )
static

◆ pvr_break_rec_page()

static int pvr_break_rec_page ( pvr_input_plugin_t * this)
static

◆ pvr_class_get_instance()

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

◆ pvr_event_handler()

static void pvr_event_handler ( pvr_input_plugin_t * this)
static

◆ pvr_finish_recording()

static void pvr_finish_recording ( pvr_input_plugin_t * this)
static

◆ pvr_loop()

static void * pvr_loop ( void * this_gen)
static

◆ pvr_mpeg_resync()

static int pvr_mpeg_resync ( int fd)
static

Referenced by pvr_loop().

◆ pvr_play_file()

static int pvr_play_file ( pvr_input_plugin_t * this,
fifo_buffer_t * fifo,
uint8_t * buffer,
int speed )
static

◆ pvr_plugin_dispose()

static void pvr_plugin_dispose ( input_plugin_t * this_gen)
static

◆ pvr_plugin_get_blocksize()

static uint32_t pvr_plugin_get_blocksize ( input_plugin_t * this_gen)
static

References PVR_BLOCK_SIZE.

Referenced by pvr_class_get_instance().

◆ pvr_plugin_get_capabilities()

static uint32_t pvr_plugin_get_capabilities ( input_plugin_t * this_gen)
static

◆ pvr_plugin_get_current_pos()

static off_t pvr_plugin_get_current_pos ( input_plugin_t * this_gen)
static

References PVR_BLOCK_SIZE.

Referenced by pvr_class_get_instance().

◆ pvr_plugin_get_length()

static off_t pvr_plugin_get_length ( input_plugin_t * this_gen)
static

References PVR_BLOCK_SIZE.

Referenced by pvr_class_get_instance().

◆ pvr_plugin_get_mrl()

static const char * pvr_plugin_get_mrl ( input_plugin_t * this_gen)
static

Referenced by pvr_class_get_instance().

◆ pvr_plugin_get_optional_data()

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

◆ pvr_plugin_open()

static int pvr_plugin_open ( input_plugin_t * this_gen)
static

◆ pvr_plugin_read()

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

Referenced by pvr_class_get_instance().

◆ pvr_plugin_read_block()

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

◆ pvr_plugin_seek()

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

◆ pvr_rec_file()

static int pvr_rec_file ( pvr_input_plugin_t * this)
static

◆ pvr_report_realtime()

static void pvr_report_realtime ( pvr_input_plugin_t * this,
int mode )
static

◆ pvrscr_adjust()

static void pvrscr_adjust ( scr_plugin_t * scr,
int64_t vpts )
static

References NULL, and xine_monotonic_clock().

Referenced by pvrscr_init().

◆ pvrscr_exit()

static void pvrscr_exit ( scr_plugin_t * scr)
static

Referenced by pvrscr_init().

◆ pvrscr_get_current()

static int64_t pvrscr_get_current ( scr_plugin_t * scr)
static

References NULL, and xine_monotonic_clock().

Referenced by pvrscr_init().

◆ pvrscr_get_priority()

static int pvrscr_get_priority ( scr_plugin_t * scr)
static

Referenced by pvrscr_init().

◆ pvrscr_init()

static pvrscr_t * pvrscr_init ( void )
static

◆ pvrscr_set_pivot()

static void pvrscr_set_pivot ( pvrscr_t * this)
static

◆ pvrscr_set_speed()

static int pvrscr_set_speed ( scr_plugin_t * scr,
int speed )
static

◆ pvrscr_speed_tunning()

static void pvrscr_speed_tunning ( pvrscr_t * this,
double factor )
static

◆ pvrscr_start()

static void pvrscr_start ( scr_plugin_t * scr,
int64_t start_vpts )
static

Variable Documentation

◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED
Initial value:
= {
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
static void * init_plugin(xine_t *xine, const void *data)
Definition input_pvr.c:1572
#define XINE_VERSION_CODE
Definition xine_internal.h:57
NULL
Definition xine_plugin.c:78
#define PLUGIN_NONE
Definition xine_plugin.h:29
#define PLUGIN_MUST_PRELOAD
Definition xine_plugin.h:46
#define PLUGIN_INPUT
Definition xine_plugin.h:30