From 2d20073eb32513fdf16aa845515e0dd25116853c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Apr 2001 14:21:08 +0000 Subject: [PATCH] A rather large update: Original commit message from CVS: A rather large update: - a new videosink using plain X windows (xvideosink). It uses capsnego to set up it's formats. - gstplay uses the new xvideosink and a gtk_socket. The initial window size is set to 0x0 so you need to resize it before you see something. - got rid of the video metadata include file in favour of properties and caps negotiation - adjusted most plugins to not use the metadata. --- gst/gstcaps.c | 5 +-- gst/gstprops.c | 33 +++++++++++++++-- gst/meta/Makefile.am | 2 +- gst/meta/videoraw.h | 80 ----------------------------------------- gstplay/gstplay.c | 29 +++++++++------ libs/videoscale/gstvideoscale.c | 2 -- test/Makefile.am | 2 +- test/mpeg2parse2.c | 18 +++++++--- test/videotest2.c | 1 + 9 files changed, 68 insertions(+), 104 deletions(-) delete mode 100644 gst/meta/videoraw.h diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 174da61..31e7b5e 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -507,8 +507,9 @@ static gboolean gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps) { if (fromcaps->id != tocaps->id) { - GST_DEBUG (0,"gstcaps: mime types differ (%d to %d)\n", - fromcaps->id, tocaps->id); + GST_DEBUG (0,"gstcaps: mime types differ (%s to %s)\n", + gst_type_find_by_id (fromcaps->id)->mime, + gst_type_find_by_id (tocaps->id)->mime); return FALSE; } diff --git a/gst/gstprops.c b/gst/gstprops.c index 162f4a3..d708010 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -58,6 +58,31 @@ _gst_props_initialize (void) _gst_props_chunk_lock = g_mutex_new (); } +static void +gst_props_debug_entry (GstPropsEntry *entry) +{ + switch (entry->propstype) { + case GST_PROPS_INT_ID: + GST_DEBUG (0, "%d\n", entry->data.int_data); + break; + case GST_PROPS_FOURCC_ID_NUM: + GST_DEBUG (0, "%s\n", (gchar*)&entry->data.fourcc_data); + break; + case GST_PROPS_BOOL_ID_NUM: + GST_DEBUG (0, "%d\n", entry->data.bool_data); + break; + case GST_PROPS_STRING_ID_NUM: + GST_DEBUG (0, "%s\n", entry->data.string_data.string); + break; + case GST_PROPS_INT_RANGE_ID_NUM: + GST_DEBUG (0, "%d-%d\n", entry->data.int_range_data.min, + entry->data.int_range_data.max); + break; + default: + break; + } +} + static GstPropsEntry* gst_props_create_entry (GstPropsFactory factory, gint *skipped) { @@ -813,9 +838,11 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops) if (!gst_props_entry_check_compatibility (entry1, entry2)) { compatible = FALSE; - GST_DEBUG (0, "%s and %s are not compatible\n", - g_quark_to_string (entry1->propid), - g_quark_to_string (entry2->propid)); + GST_DEBUG (0, "%s are not compatible\n:", + g_quark_to_string (entry1->propid)); + gst_props_debug_entry (entry1); + gst_props_debug_entry (entry2); + GST_DEBUG (0, "\n"); } sourcelist = g_list_next (sourcelist); diff --git a/gst/meta/Makefile.am b/gst/meta/Makefile.am index 1ddd911..fe7553e 100644 --- a/gst/meta/Makefile.am +++ b/gst/meta/Makefile.am @@ -1,3 +1,3 @@ metaincludedir = $(includedir)/gst/meta metainclude_HEADERS = \ - videoraw.h + videoraw.h.old diff --git a/gst/meta/videoraw.h b/gst/meta/videoraw.h deleted file mode 100644 index 8452eaa..0000000 --- a/gst/meta/videoraw.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Gnome-Streamer - * Copyright (C) <1999> Erik Walthinsen - * - * 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. - */ - - -#ifndef __GST_META_VIDEORAW_H__ -#define __GST_META_VIDEORAW_H__ - -#include -#include -#include -#include - -typedef struct _MetaVideoRaw MetaVideoRaw; -typedef struct _MetaDGA MetaDGA; -typedef struct _MetaOverlay MetaOverlay; -typedef struct _OverlayClip OverlayClip; - -struct _OverlayClip { - int x1, x2, y1, y2; -}; - -struct _MetaDGA { - /* the base address of the screen */ - void *base; - /* the dimensions of the screen */ - int swidth, sheight; - /* the number of bytes in a line */ - int bytes_per_line; -}; - -struct _MetaOverlay { - /* the position of the window */ - int wx, wy; - /* a reference to the object sending overlay change events */ - 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; -}; - -struct _MetaVideoRaw { - GstMeta meta; - - /* formatting information */ - GstColorSpaceType format; - GdkVisual *visual; - /* dimensions of the video buffer */ - gint width; - gint height; - /* a pointer to the overlay info if the sink supports this */ - MetaOverlay *overlay_info; - /* a pointer to the DGA info if the sink supports this */ - MetaDGA *dga_info; -}; - -#endif /* __GST_META_VIDEORAW_H__ */ - diff --git a/gstplay/gstplay.c b/gstplay/gstplay.c index aa56b79..037d10c 100644 --- a/gstplay/gstplay.c +++ b/gstplay/gstplay.c @@ -130,9 +130,9 @@ gst_play_init (GstPlay *play) gtk_signal_connect (GTK_OBJECT (priv->audio_element), "handoff", GTK_SIGNAL_FUNC (gst_play_audio_handoff), play); - priv->video_element = gst_elementfactory_make ("videosink", "show"); + priv->video_element = gst_elementfactory_make ("xvideosink", "show"); g_return_if_fail (priv->video_element != NULL); - gtk_object_set (GTK_OBJECT (priv->video_element), "xv_enabled", FALSE, NULL); + //gtk_object_set (GTK_OBJECT (priv->video_element), "xv_enabled", FALSE, NULL); gtk_signal_connect (GTK_OBJECT (priv->video_element), "frame_displayed", GTK_SIGNAL_FUNC (gst_play_frame_displayed), play); @@ -167,11 +167,18 @@ gst_play_frame_displayed (GstElement *element, GstPlay *play) { GstPlayPrivate *priv; + static int stolen = FALSE; priv = (GstPlayPrivate *)play->priv; gdk_threads_enter (); - gtk_widget_show (GTK_WIDGET (priv->video_widget)); + if (!stolen) { + gtk_widget_realize (priv->video_widget); + gtk_socket_steal (GTK_SOCKET (priv->video_widget), + gst_util_get_int_arg (GTK_OBJECT(priv->video_element), "xid")); + gtk_widget_show (priv->video_widget); + stolen = TRUE; + } gdk_threads_leave (); gtk_signal_emit (GTK_OBJECT (play), gst_play_signals[SIGNAL_FRAME_DISPLAYED], @@ -394,18 +401,20 @@ gst_play_realize (GtkWidget *widget) play = GST_PLAY (widget); priv = (GstPlayPrivate *)play->priv; - priv->video_widget = gst_util_get_widget_arg (GTK_OBJECT (priv->video_element), "widget"); + priv->video_widget = gtk_socket_new (); - if (priv->video_widget) { - gtk_container_add (GTK_CONTAINER (widget), priv->video_widget); - } - else { - g_print ("oops, no video widget found\n"); - } + gtk_container_add (GTK_CONTAINER (widget), priv->video_widget); if (GTK_WIDGET_CLASS (parent_class)->realize) { GTK_WIDGET_CLASS (parent_class)->realize (widget); } + + //gtk_socket_steal (GTK_SOCKET (priv->video_widget), + // gst_util_get_int_arg (GTK_OBJECT(priv->video_element), "xid")); + + //gtk_widget_realize (priv->video_widget); + //gtk_socket_steal (GTK_SOCKET (priv->video_widget), + // gst_util_get_int_arg (GTK_OBJECT(priv->video_element), "xid")); } void diff --git a/libs/videoscale/gstvideoscale.c b/libs/videoscale/gstvideoscale.c index 9565198..43cb991 100644 --- a/libs/videoscale/gstvideoscale.c +++ b/libs/videoscale/gstvideoscale.c @@ -26,8 +26,6 @@ #ifdef HAVE_CPU_I386 #include "gstscale_x86.h" #endif -//FIXME -#include static void gst_videoscale_scale_yuv (GstVideoScale *scale, unsigned char *src, unsigned char *dest); static void gst_videoscale_scale_rgb (GstVideoScale *scale, unsigned char *src, unsigned char *dest); diff --git a/test/Makefile.am b/test/Makefile.am index a1b93dc..5a56d5e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -19,7 +19,7 @@ else xvlibs= endif -LDADD = $(top_builddir)/plugins/videosink/gdkxvimage.lo ${xvlibs} -lXxf86vm +LDADD = ${xvlibs} -lXxf86vm #LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la \ # $(top_builddir)/plugins/videosink/libvideosink.la -L/usr/X11/lib -lXxf86dga diff --git a/test/mpeg2parse2.c b/test/mpeg2parse2.c index 770c801..99120ee 100644 --- a/test/mpeg2parse2.c +++ b/test/mpeg2parse2.c @@ -30,11 +30,10 @@ int main(int argc,char *argv[]) { GstPipeline *pipeline; GstElement *src, *parse; GstElement *decode, *show, *thread; + GtkWidget *gtk_socket; g_print("have %d args\n",argc); - g_thread_init(NULL); - gtk_init(&argc,&argv); gst_init(&argc,&argv); gnome_init("MPEG2 Video player","0.0.1",argc,argv); //gst_plugin_load("mpeg1parse"); @@ -76,14 +75,21 @@ int main(int argc,char *argv[]) { decode = gst_elementfactory_make("mpeg2dec","decode_video"); g_return_val_if_fail(decode != NULL, -1); - show = gst_elementfactory_make("videosink","show"); + show = gst_elementfactory_make("xvideosink","show"); //gtk_object_set(GTK_OBJECT(show),"xv_enabled",FALSE,NULL); g_return_val_if_fail(show != NULL, -1); appwindow = gnome_app_new("MPEG player","MPEG player"); + + gtk_socket = gtk_socket_new (); + gtk_widget_show (gtk_socket); + gnome_app_set_contents(GNOME_APP(appwindow), - gst_util_get_widget_arg(GTK_OBJECT(show),"widget")); - gtk_widget_show_all(appwindow); + GTK_WIDGET(gtk_socket)); + + gtk_widget_realize (gtk_socket); + gtk_socket_steal (GTK_SOCKET (gtk_socket), + gst_util_get_int_arg (GTK_OBJECT(show), "xid")); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse)); @@ -109,6 +115,8 @@ int main(int argc,char *argv[]) { gst_pad_connect(gst_element_get_pad(decode,"src"), gst_element_get_pad(show,"sink")); + gtk_widget_show_all(appwindow); + g_print("setting to PLAYING state\n"); gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING); diff --git a/test/videotest2.c b/test/videotest2.c index 97315fe..c830cc8 100644 --- a/test/videotest2.c +++ b/test/videotest2.c @@ -32,6 +32,7 @@ main (int argc,char *argv[]) src = gst_elementfactory_make ("v4lsrc", "src"); gtk_object_set(GTK_OBJECT(src),"format",9,NULL); gtk_object_set(GTK_OBJECT(src),"width",320,"height",240,NULL); + //gtk_object_set(GTK_OBJECT(src),"width",100,"height",100,NULL); videosink = gst_elementfactory_make ("xvideosink", "videosink"); gtk_object_set(GTK_OBJECT(videosink),"width",320,"height",240,NULL); -- 2.7.4