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

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Functions | Variables
input_dvd.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <stddef.h>`
`#include <sys/param.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <unistd.h>`
`#include <pthread.h>`
`#include <fcntl.h>`
`#include <time.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <dlfcn.h>`
`#include <sys/mount.h>`
`#include <sys/wait.h>`
`#include <sys/poll.h>`
`#include <sys/ioctl.h>`
`#include "libdvdnav/dvdnav.h"`
`#include "libdvdnav/nav_read.h"`
`#include <xine/xineutils.h>`
`#include <xine/buffer.h>`
`#include <xine/xine_internal.h>`
`#include "media_helper.h"`

## Data Structures
union | dvd_input_saved_buf_u
struct | dvd_input_plugin_s
struct | dvd_input_class_t

## Macros
#define | DVDNAV_COMPILE
#define | LOG_MODULE "input_http"
#define | LOG_VERBOSE
#define | MODE_FAIL 0
#define | MODE_NAVIGATE 1
#define | MODE_TITLE 2
#define | CAN_SEEK 1
#define | DVD_PATH "/dev/dvd"
#define | RDVD_PATH "/dev/rdvd"
#define | DVD_BLOCK_SIZE 2048
#define | PTR_ALIGN(p, align) ((void*)(((uintptr_t)(p) + (align) - 1) & ~((uintptr_t)(align)-1)))

## Typedefs
typedef struct dvd_input_plugin_s | dvd_input_plugin_t
typedef union dvd_input_saved_buf_u | dvd_input_saved_buf_t

## Functions
static int | dvd_input_saved_new (dvd_input_plugin_t *this)
static void | dvd_input_saved_delete (dvd_input_plugin_t *this)
static dvd_input_saved_buf_t * | dvd_input_saved_acquire (dvd_input_plugin_t *this)
static int | dvd_input_saved_release (dvd_input_plugin_t *this, dvd_input_saved_buf_t *s)
static void | dvd_handle_events (dvd_input_plugin_t *this)
static void | xine_dvd_send_button_update (dvd_input_plugin_t *this, int mode)
static void | device_change_cb (void *data, xine_cfg_entry_t *cfg)
static uint32_t | dvd_plugin_get_capabilities (input_plugin_t *this_gen)
static void | apply_cfg (dvd_input_plugin_t *this)
static void | update_cfg (dvd_input_plugin_t *this)
static void | read_ahead_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | seek_mode_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | region_changed_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | language_changed_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | play_single_chapter_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | skip_changed_cb (void *this_gen, xine_cfg_entry_t *entry)
static void | send_mouse_enter_leave_event (dvd_input_plugin_t *this, int direction)
static int | update_title_display (dvd_input_plugin_t *this)
static void | dvd_plugin_dispose (input_plugin_t *this_gen)
static void | dvd_plugin_free_buffer (buf_element_t *buf)
static buf_element_t * | dvd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t nlen)
static off_t | dvd_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
static off_t | dvd_plugin_get_current_pos (input_plugin_t *this_gen)
static off_t | dvd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin)
static off_t | dvd_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin)
static off_t | dvd_plugin_get_length (input_plugin_t *this_gen)
static uint32_t | dvd_plugin_get_blocksize (input_plugin_t *this_gen)
static const char * | dvd_plugin_get_mrl (input_plugin_t *this_gen)
static int | dvd_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
static int | dvd_parse_try_open (dvd_input_plugin_t *this, const char *locator)
static int | dvd_parse_mrl (dvd_input_plugin_t *this)
static int | dvd_plugin_open (input_plugin_t *this_gen)
static input_plugin_t * | dvd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data)
static const char *const * | dvd_class_get_autoplay_list (input_class_t *this_gen, int *num_files)
static void | dvd_class_dispose (input_class_t *this_gen)
static int | dvd_class_eject_media (input_class_t *this_gen)
static void * | init_class (xine_t *xine, const void *data)

## Variables
static const char *const | dvdnav_menu_table []
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ CAN_SEEK

#define CAN_SEEK 1

## ◆ DVD_BLOCK_SIZE

#define DVD_BLOCK_SIZE 2048

