A rather large update:
authorWim Taymans <wim.taymans@gmail.com>
Mon, 2 Apr 2001 14:21:08 +0000 (14:21 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 2 Apr 2001 14:21:08 +0000 (14:21 +0000)
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
gst/gstprops.c
gst/meta/Makefile.am
gst/meta/videoraw.h [deleted file]
gstplay/gstplay.c
libs/videoscale/gstvideoscale.c
test/Makefile.am
test/mpeg2parse2.c
test/videotest2.c

index 174da61..31e7b5e 100644 (file)
@@ -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;
   }
 
index 162f4a3..d708010 100644 (file)
@@ -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);
index 1ddd911..fe7553e 100644 (file)
@@ -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 (file)
index 8452eaa..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Gnome-Streamer
- * 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.
- */
-
-
-#ifndef __GST_META_VIDEORAW_H__
-#define __GST_META_VIDEORAW_H__
-
-#include <gst/gst.h>
-#include <gdk/gdk.h>
-#include <gst/gstmeta.h>
-#include <libs/colorspace/gstcolorspace.h>
-
-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__ */
-
index aa56b79..037d10c 100644 (file)
@@ -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
index 9565198..43cb991 100644 (file)
@@ -26,8 +26,6 @@
 #ifdef HAVE_CPU_I386
 #include "gstscale_x86.h"
 #endif
-//FIXME
-#include <gst/meta/videoraw.h>
 
 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);
index a1b93dc..5a56d5e 100644 (file)
@@ -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
index 770c801..99120ee 100644 (file)
@@ -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);
 
index 97315fe..c830cc8 100644 (file)
@@ -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);