From kde-commits Mon Apr 01 13:02:21 2013 From: Rohan Garg Date: Mon, 01 Apr 2013 13:02:21 +0000 To: kde-commits Subject: [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Convert caps to the new format Message-Id: <20130401130221.8848FA6059 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=136482135607988 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/54a3171873c39efe7c17de608dfbe091322= a86d1 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 #include = +#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0) +#include +#endif + namespace Phonon { namespace Gstreamer @@ -61,11 +65,18 @@ AudioDataOutput::AudioDataOutput(Backend *backend, QObj= ect *parent) g_object_set(G_OBJECT(sink), "signal-handoffs", true, NULL); = //G_BYTE_ORDER is the host machine's endianess - GstCaps *caps =3D gst_caps_new_simple("audio/x-raw", + GstCaps *caps =3D + #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0) + gst_caps_new_simple("audio/x-raw-int", "endianess", G_TYPE_INT, G_BYTE_OR= DER, "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL); + #else + gst_caps_new_simple("audio/x-raw", + "format =3D (string)", G_TYPE_STRI= NG, 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 =3D 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 =3D (fraction) [ 0, MAX ], " + "width =3D (int) [ 1, MAX ], " + "height =3D (int) [ 1, MAX ]," + "bpp =3D (int) 32" #else - "video/x-raw, " + "video/x-raw, " + "format =3D (string) {YUY2, YVYU, UYVY= , Y41P, IYU2, Y42B, YV12, I420, Y41B, YUV9, YVU9, Y800}" #endif - "framerate =3D (fraction) [ 0,= MAX ], " - "width =3D (int) [ 1, MAX ], " - "height =3D (int) [ 1, MAX ]," - "bpp =3D (int) 32")); + ) +); = static GstStaticPadTemplate template_factory_rgb =3D GST_STATIC_PAD_TEMPLATE("sink", @@ -126,13 +129,9 @@ static GstStaticPadTemplate template_factory_rgb =3D 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 =3D=3D G_LITTLE_ENDIAN - GST_VIDEO_CAPS_MAKE("xBGR") - #elif G_BYTE_ORDER =3D=3D 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 #include = +#if GST_VERSION > GST_VERSION_CHECK (1,0,0,0) +#include +#endif + namespace Phonon { namespace Gstreamer @@ -64,16 +68,18 @@ VideoDataOutput::VideoDataOutput(Backend *backend, QObj= ect *parent) = // Save ourselves a metric crapton of work by simply requesting // a format native to Qt. - GstCaps *caps =3D 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 =3D +#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_OR= DER, NULL); +#else + gst_caps_new_simple("video/x-raw", + "format =3D (string)", G_TYPE_STRI= NG, 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 #else #include +#include #endif = = @@ -336,19 +337,22 @@ QImage VideoWidget::snapshot() const #endif = if (videobuffer) { - GstCaps *snapcaps =3D 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, 0x= ff0000, - "green_mask", G_TYPE_INT, = 0x00ff00, - "blue_mask", G_TYPE_INT, 0= x0000ff, - NULL); + GstCaps *snapcaps =3D + #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 =3D (string)", G_TYPE_STRING, = GST_VIDEO_NE(RGB), + NULL); +#endif + GstBuffer *snapbuffer; #if GST_VERSION < GST_VERSION_CHECK (1,0,0,0) snapbuffer =3D gst_video_convert_frame(videobuffer, snapcaps, GST_= SECOND, NULL);