Referenced by dvd_plugin_get_blocksize(), dvd_plugin_get_current_pos(), dvd_plugin_get_length(), dvd_plugin_read_block(), and dvd_plugin_seek().

## ◆ DVD_PATH

#define DVD_PATH "/dev/dvd"

Referenced by init_class().

## ◆ DVDNAV_COMPILE

#define DVDNAV_COMPILE

## ◆ LOG_MODULE

#define LOG_MODULE "input_http"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MODE_FAIL

#define MODE_FAIL 0

Referenced by dvd_parse_mrl(), and dvd_plugin_open().

## ◆ MODE_NAVIGATE

#define MODE_NAVIGATE 1

Referenced by dvd_parse_mrl(), and dvd_plugin_open().

## ◆ MODE_TITLE

#define MODE_TITLE 2

Referenced by dvd_parse_mrl(), dvd_plugin_open(), and update_title_display().

## ◆ PTR_ALIGN

#define PTR_ALIGN | ( |  | p,
|  |  | align ) ((void*)(((uintptr_t)(p) + (align) - 1) & ~((uintptr_t)(align)-1)))

## ◆ RDVD_PATH

#define RDVD_PATH "/dev/rdvd"

## Typedef Documentation

## ◆ dvd_input_plugin_t

typedef struct dvd_input_plugin_s dvd_input_plugin_t

## ◆ dvd_input_saved_buf_t

typedef union dvd_input_saved_buf_u dvd_input_saved_buf_t

## Function Documentation

## ◆ apply_cfg()

static void apply_cfg | ( | dvd_input_plugin_t * | this | ) |
| static

References dvd_input_class_t::input_class, dvd_input_class_t::user_conf_version, dvd_input_class_t::user_lang4, dvd_input_class_t::user_read_ahead, dvd_input_class_t::user_region, and dvd_input_class_t::user_seek_mode.

Referenced by dvd_plugin_open().

## ◆ device_change_cb()

static void device_change_cb | ( | void * | data,
|  | xine_cfg_entry_t * | cfg )
| static

References dvd_input_class_t::dvd_device, and xine_cfg_entry_s::str_value.

Referenced by init_class().

## ◆ dvd_class_dispose()

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

References _x_freep(), xine_s::config, dvd_input_class_t::eject_device, NULL, config_values_s::unregister_callbacks, and dvd_input_class_t::xine.

Referenced by init_class().

## ◆ dvd_class_eject_media()

static int dvd_class_eject_media | ( | input_class_t * | this_gen | ) |
| static

References dvd_input_class_t::eject_device, media_eject_media(), and dvd_input_class_t::xine.

Referenced by init_class().

## ◆ dvd_class_get_autoplay_list()

static const char *const * dvd_class_get_autoplay_list | ( | input_class_t * | this_gen,
|  | int * | num_files )
| static

References lprintf, and NULL.

Referenced by init_class().

## ◆ dvd_class_get_instance()

static input_plugin_t * dvd_class_get_instance | ( | input_class_t * | class_gen,
|  | xine_stream_t * | stream,
|  | const char * | data )
| static

References _x_stream_info_set(), dvd_input_saved_new(), dvd_plugin_dispose(), dvd_plugin_get_blocksize(), dvd_plugin_get_capabilities(), dvd_plugin_get_current_pos(), dvd_plugin_get_length(), dvd_plugin_get_mrl(), dvd_plugin_get_optional_data(), dvd_plugin_open(), dvd_plugin_read(), dvd_plugin_read_block(), dvd_plugin_seek(), dvd_plugin_seek_time(), lprintf, NULL, dvd_input_class_t::user_conf_version, xine_event_new_queue(), and XINE_STREAM_INFO_VIDEO_HAS_STILL.

Referenced by init_class().

## ◆ dvd_handle_events()

static void dvd_handle_events | ( | dvd_input_plugin_t * | this | ) |
| static

References input(), dvd_input_class_t::input_class, send_mouse_enter_leave_event(), xine_event_t::type, update_title_display(), xine_dvd_send_button_update(), xine_event_free(), xine_event_get(), XINE_EVENT_INPUT_ANGLE_NEXT, XINE_EVENT_INPUT_ANGLE_PREVIOUS, XINE_EVENT_INPUT_BUTTON_FORCE, XINE_EVENT_INPUT_DOWN, XINE_EVENT_INPUT_LEFT, XINE_EVENT_INPUT_MENU1, XINE_EVENT_INPUT_MENU2, XINE_EVENT_INPUT_MENU3, XINE_EVENT_INPUT_MENU4, XINE_EVENT_INPUT_MENU5, XINE_EVENT_INPUT_MENU6, XINE_EVENT_INPUT_MENU7, XINE_EVENT_INPUT_MOUSE_BUTTON, XINE_EVENT_INPUT_MOUSE_MOVE, XINE_EVENT_INPUT_NEXT, XINE_EVENT_INPUT_NUMBER_0, XINE_EVENT_INPUT_NUMBER_1, XINE_EVENT_INPUT_NUMBER_10_ADD, 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_VERBOSITY_DEBUG, and xprintf.

Referenced by dvd_plugin_read_block().

## ◆ dvd_input_saved_acquire()

static dvd_input_saved_buf_t * dvd_input_saved_acquire | ( | dvd_input_plugin_t * | this | ) |
| static

References dvd_input_saved_buf_u::free_next, dvd_input_saved_buf_u::this, and dvd_input_saved_buf_u::used.

Referenced by dvd_plugin_read_block().

## ◆ dvd_input_saved_delete()

static void dvd_input_saved_delete | ( | dvd_input_plugin_t * | this | ) |
| static

References _x_freep().

Referenced by dvd_plugin_dispose(), and dvd_plugin_free_buffer().

## ◆ dvd_input_saved_new()

static int dvd_input_saved_new | ( | dvd_input_plugin_t * | this | ) |
| static

References dvd_input_saved_buf_u::free_next, and NULL.

Referenced by dvd_class_get_instance().

## ◆ dvd_input_saved_release()

static int dvd_input_saved_release | ( | dvd_input_plugin_t * | this,
|  | dvd_input_saved_buf_t * | s )
| static

References dvd_input_saved_buf_u::free_next.

Referenced by dvd_plugin_free_buffer().

## ◆ dvd_parse_mrl()

static int dvd_parse_mrl | ( | dvd_input_plugin_t * | this | ) |
| static

References _x_mrl_unescape(), dvd_parse_try_open(), MODE_FAIL, MODE_NAVIGATE, MODE_TITLE, v, and z.

Referenced by dvd_plugin_open().

## ◆ dvd_parse_try_open()

static int dvd_parse_try_open | ( | dvd_input_plugin_t * | this,
|  | const char * | locator )
| static

References _x_freep(), dvd_input_class_t::input_class, and NULL.

Referenced by dvd_parse_mrl().

## ◆ dvd_plugin_dispose()

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

References _x_freep(), dvd_input_saved_delete(), lprintf, NULL, and xine_event_dispose_queue().

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_free_buffer()

static void dvd_plugin_free_buffer | ( | buf_element_t * | buf | ) |
| static

References _x_freep(), dvd_input_saved_buf_u::block, dvd_input_saved_delete(), dvd_input_saved_release(), buf_element_s::free_buffer, dvd_input_saved_buf_u::free_buffer, NULL, buf_element_s::source, dvd_input_saved_buf_u::source, dvd_input_saved_buf_u::this, and dvd_input_saved_buf_u::used.

Referenced by dvd_plugin_read_block().

## ◆ dvd_plugin_get_blocksize()

static uint32_t dvd_plugin_get_blocksize | ( | input_plugin_t * | this_gen | ) |
| static

References DVD_BLOCK_SIZE, and lprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_get_capabilities()

static uint32_t dvd_plugin_get_capabilities | ( | input_plugin_t * | this_gen | ) |
| static

References INPUT_CAP_AUDIOLANG, INPUT_CAP_BLOCK, INPUT_CAP_CHAPTERS, INPUT_CAP_RIP_FORBIDDEN, INPUT_CAP_SEEKABLE, INPUT_CAP_SPULANG, and lprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_get_current_pos()

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

References DVD_BLOCK_SIZE, and lprintf.

Referenced by dvd_class_get_instance(), dvd_plugin_seek(), and dvd_plugin_seek_time().

## ◆ dvd_plugin_get_length()

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

References DVD_BLOCK_SIZE, and lprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_get_mrl()

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

References lprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_get_optional_data()

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

References INPUT_OPTIONAL_DATA_AUDIOLANG, INPUT_OPTIONAL_DATA_SPULANG, INPUT_OPTIONAL_SUCCESS, and INPUT_OPTIONAL_UNSUPPORTED.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_open()

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

References _, _x_message(), _x_meta_info_set(), apply_cfg(), dvd_parse_mrl(), input_plugin_s::input_class, lprintf, mode(), MODE_FAIL, MODE_NAVIGATE, MODE_TITLE, NULL, xine_event_t::type, update_title_display(), xine_event_send(), XINE_EVENT_UI_CHANNELS_CHANGED, XINE_META_INFO_TITLE, XINE_MSG_READ_ERROR, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_read()

static off_t dvd_plugin_read | ( | input_plugin_t * | this_gen,
|  | void * | buf_gen,
|  | off_t | len )
| static

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_read_block()

static buf_element_t * dvd_plugin_read_block | ( | input_plugin_t * | this_gen,
|  | fifo_buffer_t * | fifo,
|  | off_t | nlen )
| static

