From 0285d77d9663782657f68293d69357740f1b7adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 3 Nov 2009 11:48:40 +0100 Subject: [PATCH] decodebin2: Use static caps for the default raw caps and put them into a separate header This way we can use the same default raw caps everywhere. --- gst/playback/Makefile.am | 3 ++- gst/playback/gstdecodebin2.c | 8 +++---- gst/playback/gstrawcaps.h | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 gst/playback/gstrawcaps.h diff --git a/gst/playback/Makefile.am b/gst/playback/Makefile.am index e075f83d81..0647a72b60 100644 --- a/gst/playback/Makefile.am +++ b/gst/playback/Makefile.am @@ -58,7 +58,8 @@ noinst_HEADERS = \ gstinputselector.h \ gstplay-enum.h \ gstscreenshot.h \ - gststreamselector.h + gststreamselector.h \ + gstrawcaps.h noinst_PROGRAMS = test decodetest test2 test3 test4 test5 test6 test7 diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 405ddbc687..49f3703b4c 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -90,6 +90,7 @@ #include "gstplay-marshal.h" #include "gstplay-enum.h" #include "gstfactorylists.h" +#include "gstrawcaps.h" /* generic templates */ static GstStaticPadTemplate decoder_bin_sink_template = @@ -251,6 +252,8 @@ GST_ELEMENT_DETAILS ("Decoder Bin", "Edward Hervey , " "Sebastian Dröge "); +static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS); + static void do_async_start (GstDecodeBin * dbin); static void do_async_done (GstDecodeBin * dbin); @@ -847,10 +850,7 @@ gst_decode_bin_init (GstDecodeBin * decode_bin) decode_bin->blocked_pads = NULL; decode_bin->encoding = g_strdup (DEFAULT_SUBTITLE_ENCODING); - decode_bin->caps = - gst_caps_from_string ("video/x-raw-yuv;video/x-raw-rgb;video/x-raw-gray;" - "audio/x-raw-int;audio/x-raw-float;" "text/plain;text/x-pango-markup;" - "video/x-dvd-subpicture; subpicture/x-pgs"); + decode_bin->caps = gst_static_caps_get (&default_raw_caps); decode_bin->use_buffering = DEFAULT_USE_BUFFERING; decode_bin->low_percent = DEFAULT_LOW_PERCENT; decode_bin->high_percent = DEFAULT_HIGH_PERCENT; diff --git a/gst/playback/gstrawcaps.h b/gst/playback/gstrawcaps.h new file mode 100644 index 0000000000..0297e33107 --- /dev/null +++ b/gst/playback/gstrawcaps.h @@ -0,0 +1,42 @@ +/* GStreamer + * Copyright (C) <2009> Sebastian Dröge + * + * 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_RAW_CAPS_H__ +#define __GST_RAW_CAPS_H__ + +#include + +G_BEGIN_DECLS + +#define DEFAULT_RAW_CAPS \ + "video/x-raw-yuv; " \ + "video/x-raw-rgb; " \ + "video/x-raw-gray; " \ + "audio/x-raw-int; " \ + "audio/x-raw-float; " \ + "text/plain; " \ + "text/x-pango-markup; " \ + "video/x-dvd-subpicture; " \ + "subpicture/x-pgs" + +G_END_DECLS + +#endif /* __GST_RAW_CAPS__ */ +