[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Convert caps to the new format
From:       Rohan Garg <rohangarg () kubuntu ! org>
Date:       2013-04-01 13:02:21
Message-ID: 20130401130221.8848FA6059 () git ! kde ! org
[Download RAW message or body]

Git commit 54a3171873c39efe7c17de608dfbe091322a86d1 by Rohan Garg.
Committed on 01/04/2013 at 15:00.
Pushed by garg into branch '1.0-porting-for-merge'.

Convert caps to the new format

M  +12   -1    gstreamer/audiodataoutput.cpp
M  +10   -11   gstreamer/qwidgetvideosink.cpp
M  +12   -6    gstreamer/videodataoutput.cpp
M  +17   -13   gstreamer/videowidget.cpp

http://commits.kde.org/phonon-gstreamer/54a3171873c39efe7c17de608dfbe091322a86d1

diff --git a/gstreamer/audiodataoutput.cpp b/gstreamer/audiodataoutput.cpp
index 7d71851..5f6fa29 100644
--- a/gstreamer/audiodataoutput.cpp
+++ b/gstreamer/audiodataoutput.cpp
@@ -34,6 +34,10 @@
 #include <gst/gstutils.h>
 #include <gst/gst.h>
 
+#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
+#include <gst/audio/audio-format.h>
+#endif
+
 namespace Phonon
 {
 namespace Gstreamer
@@ -61,11 +65,18 @@ AudioDataOutput::AudioDataOutput(Backend *backend, QObject \
*parent)  g_object_set(G_OBJECT(sink), "signal-handoffs", true, NULL);
 
     //G_BYTE_ORDER is the host machine's endianess
-    GstCaps *caps = gst_caps_new_simple("audio/x-raw",
+    GstCaps *caps =
+                #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
+                    gst_caps_new_simple("audio/x-raw-int",
                                         "endianess", G_TYPE_INT, G_BYTE_ORDER,
                                         "width", G_TYPE_INT, 16,
                                         "depth", G_TYPE_INT, 16,
                                         NULL);
+                #else
+                    gst_caps_new_simple("audio/x-raw",
+                                        "format = (string)", G_TYPE_STRING, \
GST_AUDIO_NE (S16), +                                        NULL);
+                #endif
 
     gst_bin_add_many(GST_BIN(m_queue), sink, convert, queue, NULL);
     gst_element_link(queue, convert);
diff --git a/gstreamer/qwidgetvideosink.cpp b/gstreamer/qwidgetvideosink.cpp
index 97531cf..c5a6558 100644
--- a/gstreamer/qwidgetvideosink.cpp
+++ b/gstreamer/qwidgetvideosink.cpp
@@ -111,14 +111,17 @@ static GstStaticPadTemplate template_factory_yuv =
                             GST_PAD_ALWAYS,
                             GST_STATIC_CAPS(
                                 #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-                                "video/x-raw-yuv, "
+                                    "video/x-raw-yuv, "
+                                    "framerate = (fraction) [ 0, MAX ], "
+                                    "width = (int) [ 1, MAX ], "
+                                    "height = (int) [ 1, MAX ],"
+                                    "bpp = (int) 32"
                                 #else
-                                "video/x-raw, "
+                                    "video/x-raw, "
+                                    "format = (string) {YUY2, YVYU, UYVY, Y41P, \
IYU2, Y42B, YV12, I420, Y41B, YUV9, YVU9, Y800}"  #endif
-                                            "framerate = (fraction) [ 0, MAX ], "
-                                            "width = (int) [ 1, MAX ], "
-                                            "height = (int) [ 1, MAX ],"
-                                            "bpp = (int) 32"));
+                                )
+);
 
 static GstStaticPadTemplate template_factory_rgb =
     GST_STATIC_PAD_TEMPLATE("sink",
@@ -126,13 +129,9 @@ static GstStaticPadTemplate template_factory_rgb =
                             GST_PAD_ALWAYS,
                             GST_STATIC_CAPS(
                                 #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-                                GST_VIDEO_CAPS_xRGB_HOST_ENDIAN
+                                    GST_VIDEO_CAPS_xRGB_HOST_ENDIAN
                                 #else
-                                  #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                                    GST_VIDEO_CAPS_MAKE("xBGR")
-                                  #elif G_BYTE_ORDER == G_BIG_ENDIAN
                                     GST_VIDEO_CAPS_MAKE("xRGB")
-                                  #endif
                                 #endif
                                 )
                             );
