From: Darren S. <ds...@us...> - 2005-03-09 20:03:37
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22795/src Modified Files: gtkvideo.c gtkvideo.h main.c post.c player.c Log Message: Use a plugin chain for deinterlacing. This allows arbitrary video plugins such as pp. Index: gtkvideo.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/gtkvideo.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- gtkvideo.c 8 Mar 2005 18:20:24 -0000 1.41 +++ gtkvideo.c 9 Mar 2005 20:03:09 -0000 1.42 @@ -80,6 +80,11 @@ static void gtk_video_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static GList *gtv_create_plugins (gtk_video_private_t *priv, + xine_audio_port_t **audio, + xine_video_port_t **video, + const char *plugins, int type); + static GtkWidgetClass *parent_class = NULL; static pthread_mutex_t resize_lock = PTHREAD_MUTEX_INITIALIZER; @@ -139,13 +144,11 @@ char *vis_plugin_id; xine_audio_port_t *vis_audio; - /* tvtime */ - xine_post_t *tvtime_plugin; - gboolean deinterlace; - - /* other post-plugins (lists of xine_post_t) */ - GList *post_video, *post_audio; - gboolean post_video_enable, post_audio_enable; + /* post-plugins */ + struct { + GList *list; + gboolean enable; + } post_deinterlace, post_video, post_audio; }; static int gtv_table_signals[LAST_SIGNAL] = { 0 }; @@ -942,9 +945,6 @@ return ; } - priv->tvtime_plugin = xine_post_init (priv->xine, "tvtime", 0, - NULL, &priv->video_port); - /* * create mouse cursors */ @@ -1049,8 +1049,9 @@ priv->button_release_mask = button_release_mask; priv->vis_plugin_id = NULL; priv->vis_plugin = NULL; - priv->tvtime_plugin = NULL; - priv->post_audio = priv->post_video = NULL; + priv->post_deinterlace.list = NULL; + priv->post_video.list = NULL; + priv->post_audio.list = NULL; if (video_driver_id) priv->video_driver_id = strdup (video_driver_id); @@ -1365,11 +1366,12 @@ static void gtv_wire_plugins_video (gtk_video_private_t *priv) { /* note: assumes default wiring */ - GList *list = priv->post_video_enable ? g_list_copy (priv->post_video) : NULL; + GList *list = priv->post_video.enable + ? g_list_copy (priv->post_video.list) : NULL; GList *item, *next = NULL; - if (priv->tvtime_plugin && priv->deinterlace) - list = g_list_prepend (list, priv->tvtime_plugin); + if (priv->post_deinterlace.list && priv->post_deinterlace.enable) + list = g_list_concat (g_list_copy (priv->post_deinterlace.list), list); xine_post_wire_video_port (xine_get_video_source (priv->stream), priv->video_port); @@ -1398,7 +1400,7 @@ GList *item; xine_post_wire_video_port (xine_get_video_source (priv->stream), priv->video_port); - item = g_list_last (priv->post_video); + item = g_list_last (priv->post_video.list); while (item) { xine_post_wire (NULL, gtv_post_input_video (item->data)); @@ -1416,9 +1418,10 @@ g_return_if_fail (priv->stream != NULL); gtv_unwire_plugins_video (priv); - gtv_dispose_plugins (priv, priv->post_video); - priv->post_video = gtv_create_plugins (priv, NULL, &priv->video_port, - params, XINE_POST_TYPE_VIDEO_FILTER); + gtv_dispose_plugins (priv, priv->post_video.list); + priv->post_video.list = + gtv_create_plugins (priv, NULL, &priv->video_port, params, + XINE_POST_TYPE_VIDEO_FILTER); gtv_wire_plugins_video (priv); } @@ -1432,13 +1435,13 @@ g_return_if_fail (priv->stream != NULL); gtv_unwire_plugins_video (priv); - priv->post_video_enable = on; + priv->post_video.enable = on; gtv_wire_plugins_video (priv); } gboolean gtk_video_get_use_post_plugins_video (GtkVideo *gtv) { - return (gtv && gtv->priv) ? gtv->priv->post_video_enable : FALSE; + return (gtv && gtv->priv) ? gtv->priv->post_video.enable : FALSE; } @@ -1460,7 +1463,8 @@ xine_audio_port_t *audio_port) { /* note: assumes default wiring */ - GList *list = priv->post_audio_enable ? g_list_copy (priv->post_audio) : NULL; + GList *list = priv->post_audio.enable + ? g_list_copy (priv->post_audio.list) : NULL; GList *item, *next = NULL; if (priv->vis_active && priv->vis_plugin) @@ -1490,7 +1494,7 @@ { GList *item; xine_post_wire_audio_port (xine_get_audio_source (priv->stream), audio_port); - item = g_list_last (priv->post_audio); + item = g_list_last (priv->post_audio.list); while (item) { xine_post_wire (NULL, gtv_post_input_audio (item->data)); @@ -1511,9 +1515,10 @@ g_return_if_fail (priv->stream != NULL); gtv_unwire_plugins_audio (priv, audio_port); - gtv_dispose_plugins (priv, priv->post_audio); - priv->post_audio = gtv_create_plugins (priv, &audio_port, NULL, - params, XINE_POST_TYPE_AUDIO_FILTER); + gtv_dispose_plugins (priv, priv->post_audio.list); + priv->post_audio.list = + gtv_create_plugins (priv, &audio_port, NULL, params, + XINE_POST_TYPE_AUDIO_FILTER); gtv_wire_plugins_audio (priv, audio_port); } @@ -1527,14 +1532,14 @@ priv = gtv->priv; g_return_if_fail (priv->stream != NULL); - priv->post_audio_enable = on; + priv->post_audio.enable = on; gtv_unwire_plugins_audio (priv, audio_port); gtv_wire_plugins_audio (priv, audio_port); } gboolean gtk_video_get_use_post_plugins_audio (GtkVideo *gtv) { - return (gtv && gtv->priv) ? gtv->priv->post_audio_enable : FALSE; + return (gtv && gtv->priv) ? gtv->priv->post_audio.enable : FALSE; } @@ -1601,29 +1606,29 @@ /* Plugins: deinterlace post-plugin */ -void gtk_video_set_tvtime (GtkVideo *gtv, const char *params) +void gtk_video_set_post_plugins_deinterlace (GtkVideo *gtv, const char *params) { gtk_video_private_t *priv; - char *d, *v; g_return_if_fail (gtv != NULL); g_return_if_fail (GTK_IS_VIDEO (gtv)); priv = gtv->priv; g_return_if_fail (priv->stream != NULL); - if (!priv->tvtime_plugin || strncmp (params, "tvtime:", 7)) - return; + gtv_unwire_plugins_video (priv); + gtv_dispose_plugins (priv, priv->post_deinterlace.list); + priv->post_deinterlace.list = + gtv_create_plugins (priv, NULL, &priv->video_port, params, + XINE_POST_TYPE_VIDEO_FILTER); + gtv_wire_plugins_video (priv); - d = strchr (params, ':'); - v = strdup (v ? d + 1 : params); - d = strchr (v, ';'); - if (d) - *d = 0; - post_parse_set_parameters (priv->tvtime_plugin, v); - free (v); + /* allow the old method if there are no created deinterlace plugins */ + xine_set_param (priv->stream, XINE_PARAM_VO_DEINTERLACE, + priv->post_deinterlace.enable && + !priv->post_deinterlace.list); } -void gtk_video_set_deinterlace (GtkVideo *gtv, gboolean set) +void gtk_video_set_use_post_plugins_deinterlace (GtkVideo *gtv, gboolean on) { gtk_video_private_t *priv; @@ -1632,26 +1637,23 @@ priv = gtv->priv; g_return_if_fail (priv->stream != NULL); - priv->deinterlace = set; - if (priv->tvtime_plugin) - { - gtv_unwire_plugins_video (priv); - gtv_wire_plugins_video (priv); - } - else - xine_set_param (priv->stream, XINE_PARAM_VO_DEINTERLACE, set); -} + gtv_unwire_plugins_video (priv); + priv->post_deinterlace.enable = on; + gtv_wire_plugins_video (priv); -gboolean gtk_video_get_deinterlace (GtkVideo *gtv) -{ - return (gtv && gtv->priv) ? gtv->priv->deinterlace : FALSE; + /* allow the old method if there are no created deinterlace plugins */ + xine_set_param (priv->stream, XINE_PARAM_VO_DEINTERLACE, + on && !priv->post_deinterlace.list); } -xine_post_t *gtk_video_get_deinterlacer (GtkVideo *gtv) +gboolean gtk_video_get_use_post_plugins_deinterlace (GtkVideo *gtv) { - return (gtv && gtv->priv) ? gtv->priv->tvtime_plugin : NULL; + return (gtv && gtv->priv) ? gtv->priv->post_deinterlace.enable : FALSE; } + +/* Other bits (due for replacement) */ + void gtk_video_set_auto_rescale (GtkVideo *gtv, gboolean set) { gtk_video_private_t *priv; Index: gtkvideo.h =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/gtkvideo.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- gtkvideo.h 13 Jan 2005 19:52:23 -0000 1.10 +++ gtkvideo.h 9 Mar 2005 20:03:09 -0000 1.11 @@ -88,20 +88,18 @@ xine_audio_port_t **); gboolean gtk_video_set_vis (GtkVideo *, xine_audio_port_t **, gboolean); + void gtk_video_set_post_plugins_deinterlace (GtkVideo *, const char *); void gtk_video_set_post_plugins_video (GtkVideo *, const char *); void gtk_video_set_post_plugins_audio (GtkVideo *, const char *, xine_audio_port_t *); + void gtk_video_set_use_post_plugins_deinterlace (GtkVideo *, gboolean); void gtk_video_set_use_post_plugins_video (GtkVideo *, gboolean); void gtk_video_set_use_post_plugins_audio (GtkVideo *, gboolean, xine_audio_port_t *); + gboolean gtk_video_get_use_post_plugins_deinterlace (GtkVideo *); gboolean gtk_video_get_use_post_plugins_video (GtkVideo *); gboolean gtk_video_get_use_post_plugins_audio (GtkVideo *); - void gtk_video_set_tvtime (GtkVideo *, const char *); - void gtk_video_set_deinterlace (GtkVideo *, gboolean); - gboolean gtk_video_get_deinterlace (GtkVideo *); - xine_post_t *gtk_video_get_deinterlacer (GtkVideo *); - void gtk_video_set_auto_rescale (GtkVideo *, gboolean); gboolean gtk_video_get_auto_rescale (GtkVideo *); Index: main.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/main.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -r1.116 -r1.117 --- main.c 17 Jan 2005 18:49:18 -0000 1.116 +++ main.c 9 Mar 2005 20:03:09 -0000 1.117 @@ -189,11 +189,7 @@ GtkVideo *v = GTK_VIDEO(gtv); if (xine_config_lookup_entry (xine, "gui.post_plugins.deinterlace", &entry)) - gtk_video_set_tvtime (v, entry.str_value); - - if (xine_config_lookup_entry (xine, "gui.post_plugins.deinterlace_enable", - &entry)) - gtk_video_set_deinterlace (v, entry.num_value); + gtk_video_set_post_plugins_deinterlace (v, entry.str_value); if (xine_config_lookup_entry (xine, "gui.post_plugins.video", &entry)) gtk_video_set_post_plugins_video (v, entry.str_value); @@ -201,6 +197,10 @@ if (xine_config_lookup_entry (xine, "gui.post_plugins.audio", &entry)) gtk_video_set_post_plugins_audio (v, entry.str_value, audio_port); + if (xine_config_lookup_entry (xine, "gui.post_plugins.deinterlace_enable", + &entry)) + gtk_video_set_use_post_plugins_deinterlace (v, entry.num_value); + if (xine_config_lookup_entry (xine, "gui.post_plugins.video_enable", &entry)) gtk_video_set_use_post_plugins_video (v, entry.num_value); Index: post.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/post.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- post.c 8 Mar 2005 18:20:24 -0000 1.20 +++ post.c 9 Mar 2005 20:03:09 -0000 1.21 @@ -35,6 +35,7 @@ #include "utils.h" typedef enum { + POST_CHAIN_DEINTERLACE, POST_CHAIN_VIDEO, POST_CHAIN_AUDIO, POST_CHAIN_LAST, @@ -59,9 +60,12 @@ }; typedef struct gxine_post_s gxine_post_t; -static gxine_chain_t chains[] = { { POST_CHAIN_VIDEO }, { POST_CHAIN_AUDIO } }; +static gxine_chain_t chains[] = { + { POST_CHAIN_DEINTERLACE }, { POST_CHAIN_VIDEO }, { POST_CHAIN_AUDIO } +}; static const char *cfgname[] = { + "gui.post_plugins.deinterlace", "gui.post_plugins.video", "gui.post_plugins.audio" }; @@ -69,6 +73,7 @@ static const void *const empty[] = { NULL }; static const char *const chain_title[] = { + N_("Configure deinterlace post-plugins"), N_("Configure video post-plugins"), N_("Configure audio post-plugins") }; @@ -663,6 +668,7 @@ logprintf ("post_config: creating plugin '%s'\n", name); switch (chain_type) { + case POST_CHAIN_DEINTERLACE: case POST_CHAIN_VIDEO: { xine_video_port_t *port = gtk_video_get_port ((GtkVideo *)gtv); @@ -943,6 +949,7 @@ { static const int post_type[] = { XINE_POST_TYPE_VIDEO_FILTER, + XINE_POST_TYPE_VIDEO_FILTER, XINE_POST_TYPE_AUDIO_FILTER }; GtkWidget *hbox, *w; @@ -998,47 +1005,12 @@ return JS_TRUE; } -static void -deinterlace_reconfigure (gxine_post_t *info) -{ - xine_cfg_entry_t entry; - char *cfg, *params = post_make_parameter_string (info); - logprintf ("post_config: deinterlace configuration\n was: %s\n now: %s\n", - info->parameters, params); - free (info->parameters); - asprintf (&cfg, "tvtime:%s", info->parameters = params); - gtk_video_set_tvtime (GTK_VIDEO(gtv), cfg); - if (xine_config_lookup_entry (xine, "gui.post_plugins.deinterlace", &entry)) - { - entry.str_value = cfg; - xine_config_update_entry (xine, &entry); - } - free (cfg); -} - static JSBool js_deinterlace_show (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - xine_cfg_entry_t entry; - static gxine_post_t info = { - NULL, "tvtime", .reconfigure = deinterlace_reconfigure - }; - se_log_fncall ("deinterlace_show"); - if (info.dbox) - return JS_FALSE; - - if (!xine_config_lookup_entry (xine, "gui.post_plugins.deinterlace", &entry)) - return JS_FALSE; - - info.name = _("deinterlace (tvtime)"); - info.plugin = gtk_video_get_deinterlacer (GTK_VIDEO(gtv)); - free (info.parameters); - info.parameters = strdup (entry.str_value + - (strncmp (entry.str_value, "tvtime:", 7) ? 0 : 7)); - - return post_config_post_window (NULL, &info); + return post_config_post_chain_window (&chains[POST_CHAIN_DEINTERLACE]); } static JSBool Index: player.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/player.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- player.c 28 Jan 2005 02:16:27 -0000 1.29 +++ player.c 9 Mar 2005 20:03:09 -0000 1.30 @@ -30,7 +30,7 @@ #include <gtk/gtkradiomenuitem.h> #include "globals.h" -#include "utils.h" +#include "ui.h" #include "playlist.h" #include "gtkvideo.h" #include "snapshot.h" @@ -477,10 +477,10 @@ se_arg_is_int (0, "set_deinterlace"); JS_ValueToInt32 (cx, argv[0], &di); } else { - di = !gtk_video_get_deinterlace (GTK_VIDEO(gtv)); + di = !gtk_video_get_use_post_plugins_deinterlace (GTK_VIDEO(gtv)); } - gtk_video_set_deinterlace (GTK_VIDEO(gtv), di); + gtk_video_set_use_post_plugins_deinterlace (GTK_VIDEO(gtv), di); /* Hmm, should be a don't-emit-signal method for this... */ deinterlace_menu_item[0]->active = di; |