mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-28 23:02:22 +00:00
whack a mole
Original commit message from CVS: whack a mole
This commit is contained in:
parent
252a8a064d
commit
460e7cbefa
10 changed files with 0 additions and 994 deletions
8
components/bonobo-gstmediaplay/.gitignore
vendored
8
components/bonobo-gstmediaplay/.gitignore
vendored
|
@ -1,8 +0,0 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.deps
|
||||
.libs
|
||||
bonobo-gstmediaplay
|
|
@ -1,35 +0,0 @@
|
|||
# FIXME FIXME
|
||||
|
||||
Gamesdir = $(datadir)/gnome/apps/Games
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/gst \
|
||||
-I$(top_srcdir)/gstplay \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DDATADIR=\""$(datadir)"\" \
|
||||
-I$(includedir) \
|
||||
$(shell gnome-config --cflags gnome gnomeui bonobo bonobox) \
|
||||
$(BONOBOX_TEST_CFLAGS) -Wall -O2
|
||||
|
||||
bin_PROGRAMS = bonobo-gstmediaplay
|
||||
|
||||
bonobo_gstmediaplay_SOURCES = \
|
||||
bonobo-gstmediaplay.c
|
||||
|
||||
bonobo_gstmediaplay_CFLAGS = -Wall -O2 \
|
||||
$(shell gnome-config --cflags gnome gnomeui bonobo bonobox) $(shell libglade-config --cflags gnome) \
|
||||
$(shell gstreamer-config --clfags )
|
||||
|
||||
bonobo_gstmediaplay_LDADD = \
|
||||
$(top_srcdir)/gstplay/libgstmediaplay.la \
|
||||
$(top_srcdir)/gst/libgstreamer.la
|
||||
|
||||
bonobo_gstmediaplay_LDFLAGS = \
|
||||
$(shell gnome-config --libs gnome gnomeui bonobo bonobox) $(shell libglade-config --libs gnome) \
|
||||
$(shell gstreamer-config --libs )
|
||||
|
||||
oafdir = $(datadir)/oaf
|
||||
OAF_FILES = gstmediaplay.oafinfo
|
||||
oaf_DATA = $(OAF_FILES)
|
||||
|
||||
EXTRA_DIST = gstmediaplay.desktop $(OAF_FILES) \
|
||||
bonobo-gstmediaplay-ui.xml
|
|
@ -1,19 +0,0 @@
|
|||
<Root>
|
||||
<commands>
|
||||
<cmd name="NewGame" _label="New game" _tip="Start a new game"/>
|
||||
|
||||
<cmd name="OpenGame" _label="Open game" _tip="Load a saved game"/>
|
||||
</commands>
|
||||
|
||||
<menu>
|
||||
<submenu name="Game" _label="_Game">
|
||||
<menuitem name="NewGame" verb=""/>
|
||||
<menuitem name="OpenGame" verb=""/>
|
||||
</submenu>
|
||||
</menu>
|
||||
|
||||
<dockitem name="Game">
|
||||
<toolitem name="NewGame" verb=""/>
|
||||
</dockitem>
|
||||
|
||||
</Root>;
|
|
@ -1,427 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <gnome.h>
|
||||
#include <liboaf/liboaf.h>
|
||||
|
||||
#include <bonobo.h>
|
||||
|
||||
#include "gstplay.h"
|
||||
|
||||
#include "pause.xpm"
|
||||
#include "play.xpm"
|
||||
#include "stop.xpm"
|
||||
|
||||
/*
|
||||
* Number of running objects
|
||||
*/
|
||||
static int running_objects = 0;
|
||||
static BonoboGenericFactory *factory = NULL;
|
||||
|
||||
/*
|
||||
* BonoboControl data
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
BonoboControl *bonobo_object;
|
||||
BonoboUIComponent *uic;
|
||||
|
||||
GstPlay *play;
|
||||
}
|
||||
control_data_t;
|
||||
|
||||
/*
|
||||
* This callback is invoked when the BonoboControl object
|
||||
* encounters a fatal CORBA exception.
|
||||
*/
|
||||
static void
|
||||
control_system_exception_cb (BonoboControl * control, CORBA_Object corba_object,
|
||||
CORBA_Environment * ev, gpointer data)
|
||||
{
|
||||
bonobo_object_unref (BONOBO_OBJECT (control));
|
||||
}
|
||||
|
||||
static void
|
||||
control_update (control_data_t * control_data)
|
||||
{
|
||||
gtk_widget_queue_draw (GTK_WIDGET (control_data->play));
|
||||
}
|
||||
|
||||
static void
|
||||
verb_Play_cb (BonoboUIComponent * uic, gpointer user_data, const char *cname)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) user_data;
|
||||
|
||||
gst_play_play (control_data->play);
|
||||
control_update (control_data);
|
||||
}
|
||||
|
||||
static void
|
||||
verb_Pause_cb (BonoboUIComponent * uic, gpointer user_data, const char *cname)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) user_data;
|
||||
|
||||
gst_play_pause (control_data->play);
|
||||
control_update (control_data);
|
||||
}
|
||||
|
||||
static void
|
||||
verb_Stop_cb (BonoboUIComponent * uic, gpointer user_data, const char *cname)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) user_data;
|
||||
|
||||
gst_play_stop (control_data->play);
|
||||
control_update (control_data);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
control_data_t *control_data;
|
||||
GtkFileSelection *selector;
|
||||
}
|
||||
file_select_struct;
|
||||
|
||||
static void
|
||||
filename_selected (GtkButton * ok, gpointer user_data)
|
||||
{
|
||||
file_select_struct *select = (file_select_struct *) user_data;
|
||||
|
||||
gchar *selected_filename;
|
||||
|
||||
selected_filename =
|
||||
gtk_file_selection_get_filename (GTK_FILE_SELECTION (select->selector));
|
||||
|
||||
gst_play_set_uri (select->control_data->play, selected_filename);
|
||||
|
||||
gst_play_play (select->control_data->play);
|
||||
control_update (select->control_data);
|
||||
|
||||
g_free (select);
|
||||
}
|
||||
|
||||
static void
|
||||
verb_Open_cb (BonoboUIComponent * uic, gpointer user_data, const char *cname)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) user_data;
|
||||
file_select_struct *data = g_new0 (file_select_struct, 1);
|
||||
GtkWidget *file_selector;
|
||||
|
||||
file_selector = gtk_file_selection_new ("Select a media file");
|
||||
|
||||
data->selector = GTK_FILE_SELECTION (file_selector);
|
||||
data->control_data = control_data;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->
|
||||
ok_button), "clicked", GTK_SIGNAL_FUNC (filename_selected), data);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->
|
||||
ok_button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
(gpointer) file_selector);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->
|
||||
cancel_button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
(gpointer) file_selector);
|
||||
|
||||
gtk_widget_show (file_selector);
|
||||
}
|
||||
|
||||
/*
|
||||
* When one of our controls is activated, we merge our menus
|
||||
* in with our container's menus.
|
||||
*/
|
||||
static void
|
||||
control_create_menus (control_data_t * control_data)
|
||||
{
|
||||
BonoboControl *control = control_data->bonobo_object;
|
||||
Bonobo_UIContainer remote_uic;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
static char ui[] =
|
||||
"<Root>"
|
||||
" <commands>"
|
||||
" <cmd name=\"Play\" _label=\"Play\" _tip=\"Play\"/>"
|
||||
" <cmd name=\"Pause\" _label=\"Pause\" _tip=\"Pause\"/>"
|
||||
" <cmd name=\"Stop\" _label=\"Stop\" _tip=\"Stop\"/>"
|
||||
" <cmd name=\"Open\" _label=\"Open Media\" _tip=\"Open a media stream\"/>"
|
||||
" </commands>"
|
||||
" <menu>"
|
||||
" <submenu name=\"Player\" _label=\"_Player\">"
|
||||
" <menuitem name=\"Open\" pixtype=\"stock\" pixname=\"Open\" verb=\"\"/>"
|
||||
" <separator/>"
|
||||
" <menuitem name=\"Play\" verb=\"\"/>"
|
||||
" <menuitem name=\"Pause\" verb=\"\"/>"
|
||||
" <menuitem name=\"Stop\" verb=\"\"/>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
" <dockitem name=\"GstMediaPlay\">"
|
||||
" <toolitem name=\"Play\" type=\"toggle\" verb=\"\"/>"
|
||||
" <toolitem name=\"Pause\" type=\"toggle\" verb=\"\"/>"
|
||||
" <toolitem name=\"Stop\" type=\"toggle\" verb=\"\"/>"
|
||||
" </dockitem>" "</Root>";
|
||||
|
||||
g_print ("create menu\n");
|
||||
/*
|
||||
* Get our container's UIContainer server.
|
||||
*/
|
||||
remote_uic = bonobo_control_get_remote_ui_container (control);
|
||||
|
||||
/*
|
||||
* We have to deal gracefully with containers
|
||||
* which don't have a UIContainer running.
|
||||
*/
|
||||
if (remote_uic == CORBA_OBJECT_NIL) {
|
||||
g_warning ("No UI container!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Give our BonoboUIComponent object a reference to the
|
||||
* container's UIContainer server.
|
||||
*/
|
||||
bonobo_ui_component_set_container (control_data->uic, remote_uic);
|
||||
|
||||
/*
|
||||
* Unref the UI container we have been passed.
|
||||
*/
|
||||
bonobo_object_release_unref (remote_uic, NULL);
|
||||
|
||||
/* Set up the UI from the XML string. */
|
||||
{
|
||||
BonoboUINode *node;
|
||||
|
||||
node = bonobo_ui_node_from_string (ui);
|
||||
bonobo_ui_util_translate_ui (node);
|
||||
bonobo_ui_util_fixup_help (control_data->uic, node,
|
||||
DATADIR, "gstmediaplay");
|
||||
|
||||
bonobo_ui_component_set_tree (control_data->uic, "/", node, NULL);
|
||||
|
||||
bonobo_ui_node_free (node);
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) play_back_xpm);
|
||||
bonobo_ui_util_set_pixbuf (control_data->uic, "/commands/Play", pixbuf);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) pause_xpm);
|
||||
bonobo_ui_util_set_pixbuf (control_data->uic, "/commands/Pause", pixbuf);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) stop_back_xpm);
|
||||
bonobo_ui_util_set_pixbuf (control_data->uic, "/commands/Stop", pixbuf);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
||||
g_print ("create menu done\n");
|
||||
}
|
||||
|
||||
static void
|
||||
control_remove_menus (control_data_t * control_data)
|
||||
{
|
||||
bonobo_ui_component_unset_container (control_data->uic);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up our supplementary BonoboControl data sturctures.
|
||||
*/
|
||||
static void
|
||||
control_destroy_cb (BonoboControl * control, gpointer data)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) data;
|
||||
|
||||
control_data->play = NULL;
|
||||
|
||||
g_free (control_data);
|
||||
|
||||
running_objects--;
|
||||
if (running_objects > 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* When the last object has gone, unref the factory & quit.
|
||||
*/
|
||||
bonobo_object_unref (BONOBO_OBJECT (factory));
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
control_activate_cb (BonoboControl * control, gboolean activate, gpointer data)
|
||||
{
|
||||
control_data_t *control_data = (control_data_t *) data;
|
||||
|
||||
g_message ("control_activate");
|
||||
/*
|
||||
* The ControlFrame has just asked the Control (that's us) to be
|
||||
* activated or deactivated. We must reply to the ControlFrame
|
||||
* and say whether or not we want our activation state to
|
||||
* change. We are an acquiescent BonoboControl, so we just agree
|
||||
* with whatever the ControlFrame told us. Most components
|
||||
* should behave this way.
|
||||
*/
|
||||
bonobo_control_activate_notify (control, activate);
|
||||
|
||||
/*
|
||||
* If we were just activated, we merge in our menu entries.
|
||||
* If we were just deactivated, we remove them.
|
||||
*/
|
||||
if (activate)
|
||||
control_create_menus (control_data);
|
||||
else
|
||||
control_remove_menus (control_data);
|
||||
}
|
||||
|
||||
static void
|
||||
control_set_frame_cb (BonoboControl * control, gpointer data)
|
||||
{
|
||||
control_create_menus ((control_data_t *) data);
|
||||
}
|
||||
|
||||
static BonoboObject *
|
||||
bonobo_gstmediaplay_factory (BonoboGenericFactory * this, void *data)
|
||||
{
|
||||
BonoboControl *bonobo_object;
|
||||
control_data_t *control_data;
|
||||
GtkWidget *vbox;
|
||||
|
||||
gst_init (NULL, NULL);
|
||||
/*
|
||||
* Create a data structure in which we can store
|
||||
* Control-object-specific data about this document.
|
||||
*/
|
||||
control_data = g_new0 (control_data_t, 1);
|
||||
if (control_data == NULL)
|
||||
return NULL;
|
||||
|
||||
control_data->play = gst_play_new ();
|
||||
|
||||
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (control_data->play),
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
gst_play_set_uri (control_data->play, "/opt/data/armageddon1.mpg");
|
||||
gst_play_play (control_data->play);
|
||||
|
||||
/*
|
||||
* Create the BonoboControl object.
|
||||
*/
|
||||
bonobo_object = bonobo_control_new (vbox);
|
||||
|
||||
if (bonobo_object == NULL) {
|
||||
gtk_widget_destroy (vbox);
|
||||
g_free (control_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
control_data->bonobo_object = bonobo_object;
|
||||
|
||||
control_data->uic = bonobo_control_get_ui_component (bonobo_object);
|
||||
|
||||
/*
|
||||
* When our container wants to activate this component, we will get
|
||||
* the "activate" signal.
|
||||
*/
|
||||
gtk_signal_connect (GTK_OBJECT (bonobo_object), "activate",
|
||||
GTK_SIGNAL_FUNC (control_activate_cb), control_data);
|
||||
gtk_signal_connect (GTK_OBJECT (bonobo_object), "set_frame",
|
||||
GTK_SIGNAL_FUNC (control_set_frame_cb), control_data);
|
||||
|
||||
/*
|
||||
* The "system_exception" signal is raised when the BonoboControl
|
||||
* encounters a fatal CORBA exception.
|
||||
*/
|
||||
gtk_signal_connect (GTK_OBJECT (bonobo_object), "system_exception",
|
||||
GTK_SIGNAL_FUNC (control_system_exception_cb), control_data);
|
||||
|
||||
/*
|
||||
* We'll need to be able to cleanup when this control gets
|
||||
* destroyed.
|
||||
*/
|
||||
gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy",
|
||||
GTK_SIGNAL_FUNC (control_destroy_cb), control_data);
|
||||
|
||||
bonobo_ui_component_add_verb (control_data->uic, "Play",
|
||||
verb_Play_cb, control_data);
|
||||
bonobo_ui_component_add_verb (control_data->uic, "Pause",
|
||||
verb_Pause_cb, control_data);
|
||||
bonobo_ui_component_add_verb (control_data->uic, "Stop",
|
||||
verb_Stop_cb, control_data);
|
||||
|
||||
bonobo_ui_component_add_verb (control_data->uic, "Open",
|
||||
verb_Open_cb, control_data);
|
||||
|
||||
/*
|
||||
* Count the new running object
|
||||
*/
|
||||
running_objects++;
|
||||
g_print ("running objects: %d\n", running_objects);
|
||||
|
||||
return BONOBO_OBJECT (bonobo_object);
|
||||
}
|
||||
|
||||
static void
|
||||
init_gstmediaplay_factory (void)
|
||||
{
|
||||
factory =
|
||||
bonobo_generic_factory_new
|
||||
("OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18",
|
||||
bonobo_gstmediaplay_factory, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
init_server_factory (int argc, char **argv)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_ORB orb;
|
||||
|
||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
gnome_init_with_popt_table ("bonobo-gstmediaplay", VERSION,
|
||||
argc, argv, oaf_popt_options, 0, NULL);
|
||||
orb = oaf_init (argc, argv);
|
||||
|
||||
if (bonobo_init (orb, NULL, NULL) == FALSE)
|
||||
g_error (_("Could not initialize Bonobo!"));
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
/* g_thread_init (NULL); */
|
||||
/*
|
||||
* Setup the factory.
|
||||
*/
|
||||
init_server_factory (argc, argv);
|
||||
init_gstmediaplay_factory ();
|
||||
|
||||
/*
|
||||
* Start processing.
|
||||
*/
|
||||
bonobo_main ();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<oaf_info>
|
||||
|
||||
<oaf_server iid="OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18" type="exe" location="bonobo-gstmediaplay">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:Bonobo/GenericFactory:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="name" type="string" value="GstMediaPlay control factory"/>
|
||||
<oaf_attribute name="description" type="string" value="bonobo GstMediaPlay object factory"/>
|
||||
</oaf_server>
|
||||
|
||||
<oaf_server iid="OAFIID:bonobo_gstmediaplay:b6735078-0a67-4db0-aba6-ce37ecb63ff2" type="factory" location="OAFIID:bonobo_gstmediaplay_factory:420f20ca-55d7-4a33-b327-0b246136db18">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:Bonobo/Control:1.0"/>
|
||||
<item value="IDL:Bonobo/Unknown:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="name" type="string" value="GstMediaPlay control"/>
|
||||
<oaf_attribute name="description" type="string" value="bonobo GstMediaPlay object"/>
|
||||
</oaf_server>
|
||||
|
||||
</oaf_info>
|
|
@ -1,44 +0,0 @@
|
|||
GOB_FILES = \
|
||||
bonobo-media-gstreamer.gob bonobo-media-gstreamervideo.gob
|
||||
|
||||
GOB_SOURCE = \
|
||||
bonobo-media-gstreamer.h bonobo-media-gstreamer-private.h bonobo-media-gstreamer.c \
|
||||
bonobo-media-gstreamervideo.h bonobo-media-gstreamervideo.c bonobo-media-gstreamervideo-private.h
|
||||
|
||||
OAF_FILES = bonobo-media-gstreamer.oafinfo
|
||||
|
||||
INCLUDES = \
|
||||
-I. \
|
||||
-I$(srcdir) -I$(top_srcdir) -I$(top_builddir) \
|
||||
-I$(top_srcdir)/bonobo-media \
|
||||
-I$(includedir) \
|
||||
-I$(GNOME_CFLAGS) $(GNOME_INCLUDEDIR) \
|
||||
-I$(EXTRA_BONOBO_CFLAGS) $(EXTRA_WARNING_CFLAGS) \
|
||||
$(GSTREAMER_CFLAGS)
|
||||
|
||||
if STREAM_PROVIDERS_GSTREAMER
|
||||
bin_PROGRAMS = bonobo-media-gstreamer
|
||||
endif
|
||||
|
||||
bonobo_media_gstreamer_SOURCES = \
|
||||
$(GOB_FILES) $(GOB_SOURCE) \
|
||||
bonobo-media-gstreamer-factory.c
|
||||
|
||||
bonobo_media_gstreamer_LDADD = \
|
||||
$(EXTRA_GNOME_LIBS) $(EXTRA_BONOBO_LIBS) \
|
||||
-lpthread \
|
||||
-lgstmediaplay -lgst\
|
||||
$(top_builddir)/bonobo-media/libbonobo-media.la
|
||||
|
||||
.c %.h %-private.h: $(srcdir)/%.gob
|
||||
@GOB@ $<
|
||||
|
||||
oafdir = $(datadir)/oaf
|
||||
oaf_DATA = $(OAF_FILES)
|
||||
|
||||
|
||||
|
||||
BUILT_SOURCES = $(GOB_SOURCE)
|
||||
CLEANFILES += $(BUILT_SOURCES)
|
||||
|
||||
EXTRA_DIST = $(OAF_FILES)
|
|
@ -1,74 +0,0 @@
|
|||
/* bonobo-media-gstreamer-factry: Factory for GStreamer player using the
|
||||
* Bonobo:Media interfaces
|
||||
*
|
||||
* Copyright (C) 2001 Ali Abdin <aliabdin@aucegypt.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gnome.h>
|
||||
#include <glib.h>
|
||||
#include <bonobo.h>
|
||||
#include <liboaf/liboaf.h>
|
||||
#include "bonobo-media-gstreamer.h"
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <config.h>
|
||||
|
||||
static BonoboObject *
|
||||
gstreamer_factory (BonoboGenericFactory * factory, gpointer user_data)
|
||||
{
|
||||
return BONOBO_OBJECT (bonobo_media_gstreamer_new ());
|
||||
}
|
||||
|
||||
static void
|
||||
init_bonobo (int argc, char **argv)
|
||||
{
|
||||
CORBA_ORB orb;
|
||||
|
||||
gnome_init_with_popt_table ("bonobo-media-gstreamer", VERSION,
|
||||
argc, argv, oaf_popt_options, 0, NULL);
|
||||
|
||||
orb = oaf_init (argc, argv);
|
||||
|
||||
if (bonobo_init (orb, NULL, NULL) == FALSE)
|
||||
g_error ("Could not initialize Bonobo");
|
||||
}
|
||||
|
||||
static void
|
||||
last_unref_cb (BonoboObject * bonobo_object, BonoboGenericFactory * factory)
|
||||
{
|
||||
bonobo_object_unref (BONOBO_OBJECT (factory));
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
BonoboGenericFactory *factory;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
init_bonobo (argc, argv);
|
||||
|
||||
factory = bonobo_generic_factory_new ("OAFIID:Bonobo_Media_GStreamer_Factory",
|
||||
gstreamer_factory, NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (bonobo_context_running_get ()), "last_unref",
|
||||
GTK_SIGNAL_FUNC (last_unref_cb), factory);
|
||||
|
||||
bonobo_main ();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,251 +0,0 @@
|
|||
/* vim: set syntax=c: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
*/
|
||||
%at{
|
||||
/* bonobo-media-gstreamer: GStreamer player using the Bonobo:Meida interfaces
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (c) 2001 Ali Abdin <aliabdin@aucegypt.edu> and
|
||||
* ÉRDI Gergõ <cactus@cactus.rulez.org>
|
||||
* Wim Taymans <wim.taymans@chello.be>
|
||||
*/
|
||||
%}
|
||||
|
||||
%header{
|
||||
#include <bonobo/bonobo-persist-file.h>
|
||||
#include "bonobo-media/bonobo-media-stream.h"
|
||||
%}
|
||||
|
||||
%privateheader{
|
||||
#include "bonobo-media-gstreamervideo.h"
|
||||
#include "bonobo-media/bonobo-media-video.h"
|
||||
#include <gstplay/gstplay.h>
|
||||
%}
|
||||
|
||||
%{
|
||||
#include <bonobo/bonobo-exception.h>
|
||||
|
||||
#include <bonobo-media/bonobo-media-stream-private.h>
|
||||
|
||||
%}
|
||||
|
||||
class Bonobo:Media:GStreamer from Bonobo:Media:Stream
|
||||
{
|
||||
private gint length;
|
||||
private gint current_pos;
|
||||
private GstPlay *play;
|
||||
//private GtkWidget *play;
|
||||
|
||||
private guint timeout_id
|
||||
destroy
|
||||
{
|
||||
if (VAR)
|
||||
gtk_timeout_remove (VAR);
|
||||
} = 0;
|
||||
|
||||
private gboolean update_position (self)
|
||||
{
|
||||
gint current_time = 0;
|
||||
|
||||
bonobo_media_stream_send_pos_notification (
|
||||
BONOBO_MEDIA_STREAM (self),
|
||||
current_time);
|
||||
|
||||
if (current_time == self->_priv->length)
|
||||
bonobo_media_stream_send_end_notification (
|
||||
BONOBO_MEDIA_STREAM (self));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
override (Bonobo:Media:Stream)
|
||||
gfloat get_pos_per_sec (BonoboMediaStream *media_stream,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
gfloat ratio = 0;
|
||||
|
||||
/* Since position is in decoded values (to
|
||||
avoid problems with variable bit-rate
|
||||
streams), ratio is effectively the same as
|
||||
the output sampling rate */
|
||||
|
||||
return ratio;
|
||||
}
|
||||
|
||||
override (Bonobo:Media:Stream)
|
||||
gint get_length (BonoboMediaStream *media_stream,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
return SELF (media_stream)->_priv->length;
|
||||
}
|
||||
|
||||
override (Bonobo:Media:Stream)
|
||||
void seek (BonoboMediaStream *media_stream,
|
||||
gint pos,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
gint seek_success = TRUE;
|
||||
BonoboMediaGStreamer *self = SELF (media_stream);
|
||||
|
||||
if (pos < 0 || pos > self->_priv->length) {
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_Bonobo_Media_Stream_InvalidPosition,
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!seek_success) {
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_Bonobo_Media_Stream_InvalidPosition,
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
update_position (self);
|
||||
}
|
||||
|
||||
private gboolean playing = FALSE;
|
||||
|
||||
private void audio_init (self)
|
||||
{
|
||||
}
|
||||
|
||||
private void* player_func (self)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private void audio_cleanup (self)
|
||||
{
|
||||
}
|
||||
|
||||
override (Bonobo:Media:Stream)
|
||||
void play (BonoboMediaStream *media_stream,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
BonoboMediaGStreamer *self = SELF (media_stream);
|
||||
|
||||
gst_play_play (self->_priv->play);
|
||||
|
||||
self->_priv->playing = TRUE;
|
||||
|
||||
if (!self->_priv->timeout_id)
|
||||
self->_priv->timeout_id =
|
||||
gtk_timeout_add (100, (GtkFunction)update_position, self);
|
||||
}
|
||||
|
||||
override (Bonobo:Media:Stream)
|
||||
void stop (BonoboMediaStream *media_stream,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
BonoboMediaGStreamer *self = SELF (media_stream);
|
||||
|
||||
self->_priv->playing = FALSE;
|
||||
|
||||
if (self->_priv->timeout_id)
|
||||
gtk_timeout_remove (self->_priv->timeout_id);
|
||||
|
||||
self->_priv->timeout_id = 0;
|
||||
}
|
||||
|
||||
private void volume_cb (GtkObject *obj, gfloat vol,
|
||||
Bonobo:Media:GStreamer *self (check null type))
|
||||
{
|
||||
g_print ("Volume changed to %f\n", vol);
|
||||
}
|
||||
|
||||
private void speaker_cb (GtkObject *obj,
|
||||
Bonobo:Media:GStreamer *self (check null type))
|
||||
{
|
||||
audio_cleanup (self);
|
||||
audio_init (self);
|
||||
}
|
||||
|
||||
private void read_file_info (self)
|
||||
{
|
||||
}
|
||||
|
||||
public gint PersistFile_load (BonoboPersistFile *pf,
|
||||
const CORBA_char *filename,
|
||||
CORBA_Environment *ev,
|
||||
Bonobo:Media:GStreamer *self (check null type))
|
||||
{
|
||||
load_file (self, filename);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public gint PersistFile_save (BonoboPersistFile *pf,
|
||||
const CORBA_char *filename,
|
||||
CORBA_Environment *ev,
|
||||
Bonobo:Media:GStreamer *self (check null type))
|
||||
{
|
||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||
ex_Bonobo_NotSupported, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void load_file (self, const gchar *filename)
|
||||
{
|
||||
gst_play_set_uri (self->_priv->play, filename);
|
||||
}
|
||||
|
||||
private void construct (self)
|
||||
{
|
||||
Bonobo_Media_Stream corba_stream;
|
||||
BonoboMediaVideo *gstreamer_video;
|
||||
BonoboPersistFile *pf;
|
||||
|
||||
corba_stream = bonobo_media_stream_corba_object_create (BONOBO_OBJECT (self));
|
||||
|
||||
self->_priv->play = gst_play_new ();
|
||||
//self->_priv->play = gtk_button_new ();
|
||||
|
||||
gstreamer_video = BONOBO_MEDIA_VIDEO (bonobo_media_gstreamervideo_new (self->_priv->play));
|
||||
|
||||
bonobo_object_add_interface (BONOBO_OBJECT (self), BONOBO_OBJECT (gstreamer_video));
|
||||
|
||||
pf = bonobo_persist_file_new
|
||||
((BonoboPersistFileIOFn) PersistFile_load,
|
||||
(BonoboPersistFileIOFn) PersistFile_save,
|
||||
self);
|
||||
bonobo_object_add_interface (BONOBO_OBJECT (self),
|
||||
BONOBO_OBJECT (pf));
|
||||
|
||||
bonobo_media_stream_construct (BONOBO_MEDIA_STREAM (self), corba_stream);
|
||||
}
|
||||
|
||||
public Bonobo:Media:GStreamer* new_from_file (const gchar *filename)
|
||||
{
|
||||
Self *self;
|
||||
|
||||
self = bonobo_media_gstreamer_new ();
|
||||
|
||||
construct (self);
|
||||
load_file (self, filename);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
public Bonobo:Media:GStreamer* new (void)
|
||||
{
|
||||
Self *self;
|
||||
|
||||
self = GET_NEW;
|
||||
|
||||
construct (self);
|
||||
|
||||
return self;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<oaf_info>
|
||||
<oaf_server iid="OAFIID:Bonobo_Media_GStreamer_Factory" type="exe" location="bonobo-media-gstreamer">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:Bonobo/GenericFactory:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="name" type="string" value="Bonobo Media Ogg GStreamer player factory"/>
|
||||
<oaf_attribute name="description" type="string" value="Bonobo Media Ogg GStreamer player factory"/>
|
||||
</oaf_server>
|
||||
|
||||
<oaf_server iid="OAFIID:Bonobo_Media_GStreamer" type="factory" location="OAFIID:Bonobo_Media_GStreamer_Factory">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:Bonobo/Unknown:1.0"/>
|
||||
<item value="IDL:Bonobo/Media/Stream:1.0"/>
|
||||
<item value="IDL:Bonobo/EventSource:1.0"/>
|
||||
<item value="IDL:Bonobo/Media/Audio:1.0"/>
|
||||
<item value="IDL:Bonobo/Media/Video:1.0"/>
|
||||
<item value="IDL:Bonobo/PersistFile:1.0"/>
|
||||
<item value="IDL:Bonobo/Persist:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="name" type="string" value="Bonobo Media Ogg GStreamer component"/>
|
||||
<oaf_attribute name="description" type="string" value="Bonobo Media component for playing back Ogg
|
||||
GStreamer files (uses libogg/libvorbis/libao as the backend)"/>
|
||||
<oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
|
||||
<oaf_attribute name="bonobo:supported_mime_types" type="stringv">
|
||||
<item value="video/mpeg"/>
|
||||
<item value="audio/x-mp3"/>
|
||||
</oaf_attribute>
|
||||
</oaf_server>
|
||||
|
||||
</oaf_info>
|
|
@ -1,86 +0,0 @@
|
|||
/* vim: set syntax=c: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
*/
|
||||
%at{
|
||||
/* bonobo-media-gstreamer: GStreamer player using the Bonobo:Meida interfaces
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (c) 2001 Ali Abdin <aliabdin@aucegypt.edu> and
|
||||
* ÉRDI Gergõ <cactus@cactus.rulez.org>
|
||||
* Wim Taymans <wim.taymans@chello.be>
|
||||
*/
|
||||
%}
|
||||
|
||||
%header{
|
||||
#include <bonobo-media/Bonobo-Media.h>
|
||||
#include <bonobo-media/bonobo-media-video.h>
|
||||
#include <gstplay/gstplay.h>
|
||||
%}
|
||||
|
||||
%privateheader{
|
||||
%}
|
||||
|
||||
%{
|
||||
#include <bonobo/bonobo-control.h>
|
||||
#include <bonobo/bonobo-exception.h>
|
||||
|
||||
#include <bonobo-media/bonobo-media-video-private.h>
|
||||
|
||||
%}
|
||||
|
||||
class Bonobo:Media:GStreamervideo from Bonobo:Media:Video
|
||||
{
|
||||
private GstPlay *play;
|
||||
//private GtkWidget *play;
|
||||
|
||||
override (Bonobo:Media:Video)
|
||||
Bonobo_Control get_video_control (BonoboMediaVideo *video,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
BonoboControl *control;
|
||||
Bonobo_Control bcontrol;
|
||||
Self *self = SELF (video);
|
||||
GtkWidget *button;
|
||||
|
||||
//button = gtk_button_new_with_label("test");
|
||||
//gtk_widget_show (button);
|
||||
|
||||
//control = bonobo_control_new (button);
|
||||
control = bonobo_control_new (GTK_WIDGET (self->_priv->play));
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (self->_priv->play));
|
||||
|
||||
bcontrol = bonobo_object_corba_objref (BONOBO_OBJECT (control));
|
||||
|
||||
return bcontrol;
|
||||
}
|
||||
|
||||
public Bonobo:Media:GStreamervideo* new (GstPlay *play)
|
||||
{
|
||||
Self *self;
|
||||
Bonobo_Media_Video corba_video;
|
||||
BonoboMediaVideo *video;
|
||||
|
||||
self = GET_NEW;
|
||||
|
||||
corba_video = bonobo_media_video_corba_object_create (BONOBO_OBJECT (self));
|
||||
|
||||
self->_priv->play = play;
|
||||
|
||||
video = bonobo_media_video_construct (BONOBO_MEDIA_VIDEO (self), corba_video);
|
||||
|
||||
return self;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue