mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
Various cleanups. Moved the overlay code to a specialized widget.
Original commit message from CVS: Various cleanups. Moved the overlay code to a specialized widget. One error I cannot seem to fix: switching desktops does not disable the overlay.
This commit is contained in:
parent
660c01217f
commit
c2b8daff3a
12 changed files with 44 additions and 30 deletions
|
@ -297,6 +297,8 @@ gst/xml/Makefile
|
|||
plugins/Makefile
|
||||
plugins/au/Makefile
|
||||
plugins/wav/Makefile
|
||||
plugins/riff/Makefile
|
||||
plugins/riff/avi/Makefile
|
||||
plugins/mp3decode/Makefile
|
||||
plugins/mp3decode/xa/Makefile
|
||||
plugins/mp3decode/xing/Makefile
|
||||
|
|
|
@ -31,7 +31,6 @@ extern gint _gst_trace_on;
|
|||
*/
|
||||
void gst_init(int *argc,char **argv[]) {
|
||||
GstTrace *gst_trace;
|
||||
GstElementFactory *factory;
|
||||
|
||||
gtk_init(argc,argv);
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ struct _GstBuffer {
|
|||
GstBuffer *parent;
|
||||
};
|
||||
|
||||
/* initialisation */
|
||||
void _gst_buffer_initialize();
|
||||
/* creating a new buffer from scratch */
|
||||
GstBuffer *gst_buffer_new();
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ GstElement *gst_elementfactory_create(GstElementFactory *factory,
|
|||
GstElement *element;
|
||||
GstElementClass *oclass;
|
||||
|
||||
g_return_if_fail(factory != NULL);
|
||||
g_return_if_fail(factory->type != 0);
|
||||
g_return_val_if_fail(factory != NULL, NULL);
|
||||
g_return_val_if_fail(factory->type != 0, NULL);
|
||||
|
||||
// create an instance of the element
|
||||
element = GST_ELEMENT(gtk_type_new(factory->type));
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
GstMeta *gst_meta_new_size(gint size) {
|
||||
GstMeta *meta;
|
||||
|
||||
meta = g_malloc(size);
|
||||
meta = g_malloc0(size);
|
||||
gst_meta_ref(meta);
|
||||
|
||||
return meta;
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef GstPlugin * (*GstPluginInitFunc) (GModule *module);
|
|||
GstPlugin *gst_plugin_new(gchar *name);
|
||||
void gst_plugin_set_longname(GstPlugin *plugin,gchar *longname);
|
||||
|
||||
void gst_plugin_init();
|
||||
void _gst_plugin_initialize();
|
||||
void gst_plugin_load_all();
|
||||
gboolean gst_plugin_load(gchar *name);
|
||||
gboolean gst_plugin_load_absolute(gchar *name);
|
||||
|
|
|
@ -94,7 +94,7 @@ gst_thread_class_init(GstThreadClass *klass) {
|
|||
GTK_ARG_READWRITE, ARG_CREATE_THREAD);
|
||||
|
||||
gstelement_class->change_state = gst_thread_change_state;
|
||||
// gstelement_class->save_thyself = gst_thread_save_thyself;
|
||||
gstelement_class->save_thyself = gst_thread_save_thyself;
|
||||
|
||||
gtkobject_class->set_arg = gst_thread_set_arg;
|
||||
gtkobject_class->get_arg = gst_thread_get_arg;
|
||||
|
|
|
@ -52,7 +52,7 @@ struct _GstTypeFactory {
|
|||
|
||||
|
||||
/* initialize the subsystem */
|
||||
void gst_type_initialize();
|
||||
void _gst_type_initialize();
|
||||
|
||||
/* create a new type, or find/merge an existing one */
|
||||
guint16 gst_type_register(GstTypeFactory *factory);
|
||||
|
|
|
@ -58,12 +58,15 @@ struct _MetaOverlay {
|
|||
// the position of the window
|
||||
int wx, wy;
|
||||
// a reference to the object sending overlay change events
|
||||
GstObject *overlay_element;
|
||||
GtkWidget *overlay_element;
|
||||
// the number of overlay regions
|
||||
int clip_count;
|
||||
// the overlay regions of the display window
|
||||
struct _OverlayClip overlay_clip[32];
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
gboolean did_overlay;
|
||||
gboolean fully_obscured;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/gst.h>
|
||||
#include <string.h>
|
||||
|
||||
gint mp3_typefind(GstBuffer *buf,gpointer *private);
|
||||
gint wav_typefind(GstBuffer *buf,gpointer *private);
|
||||
|
@ -30,7 +31,8 @@ GstTypeFactory _factories[] = {
|
|||
{ "audio/wav", ".wav", wav_typefind },
|
||||
{ "audio/ac3", ".ac3", NULL },
|
||||
{ "video/raw", ".raw", NULL },
|
||||
{ "video/mpeg video/mpeg1", ".mpg", NULL },
|
||||
{ "video/mpeg video/mpeg1 video/mpeg-system", ".mpg", NULL },
|
||||
{ "video/x-msvideo video/msvideo video/avi", ".avi", NULL },
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
|
@ -58,8 +60,8 @@ gboolean mp3_typefind(GstBuffer *buf,gpointer *private) {
|
|||
gboolean wav_typefind(GstBuffer *buf,gpointer *private) {
|
||||
gulong *data = (gulong *)GST_BUFFER_DATA(buf);
|
||||
|
||||
if (data[0] != "RIFF") return FALSE;
|
||||
if (data[2] != "WAVE") return FALSE;
|
||||
if (strncmp((char *)data[0], "RIFF", 4)) return FALSE;
|
||||
if (strncmp((char *)data[2], "WAVE", 4)) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest
|
||||
noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \
|
||||
mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest
|
||||
mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
|
||||
aviparse
|
||||
|
||||
SUBDIRS = xml cothreads bindings
|
||||
|
||||
|
@ -10,6 +11,8 @@ wave_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
|||
wave_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
||||
videotest_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
||||
videotest_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
||||
aviparse_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
||||
aviparse_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
||||
mp1parse_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
||||
mp1parse_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
||||
|
||||
|
|
|
@ -8,23 +8,15 @@ gboolean idle_func(gpointer data);
|
|||
GstElement *videosink;
|
||||
GstElement *src;
|
||||
|
||||
void eof(GstSrc *src) {
|
||||
g_print("have eos, quitting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void resize(GtkWidget *wid, GtkRequisition *req, gpointer sink) {
|
||||
g_print("have resize %d %d\n", req->width, req->height);
|
||||
gtk_object_set(GTK_OBJECT(videosink),"width",req->width,"height",req->height,NULL);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
GstElement *bin;
|
||||
GstElementFactory *srcfactory;
|
||||
GstElementFactory *videosinkfactory;
|
||||
|
||||
GtkWidget *appwindow;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *button;
|
||||
GtkWidget *draw;
|
||||
|
||||
|
||||
_gst_plugin_spew = TRUE;
|
||||
|
@ -51,16 +43,27 @@ int main(int argc,char *argv[]) {
|
|||
gst_pad_connect(gst_element_get_pad(src,"src"),
|
||||
gst_element_get_pad(videosink,"sink"));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(src),"eos",
|
||||
GTK_SIGNAL_FUNC(eof),NULL);
|
||||
|
||||
appwindow = gnome_app_new("Videotest","Videotest");
|
||||
gnome_app_set_contents(GNOME_APP(appwindow),
|
||||
gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"));
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox1);
|
||||
|
||||
button = gtk_button_new_with_label(_("test"));//_with_label (_("chup"));
|
||||
gtk_widget_show (button);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
|
||||
//gtk_widget_set_usize (button, 50, 50);
|
||||
//gtk_widget_set_usize (button, 0, 0);
|
||||
|
||||
draw = gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"),
|
||||
gtk_box_pack_start (GTK_BOX (vbox1),
|
||||
draw,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (draw);
|
||||
|
||||
gnome_app_set_contents(GNOME_APP(appwindow), vbox1);
|
||||
|
||||
gtk_object_set(GTK_OBJECT(appwindow),"allow_grow",TRUE,NULL);
|
||||
gtk_object_set(GTK_OBJECT(appwindow),"allow_shrink",TRUE,NULL);
|
||||
// gtk_signal_connect(GTK_OBJECT(appwindow),"size-request",
|
||||
// GTK_SIGNAL_FUNC(resize),videosink);
|
||||
|
||||
gtk_widget_show_all(appwindow);
|
||||
|
||||
|
|
Loading…
Reference in a new issue