From: Takuro A. <ma...@us...> - 2005-01-28 13:37:03
|
Update of /cvsroot/gtkmmviewer/gimageview/plugins/image_view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11579/plugins/image_view Modified Files: gimv_xine.c gimv_xine.h gimv_xine_priv.c gimv_xine_priv.h prefs_xine.c Log Message: Enabled to choose audio & video drivers for Xine view. Index: gimv_xine.c =================================================================== RCS file: /cvsroot/gtkmmviewer/gimageview/plugins/image_view/gimv_xine.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gimv_xine.c 3 Oct 2004 16:26:40 -0000 1.6 --- gimv_xine.c 28 Jan 2005 13:36:10 -0000 1.7 *************** *** 240,268 **** gimv_xine_init (GimvXine *this) { - GimvXinePrivate *priv; - this->widget.requisition.width = 8; this->widget.requisition.height = 8; ! priv = this->private = g_new0 (GimvXinePrivate, 1); ! ! /* ! * create a new xine instance, load config values ! */ ! ! priv->xine = xine_new (); ! ! g_snprintf (priv->configfile, 255, "%s/.gimv/xinerc", getenv ("HOME")); ! xine_config_load (priv->xine, priv->configfile); ! ! priv->stream = NULL; ! priv->event_queue = NULL; ! priv->vo_driver = NULL; ! priv->ao_driver = NULL; ! ! priv->oldwidth = 0; ! priv->oldheight = 0; ! ! xine_init (priv->xine); } --- 240,247 ---- gimv_xine_init (GimvXine *this) { this->widget.requisition.width = 8; this->widget.requisition.height = 8; ! this->private = gimv_xine_private_new (); } *************** *** 272,288 **** { GimvXine *gtx = GIMV_XINE (object); - GimvXinePrivate *priv; g_return_if_fail (GIMV_IS_XINE (gtx)); ! priv = gtx->private; ! ! if (priv) { ! /* exit xine */ ! if (priv->xine) ! xine_exit (priv->xine); ! priv->xine = NULL; ! ! g_free (gtx->private); gtx->private = NULL; } --- 251,259 ---- { GimvXine *gtx = GIMV_XINE (object); g_return_if_fail (GIMV_IS_XINE (gtx)); ! if (gtx->private) { ! gimv_xine_private_destroy (gtx->private); gtx->private = NULL; } *************** *** 385,389 **** GimvXinePrivate *priv; ! const char *video_driver_id; xine_vo_driver_t *vo_driver; --- 356,360 ---- GimvXinePrivate *priv; ! const char *video_driver_id = "auto"; xine_vo_driver_t *vo_driver; *************** *** 414,427 **** #endif /* defined(GDK_WINDOWING_X11) */ ! if (priv->video_driver_id) { video_driver_id = priv->video_driver_id; ! } else { ! /* try to init video with stored information */ ! video_driver_id = xine_config_register_string (priv->xine, ! "video.driver", ! "auto", ! "video driver to use", ! NULL, 10, NULL, NULL); ! } if (strcmp (video_driver_id, "auto")) { --- 385,392 ---- #endif /* defined(GDK_WINDOWING_X11) */ ! if (priv->video_driver_id) video_driver_id = priv->video_driver_id; ! else ! video_driver_id = gimv_xine_get_default_video_out_driver_id (this); if (strcmp (video_driver_id, "auto")) { *************** *** 447,451 **** GimvXinePrivate *priv; xine_ao_driver_t *ao_driver; ! const char *audio_driver_id; g_return_val_if_fail (GIMV_IS_XINE (this), NULL); --- 412,416 ---- GimvXinePrivate *priv; xine_ao_driver_t *ao_driver; ! const char *audio_driver_id = "auto"; g_return_val_if_fail (GIMV_IS_XINE (this), NULL); *************** *** 455,464 **** audio_driver_id = priv->audio_driver_id; else ! /* try to init audio with stored information */ ! audio_driver_id = xine_config_register_string (priv->xine, ! "audio.driver", ! "auto", ! "audio driver to use", ! NULL, 10, NULL, NULL); if (!strcmp (audio_driver_id, "null")) --- 420,424 ---- audio_driver_id = priv->audio_driver_id; else ! audio_driver_id = gimv_xine_get_default_audio_out_driver_id (this); if (!strcmp (audio_driver_id, "null")) *************** *** 698,704 **** #endif /* defined (GDK_WINDOWING_X11) */ - /* save configuration */ - xine_config_save (priv->xine, priv->configfile); - /* Hide all windows */ if (GTK_WIDGET_MAPPED (widget)) --- 658,661 ---- *************** *** 726,738 **** priv = GIMV_XINE (this)->private; ! if (video_driver_id) priv->video_driver_id = strdup (video_driver_id); ! else ! priv->video_driver_id = NULL; ! if (audio_driver_id) priv->audio_driver_id = strdup (audio_driver_id); ! else ! priv->audio_driver_id = NULL; return this; --- 683,695 ---- priv = GIMV_XINE (this)->private; ! if (video_driver_id) { ! g_free (priv->video_driver_id); priv->video_driver_id = strdup (video_driver_id); ! } ! if (audio_driver_id) { ! g_free (priv->audio_driver_id); priv->audio_driver_id = strdup (audio_driver_id); ! } return this; *************** *** 740,743 **** --- 697,768 ---- + const char * const * + gimv_xine_get_video_out_plugins (GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return xine_list_video_output_plugins (gtx->private->xine); + } + + + const char * const * + gimv_xine_get_audio_out_plugins (GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return xine_list_audio_output_plugins (gtx->private->xine); + } + + + const gchar * + gimv_xine_get_video_out_driver_id(GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return gtx->private->video_driver_id; + } + + + const gchar * + gimv_xine_get_audio_out_driver_id(GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return gtx->private->audio_driver_id; + } + + + const gchar * + gimv_xine_get_default_video_out_driver_id(GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return xine_config_register_string (gtx->private->xine, + "video.driver", + "auto", + "video driver to use", + NULL, 10, NULL, NULL); + } + + + const gchar * + gimv_xine_get_default_audio_out_driver_id(GimvXine *gtx) + { + g_return_val_if_fail(GIMV_IS_XINE (gtx), NULL); + g_return_val_if_fail(gtx->private, NULL); + + return xine_config_register_string (gtx->private->xine, + "audio.driver", + "auto", + "audio driver to use", + NULL, 10, NULL, NULL); + } + + static gint gimv_xine_expose (GtkWidget *widget, GdkEventExpose *event) *************** *** 1507,1511 **** g_return_if_fail (priv->xine); ! xine_config_load (priv->xine, cfg_filename); } --- 1532,1539 ---- g_return_if_fail (priv->xine); ! if (cfg_filename) ! xine_config_load (priv->xine, cfg_filename); ! else ! xine_config_load (priv->xine, priv->configfile); } *************** *** 1522,1526 **** g_return_if_fail (priv->xine); ! xine_config_save (priv->xine, cfg_filename); } --- 1550,1558 ---- g_return_if_fail (priv->xine); ! if (cfg_filename) ! xine_config_save (priv->xine, cfg_filename); ! else { ! xine_config_save (priv->xine, priv->configfile); ! } } Index: prefs_xine.c =================================================================== RCS file: /cvsroot/gtkmmviewer/gimageview/plugins/image_view/prefs_xine.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** prefs_xine.c 3 Oct 2004 19:18:57 -0000 1.4 --- prefs_xine.c 28 Jan 2005 13:36:12 -0000 1.5 *************** *** 29,32 **** --- 29,33 ---- #include "gtkutils.h" #include "gimv_prefs_ui_utils.h" + #include "gimv_xine.h" #define CONF_THUMBNAIL_ENABLE_KEY "thumbnail_enable" *************** *** 51,55 **** }; ! typedef struct XineConf_Tag { #if 0 --- 52,56 ---- }; ! static struct XineConf { #if 0 *************** *** 60,67 **** gfloat thumb_pos; gfloat delay; ! } XineConf; ! ! static XineConf xineconf, xineconf_pre; gboolean --- 61,71 ---- gfloat thumb_pos; gfloat delay; ! } xineconf, xineconf_pre; + static struct XineConfUI + { + GimvXine *gxine; + GtkWidget *vo_combo, *ao_combo; + } xineconfui; gboolean *************** *** 162,167 **** GtkAdjustment *adj; GimvPluginInfo *this = gimv_xine_plugin_get_info (); ! ! main_vbox = gtk_vbox_new (FALSE, 0); xineconf.thumb = xineconf_pre.thumb --- 166,174 ---- GtkAdjustment *adj; GimvPluginInfo *this = gimv_xine_plugin_get_info (); ! const char * const * drivers; ! const char *driver; ! GList *list = NULL; ! GimvXine *gxine; ! gint i; xineconf.thumb = xineconf_pre.thumb *************** *** 172,207 **** = gimv_prefs_xine_get_delay (this); /********************************************** * Driver Frame **********************************************/ ! gimv_prefs_ui_create_frame(_("Driver (Not implemented yet)"), frame, vbox, main_vbox, FALSE); - #if 0 - /* video driver combo */ - hbox = gtk_hbox_new (FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER (hbox), 5); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show (hbox); - - label = gtk_label_new (_("Video driver : ")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); - gtk_widget_show (label); - - vo_combo = gtk_combo_new (); - gtk_box_pack_start (GTK_BOX (hbox), vo_combo, FALSE, FALSE, 2); - gtk_widget_show (vo_combo); - gtk_widget_set_usize (vo_combo, 100, -1); - - /* audio driver combo */ - label = gtk_label_new (_("Audio driver : ")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); - gtk_widget_show (label); - - ao_combo = gtk_combo_new (); - gtk_box_pack_start (GTK_BOX (hbox), ao_combo, FALSE, FALSE, 2); - gtk_widget_show (ao_combo); - gtk_widget_set_usize (ao_combo, 100, -1); - #else alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); --- 179,195 ---- = gimv_prefs_xine_get_delay (this); + main_vbox = gtk_vbox_new (FALSE, 0); + + gxine = GIMV_XINE(gimv_xine_new(NULL, NULL)); + gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET(gxine), + FALSE, FALSE, 0); + xineconfui.gxine = gxine; + /********************************************** * Driver Frame **********************************************/ ! gimv_prefs_ui_create_frame(_("Driver"), frame, vbox, main_vbox, FALSE); alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); *************** *** 222,225 **** --- 210,214 ---- vo_combo = gtk_combo_new (); + xineconfui.vo_combo = vo_combo; alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); gtk_container_add (GTK_CONTAINER (alignment), vo_combo); *************** *** 230,233 **** --- 219,233 ---- gtk_widget_set_usize (vo_combo, 100, -1); + drivers = gimv_xine_get_video_out_plugins (gxine); + list = g_list_append(list, "auto"); + for (driver = drivers[0], i = 0; driver; driver = drivers[++i]) + list = g_list_append (list, (gpointer) driver); + gtk_combo_set_popdown_strings (GTK_COMBO (vo_combo), (GList *) list); + g_list_free (list); + list = NULL; + + driver = gimv_xine_get_default_video_out_driver_id (gxine); + gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vo_combo)->entry), driver); + /* audio driver combo */ label = gtk_label_new (_("Audio driver : ")); *************** *** 240,243 **** --- 240,244 ---- ao_combo = gtk_combo_new (); + xineconfui.ao_combo = ao_combo; alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); gtk_container_add (GTK_CONTAINER (alignment), ao_combo); *************** *** 247,253 **** gtk_widget_show (ao_combo); gtk_widget_set_usize (ao_combo, 100, -1); - #endif ! gtk_widget_set_sensitive (frame, FALSE); /********************************************** --- 248,264 ---- gtk_widget_show (ao_combo); gtk_widget_set_usize (ao_combo, 100, -1); ! drivers = gimv_xine_get_audio_out_plugins (gxine); ! list = g_list_append(list, "auto"); ! for (driver = drivers[0], i = 0; driver; driver = drivers[++i]) ! list = g_list_append (list, (gpointer) driver); ! gtk_combo_set_popdown_strings (GTK_COMBO (ao_combo), (GList *) list); ! g_list_free (list); ! list = NULL; ! ! driver = gimv_xine_get_default_audio_out_driver_id (gxine); ! gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (ao_combo)->entry), driver); ! ! /*gtk_widget_set_sensitive (frame, FALSE);*/ /********************************************** *************** *** 323,330 **** --- 334,348 ---- GimvPluginInfo *this = gimv_xine_plugin_get_info(); gchar pos_str[32], *enable; + const gchar *vo_driver = NULL; + const gchar *ao_driver = NULL; + xine_cfg_entry_t entry; switch (action) { case GIMV_PREFS_WIN_ACTION_OK: case GIMV_PREFS_WIN_ACTION_APPLY: + vo_driver = gtk_entry_get_text + (GTK_ENTRY (GTK_COMBO (xineconfui.vo_combo)->entry)); + ao_driver = gtk_entry_get_text + (GTK_ENTRY (GTK_COMBO (xineconfui.ao_combo)->entry)); enable = xineconf.thumb ? "TRUE" : "FALSE"; g_snprintf(pos_str, 32, "%f", xineconf.thumb_pos); *************** *** 338,341 **** --- 356,382 ---- } + if (vo_driver) { + gimv_xine_config_lookup_entry (xineconfui.gxine, + "video.driver", + &entry); + entry.str_value = vo_driver; + gimv_xine_config_update_entry (xineconfui.gxine, + &entry); + gimv_xine_config_lookup_entry (xineconfui.gxine, + "video.driver", + &entry); + } + if (ao_driver) { + gimv_xine_config_lookup_entry (xineconfui.gxine, + "audio.driver", + &entry); + entry.str_value = ao_driver; + gimv_xine_config_update_entry (xineconfui.gxine, + &entry); + gimv_xine_config_lookup_entry (xineconfui.gxine, + "audio.driver", + &entry); + } + gimv_xine_config_save (xineconfui.gxine, NULL); gimv_plugin_prefs_save_value (this->name, GIMV_PLUGIN_IMAGE_LOADER, Index: gimv_xine.h =================================================================== RCS file: /cvsroot/gtkmmviewer/gimageview/plugins/image_view/gimv_xine.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gimv_xine.h 21 Sep 2004 08:44:28 -0000 1.4 --- gimv_xine.h 28 Jan 2005 13:36:10 -0000 1.5 *************** *** 95,98 **** --- 95,108 ---- GtkWidget *gimv_xine_new (const gchar *video_driver_id, const gchar *audio_driver_id); + const char * const * + gimv_xine_get_video_out_plugins (GimvXine *gtx); + const char * const * + gimv_xine_get_audio_out_plugins (GimvXine *gtx); + const gchar *gimv_xine_get_video_out_driver_id(GimvXine *gtx); + const gchar *gimv_xine_get_audio_out_driver_id(GimvXine *gtx); + const gchar *gimv_xine_get_default_video_out_driver_id + (GimvXine *gtx); + const gchar *gimv_xine_get_default_audio_out_driver_id + (GimvXine *gtx); void gimv_xine_set_visibility (GimvXine *gtx, GdkVisibilityState state); *************** *** 103,109 **** gint height); - void gimv_xine_show_name (GimvXine *gtx, - gchar *name); - gint gimv_xine_set_mrl (GimvXine *gtx, const gchar *mrl); --- 113,116 ---- *************** *** 127,131 **** gint gimv_xine_is_playing (GimvXine *gtx); gint gimv_xine_is_seekable (GimvXine *gtx); - void gimv_xine_save_config (GimvXine *gtx); void gimv_xine_set_video_property (GimvXine *gtx, gint property, --- 134,137 ---- Index: gimv_xine_priv.h =================================================================== RCS file: /cvsroot/gtkmmviewer/gimageview/plugins/image_view/gimv_xine_priv.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gimv_xine_priv.h 12 Jul 2003 15:53:31 -0000 1.3 --- gimv_xine_priv.h 28 Jan 2005 13:36:12 -0000 1.4 *************** *** 44,47 **** --- 44,48 ---- #include <gtk/gtk.h> + #include "gimv_xine.h" #if (GTK_MAJOR_VERSION == 1) && (GTK_MAJOR_VERION <= 2) *************** *** 93,97 **** double display_ratio; ! char configfile[256]; char *video_driver_id; --- 94,98 ---- double display_ratio; ! char *configfile; char *video_driver_id; *************** *** 117,132 **** struct { ! xine_stream_t *stream; ! xine_event_queue_t *event_queue; ! int running; ! int current; ! int enabled; /* 0, 1:vpost, 2:vanim */ ! char **mrls; ! int num_mrls; ! int post_plugin_num; ! xine_post_t *post_output; ! int post_changed; } visual_anim; --- 118,133 ---- struct { ! xine_stream_t *stream; ! xine_event_queue_t *event_queue; ! int running; ! int current; ! int enabled; /* 0, 1:vpost, 2:vanim */ ! char **mrls; ! int num_mrls; ! int post_plugin_num; ! xine_post_t *post_output; ! int post_changed; } visual_anim; *************** *** 152,155 **** --- 153,158 ---- + GimvXinePrivate *gimv_xine_private_new (void); + void gimv_xine_private_destroy (GimvXinePrivate *priv); GimvXinePrivImage *gimv_xine_priv_image_new (gint imgsize); void gimv_xine_priv_image_delete (GimvXinePrivImage *image); Index: gimv_xine_priv.c =================================================================== RCS file: /cvsroot/gtkmmviewer/gimageview/plugins/image_view/gimv_xine_priv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gimv_xine_priv.c 3 Oct 2004 16:25:22 -0000 1.4 --- gimv_xine_priv.c 28 Jan 2005 13:36:10 -0000 1.5 *************** *** 31,34 **** --- 31,110 ---- + static xine_t *priv_xine = NULL; + static guint *priv_xine_ref_count = 0; + static char configfile[256]; + + + GimvXinePrivate * + gimv_xine_private_new (void) + { + GimvXinePrivate *priv; + + priv = g_new0 (GimvXinePrivate, 1); + + /* + * create a new xine instance, load config values + */ + + if (priv_xine_ref_count == 0) { + priv->xine = priv_xine = xine_new (); + g_snprintf (configfile, 255, "%s/.gimv/xinerc", getenv ("HOME")); + priv->configfile = g_strdup (configfile); + xine_config_load (priv->xine, configfile); + xine_init (priv->xine); + priv_xine_ref_count++; + } else { + priv->xine = priv_xine; + priv->configfile = g_strdup (configfile); + } + + priv->stream = NULL; + priv->event_queue = NULL; + priv->vo_driver = NULL; + priv->ao_driver = NULL; + + priv->oldwidth = 0; + priv->oldheight = 0; + + priv->video_driver_id = 0; + priv->audio_driver_id = 0; + + return priv; + } + + + void + gimv_xine_private_destroy (GimvXinePrivate *priv) + { + if (!priv) return; + + if (priv->video_driver_id) + g_free (priv->video_driver_id); + priv->video_driver_id = NULL; + + if (priv->audio_driver_id) + g_free (priv->audio_driver_id); + priv->audio_driver_id = NULL; + + /* exit xine */ + if (priv_xine_ref_count > 0) { + /* save configuration */ + xine_config_save (priv->xine, priv->configfile); + g_free (priv->configfile); + priv->configfile = NULL; + + priv_xine_ref_count--; + if (priv_xine_ref_count == 0) { + xine_exit (priv_xine); + priv_xine = NULL; + } + } + + priv->xine = NULL; + + g_free (priv); + } + + /****************************************************************************** * |