diff --git a/gstreamer/videodataoutput.cpp b/gstreamer/videodataoutput.cpp
index eb3fe3d..ae9dd9b 100644
--- a/gstreamer/videodataoutput.cpp
+++ b/gstreamer/videodataoutput.cpp
@@ -29,6 +29,10 @@
 #include <gst/gstghostpad.h>
 #include <gst/gstutils.h>
 
+#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0)
+#include <gst/video/video-format.h>
+#endif
+
 namespace Phonon
 {
 namespace Gstreamer
@@ -64,16 +68,18 @@ VideoDataOutput::VideoDataOutput(Backend *backend, QObject \
*parent)  
         // Save ourselves a metric crapton of work by simply requesting
         // a format native to Qt.
-    GstCaps *caps = gst_caps_new_simple(
-            #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-                "video/x-raw-rgb",
-            #else
-                "video/x-raw",
-            #endif
+    GstCaps *caps =
+#if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
+                    gst_caps_new_simple("video/x-raw-rgb",
                                         "bpp", G_TYPE_INT, 24,
                                         "depth", G_TYPE_INT, 24,
                                         "endianess", G_TYPE_INT, G_BYTE_ORDER,
                                         NULL);
+#else
+                    gst_caps_new_simple("video/x-raw",
+                                        "format = (string)", G_TYPE_STRING, \
GST_VIDEO_NE(RGB), +                                        NULL);
+#endif
 
     gst_bin_add_many(GST_BIN(m_queue), sink, convert, queue, NULL);
     gst_element_link(queue, convert);
diff --git a/gstreamer/videowidget.cpp b/gstreamer/videowidget.cpp
index 6a378b7..afa0917 100644
--- a/gstreamer/videowidget.cpp
+++ b/gstreamer/videowidget.cpp
@@ -40,6 +40,7 @@
 #include <gst/interfaces/propertyprobe.h>
 #else
 #include <gst/video/navigation.h>
+#include <gst/video/video-format.h>
 #endif
 
 
@@ -336,19 +337,22 @@ QImage VideoWidget::snapshot() const
 #endif
 
     if (videobuffer) {
-        GstCaps *snapcaps = gst_caps_new_simple(
-            #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
-                    "video/x-raw-rgb",
-            #else
-                    "video/x-raw",
-            #endif
-                                                "bpp", G_TYPE_INT, 24,
-                                                "depth", G_TYPE_INT, 24,
-                                                "endianness", G_TYPE_INT, \
                G_BIG_ENDIAN,
-                                                "red_mask", G_TYPE_INT, 0xff0000,
-                                                "green_mask", G_TYPE_INT, 0x00ff00,
-                                                "blue_mask", G_TYPE_INT, 0x0000ff,
-                                                NULL);
+        GstCaps *snapcaps =
+        #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
+                gst_caps_new_simple("video/x-raw-rgb",
+                                    "bpp", G_TYPE_INT, 24,
+                                    "depth", G_TYPE_INT, 24,
+                                    "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+                                    "red_mask", G_TYPE_INT, 0xff0000,
+                                    "green_mask", G_TYPE_INT, 0x00ff00,
+                                    "blue_mask", G_TYPE_INT, 0x0000ff,
+                                    NULL);
+#else
+                gst_caps_new_simple("video/x-raw",
+                                    "format = (string)", G_TYPE_STRING, \
GST_VIDEO_NE(RGB), +                                    NULL);
+#endif
+
         GstBuffer *snapbuffer;
 #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0)
         snapbuffer = gst_video_convert_frame(videobuffer, snapcaps, GST_SECOND, \
NULL);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic