diff options
Diffstat (limited to 'src/input/input_dvd.c')
-rw-r--r-- | src/input/input_dvd.c | 86 |
1 files changed, 38 insertions, 48 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index a891b9877..55e975eab 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; @@ -1476,7 +1481,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 +1591,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 +1639,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; @@ -1794,8 +1801,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 +1826,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 |