⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xineplug_inp_vcd.c

📁 linux下的MPEG1
💻 C
📖 第 1 页 / 共 5 页
字号:
     pointer to input plugin     NULL on failure*/static input_plugin_t *vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream,                        const char *mrl) {  vcd_input_class_t  *class = (vcd_input_class_t *) class_gen;  char intended_vcd_device[MAX_DEVICE_LEN+1]= { '\0', };  vcdinfo_itemid_t itemid;  char *check_mrl=NULL;  bool used_default;  if (mrl == NULL)     check_mrl = strdup(MRL_PREFIX);  else     check_mrl = strdup(mrl);  dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called with %s\n", mrl);  if ( strncasecmp(check_mrl, MRL_PREFIX, MRL_PREFIX_LEN) ) {    goto free_and_return;  }  vcd_get_default_device(class, false);  if (!vcd_parse_mrl(class->vcd_device, check_mrl,                      intended_vcd_device, &itemid,                     my_vcd.player.default_autoplay, &used_default)) {    dbg_print(INPUT_DBG_MRL, "parsing MRL %s failed\n", check_mrl);    goto free_and_return;  }  free(my_vcd.mrl);  my_vcd.mrl         = strdup(check_mrl);  my_vcd.stream      = stream;  my_vcd.event_queue = xine_event_new_queue (stream);  class->ip          = &my_vcd; /* Can probably get rid of this... */  if (!vcd_build_mrl_list(class, intended_vcd_device)) {    goto free_and_return;  }  my_vcd.player.user_data   = (void *) class;  /* Do we set PBC (via LID) on? */  my_vcd.player.i_lid =     ( VCDINFO_ITEM_TYPE_LID == itemid.type       && my_vcd.player.i_lids > itemid.num )    ? itemid.num    :  VCDINFO_INVALID_ENTRY;  if ( VCDINFO_ITEM_TYPE_LID == itemid.type && used_default) {    /* LID was selected automatically but we don't have PBC for this VCD.        So silently change LID to track and continue.     */    itemid.type=VCDINFO_ITEM_TYPE_TRACK;  }  if ( 0==itemid.num        && ( (VCDINFO_ITEM_TYPE_LID == itemid.type)             || (VCDINFO_ITEM_TYPE_TRACK == itemid.type) ) )    itemid.num = 1;  dbg_print(INPUT_DBG_PBC, "Jumping to NUM >%i<, type >%i<\n",             itemid.num, itemid.type);  vcd_set_meta_info(&my_vcd);  vcdplayer_play(&my_vcd.player, itemid);    dbg_print(INPUT_DBG_MRL, "Successfully opened MRL %s.\n",             my_vcd.mrl);  free (check_mrl);  return &(my_vcd.input_plugin); free_and_return:  free (check_mrl);  return NULL;}#define VCD_NUM_CALLBACK(fn_name, var) \ static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \{ \\  dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value); \\  my_vcd.player.var = entry->num_value; \}#define VCD_ENUM_CALLBACK(fn_name, enum_type, var) \ static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \{ \  dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value); \\  my_vcd.player.var = (enum_type) entry->num_value; \}#define VCD_STR_CALLBACK(fn_name, var) \ static void fn_name(void *this_gen, xine_cfg_entry_t *entry) \{ \\  dbg_print(INPUT_DBG_CALL, "Called setting %s\n", entry->str_value); \  if ( NULL == entry->str_value ) return; \\  if ( var ) free(var); \  var = strdup(entry->str_value); \}VCD_STR_CALLBACK(vcd_default_dev_changed_cb,                   my_vcd.class->vcd_device)VCD_STR_CALLBACK(vcd_title_format_changed_cb,                   my_vcd.v_config.title_format)VCD_STR_CALLBACK(vcd_comment_format_changed_cb,                   my_vcd.v_config.comment_format)VCD_NUM_CALLBACK(vcd_show_rejected_cb, show_rejected)VCD_NUM_CALLBACK(vcd_autoadvance_cb, autoadvance)VCD_ENUM_CALLBACK(vcd_slider_length_cb, vcdplayer_slider_length_t,                    slider_length)VCD_ENUM_CALLBACK(vcd_default_autoplay_cb, vcdinfo_item_enum_t,                   default_autoplay)static void vcd_debug_cb(void *this_gen, xine_cfg_entry_t *entry) {  dbg_print(INPUT_DBG_CALL, "Called setting %d\n", entry->num_value);  vcdplayer_debug = entry->num_value; }static void *vcd_init (xine_t *xine, void *data){  vcd_input_class_t  *class;  config_values_t    *config;  dbg_print(INPUT_DBG_CALL, "Called\n");  class = (vcd_input_class_t *) xine_xmalloc (sizeof (vcd_input_class_t));  class->xine   = xine;  class->config = config = xine->config;  vcd_class     = class;  class->mrls   = NULL;  class->input_class.get_instance        = vcd_class_get_instance;  class->input_class.get_identifier      = vcd_class_get_identifier;  class->input_class.get_description     = vcd_class_get_description;  class->input_class.get_dir             = vcd_class_get_dir;   class->input_class.get_autoplay_list   = vcd_class_get_autoplay_list;  class->input_class.dispose		 = vcd_class_dispose;  class->input_class.eject_media         = vcd_class_eject_media;  memset(&my_vcd, 0, sizeof(my_vcd));  /*------------------------------------------------------------------    Callback functions.  ---------------------------------------------------------------------*/  my_vcd.player.flush_buffers          = &vcd_flush_buffers;  my_vcd.player.update_title           = &vcd_update_title_display;  my_vcd.player.log_err                = (generic_fn) &xine_log_err;  my_vcd.player.log_msg                = (generic_fn) &xine_log_msg;  my_vcd.player.force_redisplay        = &vcd_force_redisplay;  my_vcd.player.set_aspect_ratio       = &vcd_set_aspect_ratio;    /*-------------------------------------------------------------     Playback control-specific fields    --------------------------------------------------------------*/  my_vcd.player.i_lid                  = VCDINFO_INVALID_ENTRY;  my_vcd.player.end_lsn                = VCDINFO_NULL_LSN;  my_vcd.player.pdi                    = -1;  my_vcd.player.pxd.psd                = NULL;  /*-----------------------------------     Navigation fields   ------------------------------------*/  my_vcd.player.next_entry             = -1;  my_vcd.player.prev_entry             = -1;  my_vcd.player.return_entry           = -1;  my_vcd.player.default_entry          = -1;    /*--------------------------------------------------------------    Configuration variables   ---------------------------------------------------------------*/  {     /*Note: these labels have to be listed in the same order as the      enumeration vcdplayer_autoplay_t in vcdplayer.h.     */    static const char *autoplay_modes[] =       { "MPEG track", "entry", "segment",  "playback-control item", NULL };        /*Note: these labels have to be listed in the same order as the      enumeration vcdplayer_slider_length_t in vcdplayer.h.     */    static const char *length_reporting_modes[] =       { "auto", "track", "entry", NULL };        my_vcd.player.default_autoplay =       config->register_enum(config,                             "media.vcd.autoplay",                            VCDPLAYER_AUTOPLAY_PBC,                            (char **) autoplay_modes,                            _("VCD default type to use on autoplay"),_("The VCD play unit to use when none is specified in an MRL, e.g. "                            "vcd:// or vcd:///dev/dvd:"),                            10,                             vcd_default_autoplay_cb, class);            class->vcd_device =       strdup (config->register_filename(config,                               "media.vcd.device",                              "", XINE_CONFIG_STRING_IS_DEVICE_NAME,          _("CD-ROM drive used for VCD when none given"),_("What to use if no drive specified. If the setting is empty, xine will scan for CD drives."),                               20,                              vcd_default_dev_changed_cb,                               (void *) class));    my_vcd.player.slider_length =      config->register_enum(config,                             "media.vcd.length_reporting",                            VCDPLAYER_SLIDER_LENGTH_AUTO,                             (char **) length_reporting_modes,                            _("VCD position slider range"),_("range that the stream playback position slider represents playing a VCD."),                            10,                             vcd_slider_length_cb, NULL);#if READAHEAD_FINISHED    my_vcd.player.readahead =       config->register_bool(config, "vcd.use_readahead",                            (int) false,                            _("VCD read-ahead caching?"),                            _("Class "                              "may lead to jerky playback on low-end "                              "machines."),                            vcd_read_ahead_cb, NULL);#endif  my_vcd.player.autoadvance =     config->register_bool(config,                         "media.vcd.autoadvance",                        (int) true,                        _("automatically advance VCD track/entry"),_("If enabled, we should automatically advance to the next entry or track. Used only when playback control (PBC) is disabled."),                        10,                         vcd_autoadvance_cb,                         NULL);   my_vcd.player.show_rejected =     config->register_bool(config,                         "media.vcd.show_rejected",                        (int) false,                        _("show 'rejected' VCD LIDs"),_("Some playback list IDs (LIDs) are marked not showable, ""but you can see them in the MRL list if this is set. Rejected entries ""are marked with an asterisk (*) appended to the MRL."),                        10,                         vcd_show_rejected_cb,                         NULL);   my_vcd.v_config.title_format =     strdup(config->register_string(config,                          "media.vcd.title_format",                          "%F - %I %N%L%S, disk %c of %C - %v %A",                          _("VCD format string for display banner"),_("VCD format used in the GUI Title. Similar to the Unix date ""command. Format specifiers start with a percent sign. Specifiers are:\n"" %A : The album information\n"" %C : The VCD volume count - the number of CD's in the collection.\n"" %c : The VCD volume num - the number of the CD in the collection.\n"" %F : The VCD Format, e.g. VCD 1.0, VCD 1.1, VCD 2.0, or SVCD\n"" %I : The current entry/segment/playback type, e.g. ENTRY, TRACK, ...\n"" %L : The playlist ID prefixed with \" LID\" if it exists\n"" %N : The current number of the above - a decimal number\n"" %P : The publisher ID\n"" %p : The preparer ID\n"" %S : If we are in a segment (menu), the kind of segment\n"" %T : The track number\n"" %V : The volume set ID\n"" %v : The volume ID\n""      A number between 1 and the volume count.\n"" %% : a %\n"),                          20,                          vcd_title_format_changed_cb,                          NULL));  my_vcd.v_config.comment_format =     strdup(config->register_string(config,                          "media.vcd.comment_format",                          "%P - Track %T",                          _("VCD format string for stream comment field"),_("VCD format used in the GUI Title. Similar to the Unix date ""command. Format specifiers start with a percent sign. Specifiers are ""%A, %C, %c, %F, %I, %L, %N, %P, %p, %S, %T, %V, %v, and %%.\n""See the help for the title_format for the meanings of these."),                          20,                          vcd_comment_format_changed_cb,                          NULL));  vcdplayer_debug =   config->register_num(config,                        "media.vcd.debug",                       0,                       _("VCD debug flag mask"),_("For tracking down bugs in the VCD plugin. Mask values are:\n""   1: Meta information\n""   2: input (keyboard/mouse) events\n""   4: MRL parsing\n""   8: Calls from external routines\n""  16: routine calls\n""  32: LSN changes\n""  64: Playback control\n"" 128: Debugging from CDIO\n"" 256: Seeks to set location\n"" 512: Seeks to find current location\n""1024: Still-frame\n""2048: Debugging from VCDINFO\n"),                        20,                        vcd_debug_cb,                         class);   }    gl_default_vcd_log_handler  = vcd_log_set_handler (uninit_log_handler);  gl_default_cdio_log_handler =     cdio_log_set_handler ((cdio_log_handler_t) uninit_log_handler);  my_vcd.input_plugin.open               = vcd_plugin_open;  my_vcd.input_plugin.get_capabilities   = vcd_plugin_get_capabilities;  my_vcd.input_plugin.read               = vcd_plugin_read;  my_vcd.input_plugin.read_block         = vcd_plugin_read_block;  my_vcd.input_plugin.seek               = vcd_plugin_seek;  my_vcd.input_plugin.get_current_pos    = vcd_plugin_get_current_pos;  my_vcd.input_plugin.get_length         = vcd_plugin_get_length;  my_vcd.input_plugin.get_blocksize      = vcd_plugin_get_blocksize;  my_vcd.input_plugin.get_mrl            = vcd_plugin_get_mrl;  my_vcd.input_plugin.get_optional_data  = vcd_get_optional_data;  my_vcd.input_plugin.dispose            = vcd_plugin_dispose;  my_vcd.input_plugin.input_class        = (input_class_t *) class;  my_vcd.stream                          = NULL;  my_vcd.class                           = class;  my_vcd.i_mouse_button                  = -1;  my_vcd.b_mouse_in                      = false;    my_vcd.player.psz_source               = NULL;  my_vcd.player.b_opened                 = false;  my_vcd.player.play_item.num            = VCDINFO_INVALID_ENTRY;  my_vcd.player.play_item.type           = VCDINFO_ITEM_TYPE_ENTRY;  my_vcd.player_device                   = NULL;  return class;}/*    Exported plugin catalog entries.   All plugins listing only the current API number break when the API   number is increased. This is by design.    Sometimes in the rush to get out a buggy release, the API number is   increased without communication let alone a concern for whether it   is necessary or how many plugins it might break. And that is   precisely when what happened between API release 12 and API   13. Input plugin API numbers 12 and 13 are functionally identical.   Because of problems like this, we'll just put in a future API   release. If the number was increased for a reason that doesn't   affect us (such as for nor reason at all), then this plugin will   work unmodified that future APIs. If on the other hand there was   incompatible change, we are no worse off than if we hadn't entered   the next API number since in both cases the plugin is broken. */const plugin_info_t xine_plugin_info[] EXPORTED = {  /* type, API, "name", version, special_info, init_function */    { PLUGIN_INPUT | PLUGIN_MUST_PRELOAD, 17, (char *) SHORT_PLUGIN_NAME,    XINE_VERSION_CODE, NULL, vcd_init },  { PLUGIN_NONE, 0, (char *) "", 0, NULL, NULL }};/*  * Local variables: *  c-file-style: "gnu" *  tab-width: 8 *  indent-tabs-mode: nil * End: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -