summaryrefslogtreecommitdiff
path: root/src/input/input_dvd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_dvd.c')
-rw-r--r--src/input/input_dvd.c109
1 files changed, 42 insertions, 67 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index a891b9877..8656097bc 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -155,7 +155,7 @@
# define lseek64 lseek
#endif
-static const char *dvdnav_menu_table[] = {
+static const char *const dvdnav_menu_table[] = {
NULL,
NULL,
"Title",
@@ -332,12 +332,11 @@ static void send_mouse_enter_leave_event(dvd_input_plugin_t *this, int direction
this->mouse_in = !this->mouse_in;
if(direction != this->mouse_in) {
- xine_event_t event;
- xine_spu_button_t spu_event;
-
- spu_event.direction = direction;
- spu_event.button = this->mouse_buttonN;
-
+ const xine_spu_button_t spu_event = {
+ .direction = direction,
+ .button = this->mouse_buttonN
+ };
+ xine_event_t event;
event.type = XINE_EVENT_SPU_BUTTON;
event.stream = this->stream;
event.data = &spu_event;
@@ -353,8 +352,6 @@ static void send_mouse_enter_leave_event(dvd_input_plugin_t *this, int direction
static int update_title_display(dvd_input_plugin_t *this) {
char ui_title[MAX_STR_LEN + 1];
- xine_event_t uevent;
- xine_ui_data_t data;
int tt=-1, pr=-1;
size_t ui_str_length=0;
int num_tt = 0;
@@ -431,13 +428,19 @@ static int update_title_display(dvd_input_plugin_t *this) {
#ifdef INPUT_DEBUG
printf("input_dvd: Changing title to read '%s'\n", ui_title);
#endif
- uevent.type = XINE_EVENT_UI_SET_TITLE;
- uevent.stream = this->stream;
- uevent.data = &data;
- uevent.data_length = sizeof(data);;
- memcpy(data.str, ui_title, strlen(ui_title) + 1);
- data.str_len = strlen(ui_title) + 1;
- xine_event_send(this->stream, &uevent);
+ {
+ xine_ui_data_t data;
+ xine_event_t uevent;
+ uevent.type = XINE_EVENT_UI_SET_TITLE;
+ uevent.stream = this->stream;
+ uevent.data = &data;
+ uevent.data_length = sizeof(data);
+
+ memcpy(data.str, ui_title, strlen(ui_title) + 1);
+ data.str_len = strlen(ui_title) + 1;
+
+ xine_event_send(this->stream, &uevent);
+ }
return 1;
}
@@ -730,13 +733,14 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
{
dvdnav_cell_change_event_t *cell_event =
(dvdnav_cell_change_event_t*) (block);
- xine_event_t event;
/* Tell xine to update the UI */
- event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
- event.stream = this->stream;
- event.data = NULL;
- event.data_length = 0;
+ xine_event_t event = {
+ .type = XINE_EVENT_UI_CHANNELS_CHANGED,
+ .stream = this->stream,
+ .data = NULL,
+ .data_length = 0
+ };
xine_event_send(this->stream, &event);
if( !update_title_display(this) ) {
@@ -850,8 +854,9 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
return buf;
}
-static off_t dvd_plugin_read (input_plugin_t *this_gen, char *ch_buf, off_t len) {
+static off_t dvd_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) {
/* dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; */
+ char *ch_buf = (char *)buf_gen;
/* FIXME: Tricking the demux_mpeg_block plugin */
ch_buf[0] = 0;
@@ -1369,10 +1374,7 @@ check_solaris_vold_device(dvd_input_class_t *this)
(volume_action = getenv("VOLUME_ACTION")) != NULL &&
strcmp(volume_action, "insert") == 0) {
- device = malloc(strlen(volume_device) + strlen(volume_name) + 2);
- if (device == NULL)
- return;
- sprintf(device, "%s/%s", volume_device, volume_name);
+ asprintf(&device, "%s/%s", volume_device, volume_name);
if (stat(device, &stb) != 0 || !S_ISCHR(stb.st_mode)) {
free(device);
return;
@@ -1476,7 +1478,6 @@ static int dvd_plugin_open (input_plugin_t *this_gen) {
char *locator, *locator_orig;
char *title_part;
- xine_event_t event;
xine_cfg_entry_t region_entry, lang_entry, cfg_entry;
trace_print("Called\n");
@@ -1587,12 +1588,15 @@ static int dvd_plugin_open (input_plugin_t *this_gen) {
free(class->eject_device);
class->eject_device = strdup(this->current_dvd_device);
- /* Tell Xine to update the UI */
- event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
- event.stream = this->stream;
- event.data = NULL;
- event.data_length = 0;
- xine_event_send(this->stream, &event);
+ { /* Tell Xine to update the UI */
+ const xine_event_t event = {
+ .type = XINE_EVENT_UI_CHANNELS_CHANGED,
+ .stream = this->stream,
+ .data = NULL,
+ .data_length = 0
+ };
+ xine_event_send(this->stream, &event);
+ }
update_title_display(this);
@@ -1632,7 +1636,7 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st
this->mem_stack = 0;
this->mem_stack_max = 1024;
- this->mem = xine_xmalloc(sizeof(unsigned char *) * this->mem_stack_max);
+ this->mem = xine_xcalloc(this->mem_stack_max, sizeof(unsigned char *));
if (!this->mem) {
free(this);
return NULL;
@@ -1679,18 +1683,6 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st
return &this->input_plugin;
}
-static const char *dvd_class_get_description (input_class_t *this_gen) {
- trace_print("Called\n");
-
- return "DVD Navigator";
-}
-
-static const char *dvd_class_get_identifier (input_class_t *this_gen) {
- trace_print("Called\n");
-
- return "DVD";
-}
-
/* FIXME: adapt to new api. */
#if 0
static xine_mrl_t **dvd_class_get_dir (input_class_t *this_gen,
@@ -1763,8 +1755,8 @@ static void *init_class (xine_t *xine, void *data) {
return NULL;
this->input_class.get_instance = dvd_class_get_instance;
- this->input_class.get_identifier = dvd_class_get_identifier;
- this->input_class.get_description = dvd_class_get_description;
+ this->input_class.identifier = "DVD";
+ this->input_class.description = N_("DVD Navigator");
/*
this->input_class.get_dir = dvd_class_get_dir;
*/
@@ -1794,8 +1786,7 @@ static void *init_class (xine_t *xine, void *data) {
{
/* we have found libdvdcss, enable the specific config options */
char *raw_device;
- static const char *decrypt_modes[] = { "key", "disc", "title", NULL };
- char *css_cache_default, *css_cache;
+ static const char *const decrypt_modes[] = { "key", "disc", "title", NULL };
int mode;
raw_device = config->register_filename(config, "media.dvd.raw_device",
@@ -1820,22 +1811,6 @@ static void *init_class (xine_t *xine, void *data) {
"playing scrambled DVDs."), 20, NULL, NULL);
xine_setenv("DVDCSS_METHOD", decrypt_modes[mode], 0);
- css_cache_default = (char *)malloc(strlen(xine_get_homedir()) + 10);
- sprintf(css_cache_default, "%s/.dvdcss/", xine_get_homedir());
- css_cache = config->register_filename(config, "media.dvd.css_cache_path", css_cache_default, XINE_CONFIG_STRING_IS_DIRECTORY_NAME,
- _("path to the title key cache"),
- _("Since cracking the copy protection of scrambled DVDs can "
- "be quite time consuming, libdvdcss will cache the cracked "
- "keys in this directory.\nThis setting is security critical, "
- "because files with uncontrollable names will be created in "
- "this directory. Be sure to use a dedicated directory not "
- "used for anything but DVD key caching."),
- XINE_CONFIG_SECURITY, NULL, NULL);
- if (strlen(css_cache) > 0)
- xine_setenv("DVDCSS_CACHE", css_cache, 0);
- free(css_cache_default);
-
-
if(xine->verbosity > XINE_VERBOSITY_NONE)
xine_setenv("DVDCSS_VERBOSE", "2", 0);
else
@@ -1916,6 +1891,6 @@ static void *init_class (xine_t *xine, void *data) {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, "DVD", XINE_VERSION_CODE, NULL, init_class },
+ { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 18, "DVD", XINE_VERSION_CODE, NULL, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};