From 924f74398192e34e18d312ea9af9ff2a81480a71 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 16 May 2011 14:46:52 -0700 Subject: [PATCH] playback: Add define for colorspace element Single point of change if you want to switch from ffmpegcolorspace to colorspace. --- gst/playback/Makefile.am | 14 +++++----- gst/playback/gstplaybin.c | 10 +++---- gst/playback/gstplaysink.c | 8 +++--- gst/playback/gstplaysinkvideoconvert.c | 6 ++--- gst/playback/gstsubtitleoverlay.c | 36 +++++++++++++------------- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/gst/playback/Makefile.am b/gst/playback/Makefile.am index 2fe90e6e85..9c8273f15c 100644 --- a/gst/playback/Makefile.am +++ b/gst/playback/Makefile.am @@ -8,6 +8,8 @@ built_headers = gstplay-marshal.h plugin_LTLIBRARIES = libgstplaybin.la libgstdecodebin.la libgstdecodebin2.la +csp_cflags = -DCOLORSPACE=\"ffmpegcolorspace\" + libgstplaybin_la_SOURCES = \ gstplayback.c \ gstplaybin.c \ @@ -23,7 +25,7 @@ libgstplaybin_la_SOURCES = \ gststreamsynchronizer.c nodist_libgstplaybin_la_SOURCES = $(built_sources) -libgstplaybin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstplaybin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(csp_cflags) libgstplaybin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstplaybin_la_LIBADD = \ $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \ @@ -34,7 +36,7 @@ libgstplaybin_la_LIBTOOLFLAGS = --tag=disable-static libgstdecodebin_la_SOURCES = gstdecodebin.c nodist_libgstdecodebin_la_SOURCES = $(built_sources) -libgstdecodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstdecodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(csp_cflags) libgstdecodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdecodebin_la_LIBADD = \ $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \ @@ -43,7 +45,7 @@ libgstdecodebin_la_LIBTOOLFLAGS = --tag=disable-static libgstdecodebin2_la_SOURCES = gstdecodebin2.c gsturidecodebin.c gstplay-enum.c nodist_libgstdecodebin2_la_SOURCES = $(built_sources) -libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(csp_cflags) libgstdecodebin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdecodebin2_la_LIBADD = \ $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \ @@ -78,7 +80,7 @@ Android.mk: Makefile.am $(BUILT_SOURCES) -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ -:SOURCES $(libgstdecodebin_la_SOURCES) \ $(nodist_libgstdecodebin_la_SOURCES) \ - -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin_la_CFLAGS) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin_la_CFLAGS) $(csp_cflags) \ -:LDFLAGS $(libgstdecodebin_la_LDFLAGS) \ $(libgstdecodebin_la_LIBADD) \ -ldl \ @@ -90,7 +92,7 @@ Android.mk: Makefile.am $(BUILT_SOURCES) -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ -:SOURCES $(libgstdecodebin2_la_SOURCES) \ $(nodist_libgstdecodebin2_la_SOURCES) \ - -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin2_la_CFLAGS) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdecodebin2_la_CFLAGS) $(csp_cflags) \ -:LDFLAGS $(libgstdecodebin2_la_LDFLAGS) \ $(libgstdecodebin2_la_LIBADD) \ -ldl \ @@ -102,7 +104,7 @@ Android.mk: Makefile.am $(BUILT_SOURCES) -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ -:SOURCES $(libgstplaybin_la_SOURCES) \ $(nodist_libgstplaybin_la_SOURCES) \ - -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstplaybin_la_CFLAGS) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstplaybin_la_CFLAGS) $(csp_cflags) \ -:LDFLAGS $(libgstplaybin_la_LDFLAGS) \ $(libgstplaybin_la_LIBADD) \ -ldl \ diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 57b5dbe1f8..847246f0f8 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -859,7 +859,7 @@ gen_video_element (GstPlayBin * play_bin) element = gst_bin_new ("vbin"); gst_bin_add (GST_BIN_CAST (element), sink); - conv = gst_element_factory_make ("ffmpegcolorspace", "vconv"); + conv = gst_element_factory_make (COLORSPACE, "vconv"); if (conv == NULL) goto no_colorspace; gst_bin_add (GST_BIN_CAST (element), conv); @@ -905,10 +905,10 @@ no_sinks: } no_colorspace: { - post_missing_element_message (play_bin, "ffmpegcolorspace"); + post_missing_element_message (play_bin, COLORSPACE); GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN, (_("Missing element '%s' - check your GStreamer installation."), - "ffmpegcolorspace"), (NULL)); + COLORSPACE), (NULL)); gst_object_unref (element); return NULL; } @@ -972,7 +972,7 @@ add_text_element (GstPlayBin * play_bin, GstElement * vbin) play_bin->textoverlay_element = GST_ELEMENT_CAST (gst_object_ref (overlay)); /* we know this will succeed, as the video bin already created one before */ - csp = gst_element_factory_make ("ffmpegcolorspace", "subtitlecsp"); + csp = gst_element_factory_make (COLORSPACE, "subtitlecsp"); /* Add our elements */ gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL); @@ -1046,7 +1046,7 @@ add_spu_element (GstPlayBin * play_bin, GstElement * vbin) play_bin->spu_element = GST_ELEMENT_CAST (gst_object_ref (overlay)); /* we know this will succeed, as the video bin already created one before */ - csp = gst_element_factory_make ("ffmpegcolorspace", "spucsp"); + csp = gst_element_factory_make (COLORSPACE, "spucsp"); /* Add our elements */ gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL); diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c index 35e31d6428..0e70ce75a9 100644 --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@ -1133,13 +1133,13 @@ gen_video_deinterlace_chain (GstPlaySink * playsink) bin = GST_BIN_CAST (chain->chain.bin); gst_object_ref_sink (bin); - GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace"); - chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vdconv"); + GST_DEBUG_OBJECT (playsink, "creating " COLORSPACE); + chain->conv = gst_element_factory_make (COLORSPACE, "vdconv"); if (chain->conv == NULL) { - post_missing_element_message (playsink, "ffmpegcolorspace"); + post_missing_element_message (playsink, COLORSPACE); GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, (_("Missing element '%s' - check your GStreamer installation."), - "ffmpegcolorspace"), ("video rendering might fail")); + COLORSPACE), ("video rendering might fail")); } else { gst_bin_add (bin, chain->conv); head = chain->conv; diff --git a/gst/playback/gstplaysinkvideoconvert.c b/gst/playback/gstplaysinkvideoconvert.c index 19986fee3c..cf765ce969 100644 --- a/gst/playback/gstplaysinkvideoconvert.c +++ b/gst/playback/gstplaysinkvideoconvert.c @@ -132,12 +132,12 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkVideoConvert * self) gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->sinkpad), NULL); gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL); - self->conv = gst_element_factory_make ("ffmpegcolorspace", "conv"); + self->conv = gst_element_factory_make (COLORSPACE, "conv"); if (self->conv == NULL) { - post_missing_element_message (self, "ffmpegcolorspace"); + post_missing_element_message (self, COLORSPACE); GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN, (_("Missing element '%s' - check your GStreamer installation."), - "ffmpegcolorspace"), ("video rendering might fail")); + COLORSPACE), ("video rendering might fail")); } else { gst_bin_add (bin, self->conv); gst_element_sync_state_with_parent (self->conv); diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index 0ec7ee5fdd..9a090e81ed 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -919,7 +919,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) gst_object_unref (src); if (G_UNLIKELY (!_create_element (self, &self->post_colorspace, - "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) { + COLORSPACE, NULL, "post-colorspace", FALSE))) { continue; } @@ -931,13 +931,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) sink = gst_element_get_static_pad (self->post_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); gst_object_unref (src); continue; } if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) { - GST_WARNING_OBJECT (self, "Can't link overlay with ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't link overlay with " COLORSPACE); gst_object_unref (src); gst_object_unref (sink); continue; @@ -946,7 +946,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) gst_object_unref (sink); if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace, - "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) { + COLORSPACE, NULL, "pre-colorspace", FALSE))) { continue; } @@ -958,13 +958,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) src = gst_element_get_static_pad (self->pre_colorspace, "src"); if (G_UNLIKELY (!src)) { - GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE); gst_object_unref (sink); continue; } if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) { - GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to textoverlay"); + GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to textoverlay"); gst_object_unref (src); gst_object_unref (sink); continue; @@ -975,7 +975,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) /* Set src ghostpad target */ src = gst_element_get_static_pad (self->post_colorspace, "src"); if (G_UNLIKELY (!src)) { - GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE); continue; } @@ -994,7 +994,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) sink = gst_element_get_static_pad (self->pre_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); continue; } @@ -1038,7 +1038,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) /* Set the sink ghostpad targets */ sink = gst_element_get_static_pad (self->pre_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); continue; } @@ -1088,7 +1088,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) /* First link everything internally */ if (G_UNLIKELY (!_create_element (self, &self->post_colorspace, - "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) { + COLORSPACE, NULL, "post-colorspace", FALSE))) { continue; } @@ -1100,13 +1100,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) sink = gst_element_get_static_pad (self->post_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); gst_object_unref (src); continue; } if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) { - GST_WARNING_OBJECT (self, "Can't link renderer with ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't link renderer with " COLORSPACE); gst_object_unref (src); gst_object_unref (sink); continue; @@ -1115,7 +1115,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) gst_object_unref (sink); if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace, - "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) { + COLORSPACE, NULL, "pre-colorspace", FALSE))) { continue; } @@ -1127,13 +1127,13 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) src = gst_element_get_static_pad (self->pre_colorspace, "src"); if (G_UNLIKELY (!src)) { - GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE); gst_object_unref (sink); continue; } if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) { - GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to renderer"); + GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to renderer"); gst_object_unref (src); gst_object_unref (sink); continue; @@ -1144,7 +1144,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) /* Set src ghostpad target */ src = gst_element_get_static_pad (self->post_colorspace, "src"); if (G_UNLIKELY (!src)) { - GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE); continue; } @@ -1163,7 +1163,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) sink = gst_element_get_static_pad (self->pre_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); continue; } @@ -1205,7 +1205,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) /* Set the sink ghostpad targets */ sink = gst_element_get_static_pad (self->pre_colorspace, "sink"); if (G_UNLIKELY (!sink)) { - GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace"); + GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE); continue; }