gstreamer/gstplay/interface.c
Wim Taymans 9b0e11ec7e Added seeking to some of the plugins. some MMX speedups in the MPEG decoders.
Original commit message from CVS:
Added seeking to some of the plugins.
some MMX speedups in the MPEG decoders.
Better YUV to MMX conversion
implemented seeking to gstplay.
2000-07-05 10:21:08 +00:00

405 lines
14 KiB
C

/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gnome.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
GtkWidget *drawingarea1;
GtkObject *adjustment;
GtkWidget *button6;
GtkWidget *button7;
GtkWidget *button8;
extern guchar statusline[];
extern guchar *statustext;
static GnomeUIInfo file1_menu_uiinfo[] =
{
{
GNOME_APP_UI_ITEM, N_("_Open..."),
NULL,
on_open1_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM, N_("_Exit"),
NULL,
on_close1_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT,
0, 0, NULL
},
GNOMEUIINFO_END
};
static GnomeUIInfo view2_menu_uiinfo[] =
{
{
GNOME_APP_UI_ITEM, N_("_Media..."),
NULL,
on_media1_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP,
0, 0, NULL
},
GNOMEUIINFO_END
};
static GnomeUIInfo play1_menu_uiinfo[] =
{
{
GNOME_APP_UI_ITEM, N_("_Play"),
NULL,
on_play2_activate, NULL, NULL,
GNOME_APP_PIXMAP_FILENAME, "pixmaps/play.xpm",
0, 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("P_ause"),
NULL,
on_pause1_activate, NULL, NULL,
GNOME_APP_PIXMAP_FILENAME, "pixmaps/pause.xpm",
0, 0, NULL
},
{
GNOME_APP_UI_ITEM, N_("_Stop"),
NULL,
on_stop1_activate, NULL, NULL,
GNOME_APP_PIXMAP_FILENAME, "pixmaps/stop.xpm",
0, 0, NULL
},
GNOMEUIINFO_END
};
static GnomeUIInfo help1_menu_uiinfo[] =
{
{
GNOME_APP_UI_ITEM, N_("_About"),
NULL,
on_about1_activate, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
0, 0, NULL
},
GNOMEUIINFO_END
};
static GnomeUIInfo menubar1_uiinfo[] =
{
{
GNOME_APP_UI_SUBTREE, N_("_File"),
NULL,
file1_menu_uiinfo, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_SUBTREE, N_("_View"),
NULL,
view2_menu_uiinfo, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_SUBTREE, N_("_Play"),
NULL,
play1_menu_uiinfo, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_SUBTREE, N_("_Help"),
NULL,
help1_menu_uiinfo, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_END
};
GtkWidget*
create_window1 (GtkWidget *video_element)
{
GtkWidget *window1;
GtkWidget *vbox1;
GtkWidget *handlebox2;
GtkWidget *menubar1;
GtkWidget *vbox2;
GtkWidget *hscale1;
GtkWidget *handlebox1;
GtkWidget *toolbar1;
GtkWidget *tmp_toolbar_icon;
GtkWidget *vseparator1;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (window1), "window1", window1);
gtk_window_set_title (GTK_WINDOW (window1), _("GStreamer Media Player"));
gtk_window_set_policy(GTK_WINDOW(window1), TRUE, TRUE, FALSE);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox1);
gtk_object_set_data_full (GTK_OBJECT (window1), "vbox1", vbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox1);
gtk_container_add (GTK_CONTAINER (window1), vbox1);
handlebox2 = gtk_handle_box_new ();
gtk_widget_ref (handlebox2);
gtk_object_set_data_full (GTK_OBJECT (window1), "handlebox2", handlebox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (handlebox2);
gtk_box_pack_start (GTK_BOX (vbox1), handlebox2, FALSE, FALSE, 0);
menubar1 = gtk_menu_bar_new ();
gtk_widget_ref (menubar1);
gtk_object_set_data_full (GTK_OBJECT (window1), "menubar1", menubar1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (menubar1);
gtk_container_add (GTK_CONTAINER (handlebox2), menubar1);
gnome_app_fill_menu (GTK_MENU_SHELL (menubar1), menubar1_uiinfo,
NULL, FALSE, 0);
gtk_widget_ref (menubar1_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "file1",
menubar1_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (file1_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "open1",
file1_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (file1_menu_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "separator1",
file1_menu_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (file1_menu_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "close1",
file1_menu_uiinfo[2].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar1_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "view2",
menubar1_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (view2_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "media1",
view2_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar1_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "play1",
menubar1_uiinfo[2].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (play1_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "play2",
play1_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (play1_menu_uiinfo[1].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "pause1",
play1_menu_uiinfo[1].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (play1_menu_uiinfo[2].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "stop1",
play1_menu_uiinfo[2].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (menubar1_uiinfo[3].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "help1",
menubar1_uiinfo[3].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_ref (help1_menu_uiinfo[0].widget);
gtk_object_set_data_full (GTK_OBJECT (window1), "about1",
help1_menu_uiinfo[0].widget,
(GtkDestroyNotify) gtk_widget_unref);
gtk_box_pack_start (GTK_BOX (vbox1), video_element, TRUE, TRUE, 0);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox2);
gtk_object_set_data_full (GTK_OBJECT (window1), "vbox2", vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (0, 0.0, 110.0, 1, 10.0, 10.0);
hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
gtk_widget_ref (hscale1);
gtk_object_set_data_full (GTK_OBJECT (window1), "hscale1", hscale1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hscale1);
gtk_box_pack_start (GTK_BOX (vbox2), hscale1, TRUE, TRUE, 3);
gtk_scale_set_draw_value (GTK_SCALE (hscale1), FALSE);
gtk_scale_set_value_pos (GTK_SCALE (hscale1), GTK_POS_LEFT);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (on_hscale1_value_changed),
NULL);
handlebox1 = gtk_handle_box_new ();
gtk_widget_ref (handlebox1);
gtk_object_set_data_full (GTK_OBJECT (window1), "handlebox1", handlebox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (handlebox1);
gtk_box_pack_start (GTK_BOX (vbox2), handlebox1, TRUE, TRUE, 1);
gtk_handle_box_set_shadow_type (GTK_HANDLE_BOX (handlebox1), GTK_SHADOW_NONE);
gtk_handle_box_set_snap_edge (GTK_HANDLE_BOX (handlebox1), GTK_POS_BOTTOM);
toolbar1 = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
gtk_widget_ref (toolbar1);
gtk_object_set_data_full (GTK_OBJECT (window1), "toolbar1", toolbar1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (toolbar1);
gtk_container_add (GTK_CONTAINER (handlebox1), toolbar1);
gtk_container_set_border_width (GTK_CONTAINER (toolbar1), 3);
gtk_toolbar_set_space_size (GTK_TOOLBAR (toolbar1), 0);
gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar1), GTK_RELIEF_NONE);
tmp_toolbar_icon = create_pixmap (window1, "pixmaps/play.xpm", TRUE);
button6 = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
NULL,
_("button6"),
NULL, NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_ref (button6);
gtk_object_set_data_full (GTK_OBJECT (window1), "button6", button6,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button6);
gtk_signal_connect (GTK_OBJECT (button6), "toggled",
GTK_SIGNAL_FUNC (on_toggle_play_toggled), NULL);
tmp_toolbar_icon = create_pixmap (window1, "pixmaps/pause.xpm", TRUE);
button7 = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
NULL,
_("button7"),
NULL, NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_ref (button7);
gtk_object_set_data_full (GTK_OBJECT (window1), "button7", button7,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button7);
gtk_signal_connect (GTK_OBJECT (button7), "toggled",
GTK_SIGNAL_FUNC (on_toggle_pause_toggled), NULL);
tmp_toolbar_icon = create_pixmap (window1, "pixmaps/stop.xpm", TRUE);
button8 = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
NULL,
_("button8"),
NULL, NULL,
tmp_toolbar_icon, NULL, NULL);
gtk_widget_ref (button8);
gtk_object_set_data_full (GTK_OBJECT (window1), "button8", button8,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button8);
gtk_signal_connect (GTK_OBJECT (button8), "toggled",
GTK_SIGNAL_FUNC (on_toggle_stop_toggled), NULL);
vseparator1 = gtk_vseparator_new ();
gtk_widget_ref (vseparator1);
gtk_object_set_data_full (GTK_OBJECT (window1), "vseparator1", vseparator1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vseparator1);
gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar1), vseparator1, NULL, NULL);
gtk_widget_set_usize (vseparator1, 8, 21);
drawingarea1 = gtk_drawing_area_new ();
gtk_widget_ref (drawingarea1);
gtk_object_set_data_full (GTK_OBJECT (window1), "drawingarea1", drawingarea1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (drawingarea1);
gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, FALSE, TRUE, 1);
gtk_widget_set_usize (drawingarea1, -2, 21);
gtk_signal_connect (GTK_OBJECT (drawingarea1), "configure_event",
GTK_SIGNAL_FUNC (on_drawingarea1_configure_event),
NULL);
return window1;
}
void update_buttons(int active)
{
gtk_signal_handler_block_by_func(GTK_OBJECT(button6),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
NULL);
gtk_signal_handler_block_by_func(GTK_OBJECT(button7),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
NULL);
gtk_signal_handler_block_by_func(GTK_OBJECT(button8),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button6), FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button7), FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button8), FALSE);
if (active == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button6), TRUE);
}
else if (active == 1) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button7), TRUE);
}
else if (active == 2) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button8), TRUE);
}
gtk_signal_handler_unblock_by_func(GTK_OBJECT(button6),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
NULL);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(button7),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
NULL);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(button8),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
NULL);
}
void update_slider(gfloat value)
{
gtk_signal_handler_block_by_func(adjustment,
GTK_SIGNAL_FUNC (on_hscale1_value_changed),
NULL);
gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustment), value);
gtk_signal_handler_unblock_by_func(adjustment,
GTK_SIGNAL_FUNC (on_hscale1_value_changed),
NULL);
}
void update_status_area()
{
GtkWidget *widget = drawingarea1;
gdk_draw_rectangle(widget->window,
widget->style->black_gc,
TRUE, 0,
0,
widget->allocation.width,
widget->allocation.height);
gdk_draw_string(widget->window,widget->style->font,widget->style->white_gc, 8, 15, statustext);
gdk_draw_string(widget->window,widget->style->font,widget->style->white_gc, widget->allocation.width-100, 15, statusline);
}