References _, _x_demux_flush_engine(), _x_message(), dvd_input_saved_buf_u::block, BUF_CONTROL_AUDIO_CHANNEL, BUF_CONTROL_NOP, BUF_CONTROL_SPU_CHANNEL, BUF_DEMUX_BLOCK, BUF_FLAG_SPECIAL, BUF_SPECIAL_ASPECT, BUF_SPECIAL_SPU_DVD_SUBTYPE, BUF_SPU_DVD, BUF_VIDEO_MPEG, fifo_buffer_s::buffer_pool_alloc, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, DVD_BLOCK_SIZE, dvd_handle_events(), dvd_input_saved_acquire(), dvd_plugin_free_buffer(), buf_element_s::extra_info, buf_element_s::free_buffer, dvd_input_saved_buf_u::free_buffer, dvd_input_class_t::input_class, extra_info_s::input_time, buf_element_s::mem, NULL, buf_element_s::source, dvd_input_saved_buf_u::source, SPU_DVD_SUBTYPE_CLUT, extra_info_s::total_time, buf_element_s::type, xine_event_t::type, update_cfg(), update_title_display(), dvd_input_saved_buf_u::used, dvd_input_class_t::user_conf_version, dvd_input_class_t::user_seek_mode, xine_dvd_send_button_update(), xine_event_send(), XINE_EVENT_UI_CHANNELS_CHANGED, XINE_MSG_READ_ERROR, xine_usec_sleep(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_seek()

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

References DVD_BLOCK_SIZE, dvd_plugin_get_current_pos(), and lprintf.

Referenced by dvd_class_get_instance().

## ◆ dvd_plugin_seek_time()

static off_t dvd_plugin_seek_time | ( | input_plugin_t * | this_gen,
|  | int | time_offset,
|  | int | origin )
| static

References dvd_plugin_get_current_pos(), and lprintf.

Referenced by dvd_class_get_instance().

## ◆ init_class()

static void * init_class | ( | xine_t * | xine,
|  | const void * | data )
| static

References _, xine_s::config, input_class_s::description, device_change_cb(), input_class_s::dispose, dvd_class_dispose(), dvd_class_eject_media(), dvd_class_get_autoplay_list(), dvd_class_get_instance(), dvd_input_class_t::dvd_device, DVD_PATH, input_class_s::eject_media, input_class_s::get_autoplay_list, input_class_s::get_dir, input_class_s::get_instance, input_class_s::identifier, dvd_input_class_t::input_class, language_changed_cb(), lprintf, mode(), N_, NULL, play_single_chapter_cb(), read_ahead_cb(), region_changed_cb(), config_values_s::register_bool, config_values_s::register_enum, config_values_s::register_filename, config_values_s::register_num, config_values_s::register_string, seek_mode_cb(), skip_changed_cb(), dvd_input_class_t::user_conf_version, dvd_input_class_t::user_lang4, dvd_input_class_t::user_play_single_chapter, dvd_input_class_t::user_read_ahead, dvd_input_class_t::user_region, dvd_input_class_t::user_seek_mode, dvd_input_class_t::user_skip_mode, xine_s::verbosity, dvd_input_class_t::xine, XINE_CONFIG_STRING_IS_DEVICE_NAME, xine_setenv, and XINE_VERBOSITY_NONE.

## ◆ language_changed_cb()

static void language_changed_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::str_value, and dvd_input_class_t::user_conf_version.

Referenced by init_class().

## ◆ play_single_chapter_cb()

static void play_single_chapter_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value, and dvd_input_class_t::user_play_single_chapter.

Referenced by init_class().

## ◆ read_ahead_cb()

static void read_ahead_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value, and dvd_input_class_t::user_conf_version.

Referenced by init_class().

## ◆ region_changed_cb()

static void region_changed_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value, and dvd_input_class_t::user_conf_version.

Referenced by init_class().

## ◆ seek_mode_cb()

static void seek_mode_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value, and dvd_input_class_t::user_conf_version.

Referenced by init_class().

## ◆ send_mouse_enter_leave_event()

static void send_mouse_enter_leave_event | ( | dvd_input_plugin_t * | this,
|  | int | direction )
| static

References xine_spu_button_t::direction, xine_event_t::type, xine_event_send(), and XINE_EVENT_SPU_BUTTON.

Referenced by dvd_handle_events().

## ◆ skip_changed_cb()

static void skip_changed_cb | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value, and dvd_input_class_t::user_skip_mode.

Referenced by init_class().

## ◆ update_cfg()

static void update_cfg | ( | dvd_input_plugin_t * | this | ) |
| static

References dvd_input_class_t::input_class, dvd_input_class_t::user_lang4, dvd_input_class_t::user_read_ahead, dvd_input_class_t::user_region, and dvd_input_class_t::user_seek_mode.

Referenced by dvd_plugin_read_block().

## ◆ update_title_display()

static int update_title_display | ( | dvd_input_plugin_t * | this | ) |
| static

References _x_stream_info_set(), dvdnav_menu_table, mode(), MODE_TITLE, xine_ui_data_t::str, xine_ui_data_t::str_len, xine_event_t::type, xine_event_send(), XINE_EVENT_UI_SET_TITLE, XINE_STREAM_INFO_DVD_ANGLE_COUNT, XINE_STREAM_INFO_DVD_ANGLE_NUMBER, XINE_STREAM_INFO_DVD_CHAPTER_COUNT, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER, XINE_STREAM_INFO_DVD_TITLE_COUNT, and XINE_STREAM_INFO_DVD_TITLE_NUMBER.

Referenced by dvd_handle_events(), dvd_plugin_open(), and dvd_plugin_read_block().

## ◆ xine_dvd_send_button_update()

static void xine_dvd_send_button_update | ( | dvd_input_plugin_t * | this,
|  | int | mode )
| static

References _x_stream_info_get(), BUF_SPU_DVD, mode(), buf_element_s::size, buf_element_s::type, XINE_STREAM_INFO_IGNORE_SPU, and xine_usec_sleep().

Referenced by dvd_handle_events(), and dvd_plugin_read_block().

## Variable Documentation

## ◆ dvdnav_menu_table

const char* const dvdnav_menu_table[]
| static

Initial value:
= {
NULL,
NULL,
"Title",
"Root",
"Subpicture",
"Audio",
"Angle",
"Part"
}
NULL
NULL
Definition xine_plugin.c:78

Referenced by update_title_display().

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 18, "DVD", XINE_VERSION_CODE, NULL, init_class },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
init_class
static void * init_class(xine_t *xine, const void *data)
Definition input_dvd.c:1799
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition xine_internal.h:57
PLUGIN_NONE
#define PLUGIN_NONE
Definition xine_plugin.h:29
PLUGIN_MUST_PRELOAD
#define PLUGIN_MUST_PRELOAD
Definition xine_plugin.h:46
PLUGIN_INPUT
#define PLUGIN_INPUT
Definition xine_plugin.h:30