From 3054545dade03d6ebe155b596ad5a1b09bd11b97 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Mon, 1 Oct 2012 23:21:12 +1000 Subject: resindvd: Port parsetter element Port the DVD element which overrides the MPEG encoded pixel-aspect-ratio to match that requested by the DVD VM. --- ext/resindvd/Makefile.am | 6 +- ext/resindvd/resindvdbin.c | 4 +- ext/resindvd/rsnparsetter.c | 292 +++++++++++++++------------------------- ext/resindvd/rsnparsetter.h | 2 - ext/resindvd/rsnwrappedbuffer.c | 121 ----------------- ext/resindvd/rsnwrappedbuffer.h | 49 ------- 6 files changed, 115 insertions(+), 359 deletions(-) delete mode 100644 ext/resindvd/rsnwrappedbuffer.c delete mode 100644 ext/resindvd/rsnwrappedbuffer.h diff --git a/ext/resindvd/Makefile.am b/ext/resindvd/Makefile.am index 77f6a8765..1ad4a1d54 100644 --- a/ext/resindvd/Makefile.am +++ b/ext/resindvd/Makefile.am @@ -11,8 +11,7 @@ libgstresindvd_la_SOURCES = \ gstmpegdemux.c \ gstpesfilter.c \ rsninputselector.c \ - # rsnparsetter.c \ - # rsnwrappedbuffer.c + rsnparsetter.c libgstresindvd_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ @@ -31,8 +30,7 @@ noinst_HEADERS = resindvdbin.h \ gstmpegdesc.h \ gstmpegdemux.h \ gstpesfilter.h \ - rsnparsetter.h \ - rsnwrappedbuffer.h + rsnparsetter.h EXTRA_DIST = resin-play resin-play2 diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c index 2ffb4b5cc..8cff8fb32 100644 --- a/ext/resindvd/resindvdbin.c +++ b/ext/resindvd/resindvdbin.c @@ -34,7 +34,7 @@ #include "rsninputselector.h" // #include "rsnaudiomunge.h" #include "rsndec.h" -// #include "rsnparsetter.h" +#include "rsnparsetter.h" #include "gstmpegdemux.h" @@ -472,7 +472,7 @@ create_elements (RsnDvdBin * dvdbin) return FALSE; /* FIXME: Replace identity */ - if (!try_create_piece (dvdbin, DVD_ELEM_PARSET, "identity", 0, //RSN_TYPE_RSNPARSETTER, + if (!try_create_piece (dvdbin, DVD_ELEM_PARSET, NULL, RSN_TYPE_RSNPARSETTER, "rsnparsetter", "Aspect ratio adjustment")) return FALSE; diff --git a/ext/resindvd/rsnparsetter.c b/ext/resindvd/rsnparsetter.c index c310314a4..796ff31ac 100644 --- a/ext/resindvd/rsnparsetter.c +++ b/ext/resindvd/rsnparsetter.c @@ -12,7 +12,6 @@ #include #include "rsnparsetter.h" -#include "rsnwrappedbuffer.h" GST_DEBUG_CATEGORY_STATIC (rsn_parsetter_debug); #define GST_CAT_DEFAULT rsn_parsetter_debug @@ -20,50 +19,47 @@ GST_DEBUG_CATEGORY_STATIC (rsn_parsetter_debug); static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-rgb; video/x-raw-yuv") + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)) ); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-rgb; video/x-raw-yuv") + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)) ); -static void rsn_parsetter_register_extra (GType rsn_parsetter_type); - -GST_BOILERPLATE_FULL (RsnParSetter, rsn_parsetter, GstElement, - GST_TYPE_ELEMENT, rsn_parsetter_register_extra); +#define rsn_parsetter_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (RsnParSetter, rsn_parsetter, GST_TYPE_ELEMENT, + GST_DEBUG_CATEGORY_INIT (rsn_parsetter_debug, "rsnparsetter", 0, + "Resin DVD aspect ratio adjuster")); static void rsn_parsetter_finalize (GObject * object); -static GstFlowReturn rsn_parsetter_chain (GstPad * pad, GstBuffer * buf); -static gboolean rsn_parsetter_sink_event (GstPad * pad, GstEvent * event); -static gboolean rsn_parsetter_sink_setcaps (GstPad * pad, GstCaps * caps); -static GstFlowReturn rsn_parsetter_sink_bufferalloc (GstPad * pad, - guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); +static GstFlowReturn rsn_parsetter_chain (GstPad * pad, + RsnParSetter * parset, GstBuffer * buf); +static gboolean rsn_parsetter_sink_event (GstPad * pad, + RsnParSetter * parset, GstEvent * event); -static GstCaps *rsn_parsetter_src_getcaps (GstPad * pad); +static gboolean rsn_parsetter_src_query (GstPad * pad, RsnParSetter * parset, + GstQuery * query); static GstCaps *rsn_parsetter_convert_caps (RsnParSetter * parset, GstCaps * caps, gboolean widescreen); static gboolean rsn_parsetter_check_caps (RsnParSetter * parset, GstCaps * caps); +static void rsn_parsetter_update_caps (RsnParSetter * parset, GstCaps * caps); static void -rsn_parsetter_register_extra (GType rsn_parsetter_type) -{ - GST_DEBUG_CATEGORY_INIT (rsn_parsetter_debug, "rsnparsetter", 0, - "Resin DVD aspect ratio adjuster"); -} - -static void -rsn_parsetter_base_init (gpointer gclass) +rsn_parsetter_class_init (RsnParSetterClass * klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + gobject_class->finalize = rsn_parsetter_finalize; gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_metadata (element_class, "Resin Aspect Ratio Setter", "Filter/Video", "Overrides caps on video buffers to force a particular display ratio", @@ -71,34 +67,21 @@ rsn_parsetter_base_init (gpointer gclass) } static void -rsn_parsetter_class_init (RsnParSetterClass * klass) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = rsn_parsetter_finalize; -} - -static void -rsn_parsetter_init (RsnParSetter * parset, RsnParSetterClass * gclass) +rsn_parsetter_init (RsnParSetter * parset) { parset->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); - gst_pad_set_getcaps_function (parset->sinkpad, - GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_pad_set_chain_function (parset->sinkpad, - GST_DEBUG_FUNCPTR (rsn_parsetter_chain)); + (GstPadChainFunction) GST_DEBUG_FUNCPTR (rsn_parsetter_chain)); gst_pad_set_event_function (parset->sinkpad, - GST_DEBUG_FUNCPTR (rsn_parsetter_sink_event)); - gst_pad_set_setcaps_function (parset->sinkpad, - GST_DEBUG_FUNCPTR (rsn_parsetter_sink_setcaps)); - gst_pad_set_bufferalloc_function (parset->sinkpad, - GST_DEBUG_FUNCPTR (rsn_parsetter_sink_bufferalloc)); + (GstPadEventFunction) GST_DEBUG_FUNCPTR (rsn_parsetter_sink_event)); + GST_PAD_SET_PROXY_CAPS (parset->sinkpad); + GST_PAD_SET_PROXY_ALLOCATION (parset->sinkpad); gst_element_add_pad (GST_ELEMENT (parset), parset->sinkpad); parset->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); - gst_pad_set_getcaps_function (parset->srcpad, - GST_DEBUG_FUNCPTR (rsn_parsetter_src_getcaps)); + gst_pad_set_query_function (parset->srcpad, + (GstPadQueryFunction) GST_DEBUG_FUNCPTR (rsn_parsetter_src_query)); + GST_PAD_SET_PROXY_CAPS (parset->srcpad); gst_element_add_pad (GST_ELEMENT (parset), parset->srcpad); parset->caps_lock = g_mutex_new (); @@ -119,107 +102,105 @@ rsn_parsetter_finalize (GObject * object) } static GstFlowReturn -rsn_parsetter_chain (GstPad * pad, GstBuffer * buf) +rsn_parsetter_chain (GstPad * pad, RsnParSetter * parset, GstBuffer * buf) { - RsnParSetter *parset = RSN_PARSETTER (GST_OBJECT_PARENT (pad)); - RsnMetaWrapped *meta; - - meta = RSN_META_WRAPPED_GET (buf); - - /* If this is a buffer we wrapped up earlier, unwrap it now */ - if (meta != NULL) { - GstBuffer *wrap_buf = buf; + return gst_pad_push (parset->srcpad, buf); +} - if (meta->owner == GST_ELEMENT (parset)) { - buf = rsn_meta_wrapped_unwrap_and_unref (wrap_buf, meta); - GST_DEBUG_OBJECT (parset, "Unwrapping %p yields buffer %p with caps %" - GST_PTR_FORMAT, wrap_buf, buf, GST_BUFFER_CAPS (buf)); +static gboolean +rsn_parsetter_sink_event (GstPad * pad, RsnParSetter * parset, GstEvent * event) +{ + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_CUSTOM_DOWNSTREAM:{ + const GstStructure *structure = gst_event_get_structure (event); + + if (structure != NULL && + gst_structure_has_name (structure, "application/x-gst-dvd")) { + const char *type = gst_structure_get_string (structure, "event"); + if (type == NULL) + goto out; + + if (strcmp (type, "dvd-video-format") == 0) { + gboolean is_widescreen; + + gst_structure_get_boolean (structure, "video-widescreen", + &is_widescreen); + + GST_DEBUG_OBJECT (parset, "Video is %s", + parset->is_widescreen ? "16:9" : "4:3"); + + g_mutex_lock (parset->caps_lock); + if (parset->is_widescreen != is_widescreen) { + /* Force caps check */ + gst_caps_replace (&parset->in_caps_last, NULL); + gst_caps_replace (&parset->in_caps_converted, NULL); + } + parset->is_widescreen = is_widescreen; + + /* FIXME: Added for testing: */ + // parset->is_widescreen = FALSE; + + g_mutex_unlock (parset->caps_lock); + } + } + break; } - } - - if (parset->outcaps != GST_BUFFER_CAPS (buf)) { - if (parset->override_outcaps == FALSE && - gst_caps_is_equal (parset->outcaps, GST_BUFFER_CAPS (buf))) { - /* Just update our output caps var */ - gst_caps_replace (&parset->outcaps, GST_BUFFER_CAPS (buf)); - goto out; + case GST_EVENT_CAPS: + { + GstCaps *caps = NULL; + gst_event_parse_caps (event, &caps); + rsn_parsetter_update_caps (parset, caps); + if (parset->override_outcaps) { + gst_event_unref (event); + GST_DEBUG_OBJECT (parset, + "Handling caps event. Overriding upstream caps" + " with %" GST_PTR_FORMAT, parset->outcaps); + event = gst_event_new_caps (parset->outcaps); + } else { + GST_DEBUG_OBJECT (parset, + "Handling caps event. Upstream caps %" GST_PTR_FORMAT + " acceptable", caps); + } + break; } - - /* Replace the caps on the output buffer */ - buf = gst_buffer_make_metadata_writable (buf); - gst_buffer_set_caps (buf, parset->outcaps); - - GST_DEBUG_OBJECT (parset, - "Replacing caps on buffer %p with caps %" GST_PTR_FORMAT, - buf, parset->outcaps); + default: + break; } out: - return gst_pad_push (parset->srcpad, buf); + return gst_pad_event_default (pad, (GstObject *) (parset), event); } static gboolean -rsn_parsetter_sink_event (GstPad * pad, GstEvent * event) +rsn_parsetter_src_query (GstPad * pad, RsnParSetter * parset, GstQuery * query) { - RsnParSetter *parset = RSN_PARSETTER (gst_pad_get_parent (pad)); - const GstStructure *structure = gst_event_get_structure (event); - - if (structure != NULL && - gst_structure_has_name (structure, "application/x-gst-dvd")) { - const char *type = gst_structure_get_string (structure, "event"); - if (type == NULL) - goto out; - - if (strcmp (type, "dvd-video-format") == 0) { - gboolean is_widescreen; + GstCaps *caps = NULL; - gst_structure_get_boolean (structure, "video-widescreen", &is_widescreen); + if (!gst_pad_peer_query (parset->sinkpad, query)) + return FALSE; - GST_DEBUG_OBJECT (parset, "Video is %s", - parset->is_widescreen ? "16:9" : "4:3"); + if (GST_QUERY_TYPE (query) != GST_QUERY_CAPS) + return TRUE; - g_mutex_lock (parset->caps_lock); - if (parset->is_widescreen != is_widescreen) { - /* Force caps check */ - gst_caps_replace (&parset->in_caps_last, NULL); - gst_caps_replace (&parset->in_caps_converted, NULL); - } - parset->is_widescreen = is_widescreen; - - /* FIXME: Added for testing: */ - // parset->is_widescreen = FALSE; + gst_query_parse_caps_result (query, &caps); - g_mutex_unlock (parset->caps_lock); - } - } + GST_DEBUG_OBJECT (parset, "Handling caps query. Upstream caps %" + GST_PTR_FORMAT, caps); -out: - gst_object_unref (GST_OBJECT (parset)); - return gst_pad_event_default (pad, event); -} - -static GstCaps * -rsn_parsetter_src_getcaps (GstPad * pad) -{ - RsnParSetter *parset = RSN_PARSETTER (gst_pad_get_parent (pad)); - GstCaps *ret; - const GstCaps *templ_caps = gst_pad_get_pad_template_caps (pad); - - ret = gst_pad_peer_get_caps (parset->sinkpad); - if (ret == NULL) - ret = gst_caps_copy (templ_caps); - else { - GstCaps *temp; - temp = gst_caps_intersect (templ_caps, ret); - gst_caps_unref (ret); - ret = rsn_parsetter_convert_caps (parset, temp, parset->is_widescreen); - gst_caps_unref (temp); + if (caps == NULL) { + GstCaps *templ_caps = gst_pad_get_pad_template_caps (pad); + gst_query_set_caps_result (query, templ_caps); + gst_caps_unref (templ_caps); + } else { + caps = rsn_parsetter_convert_caps (parset, caps, parset->is_widescreen); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); } - gst_object_unref (parset); - return ret; + return TRUE; } +/* Check if the DAR of the passed matches the required DAR */ static gboolean rsn_parsetter_check_caps (RsnParSetter * parset, GstCaps * caps) { @@ -231,8 +212,9 @@ rsn_parsetter_check_caps (RsnParSetter * parset, GstCaps * caps) g_mutex_lock (parset->caps_lock); - if (caps == parset->in_caps_last || - gst_caps_is_equal (caps, parset->in_caps_last)) { + if (parset->in_caps_last && + (caps == parset->in_caps_last || + gst_caps_is_equal (caps, parset->in_caps_last))) { ret = parset->in_caps_was_ok; goto out; } @@ -327,13 +309,11 @@ out: return outcaps; } -static gboolean -rsn_parsetter_sink_setcaps (GstPad * pad, GstCaps * caps) +static void +rsn_parsetter_update_caps (RsnParSetter * parset, GstCaps * caps) { /* Check the new incoming caps against our current DAR, and mark - * whether the buffers will need adjusting */ - RsnParSetter *parset = RSN_PARSETTER (gst_pad_get_parent (pad)); - + * whether the caps need adjusting */ if (rsn_parsetter_check_caps (parset, caps)) { parset->override_outcaps = FALSE; gst_caps_replace (&parset->outcaps, caps); @@ -349,54 +329,4 @@ rsn_parsetter_sink_setcaps (GstPad * pad, GstCaps * caps) GST_DEBUG_OBJECT (parset, "caps changed: need_override now = %d", parset->override_outcaps); - - gst_object_unref (parset); - return TRUE; -} - -static GstFlowReturn -rsn_parsetter_sink_bufferalloc (GstPad * pad, guint64 offset, guint size, - GstCaps * caps, GstBuffer ** buf) -{ - RsnParSetter *parset = RSN_PARSETTER (gst_pad_get_parent (pad)); - GstFlowReturn ret; - - GST_LOG_OBJECT (parset, "Entering bufferalloc"); - - if (rsn_parsetter_check_caps (parset, caps)) { - ret = gst_pad_alloc_buffer (parset->srcpad, offset, size, caps, buf); - GST_LOG_OBJECT (parset, "Not wrapping buf %p", *buf); - } else { - /* Allocate and wrap a downstream buffer */ - GstBuffer *orig_buf; - GstBuffer *outbuf; - GstCaps *override_caps = rsn_parsetter_convert_caps (parset, caps, - parset->is_widescreen); - - ret = gst_pad_alloc_buffer (parset->srcpad, offset, size, - override_caps, &orig_buf); - gst_caps_unref (override_caps); - - if (ret != GST_FLOW_OK) - return ret; - - outbuf = rsn_wrapped_buffer_new (orig_buf, GST_ELEMENT_CAST (parset)); - if (!outbuf) { - /* FIXME: Throw error */ - return GST_FLOW_ERROR; - } - - gst_buffer_set_caps (outbuf, caps); - - GST_LOG_OBJECT (parset, - "Wrapped ds buf %p with caps %" GST_PTR_FORMAT - " into new buf %p with caps %" GST_PTR_FORMAT, - orig_buf, GST_BUFFER_CAPS (orig_buf), outbuf, GST_BUFFER_CAPS (outbuf)); - - *buf = outbuf; - } - - gst_object_unref (GST_OBJECT (parset)); - - return ret; } diff --git a/ext/resindvd/rsnparsetter.h b/ext/resindvd/rsnparsetter.h index 5e89bb1cf..a1d7b32ee 100644 --- a/ext/resindvd/rsnparsetter.h +++ b/ext/resindvd/rsnparsetter.h @@ -7,8 +7,6 @@ #include -#include "rsnwrappedbuffer.h" - G_BEGIN_DECLS #define RSN_TYPE_RSNPARSETTER \ diff --git a/ext/resindvd/rsnwrappedbuffer.c b/ext/resindvd/rsnwrappedbuffer.c deleted file mode 100644 index a5f4c0fd3..000000000 --- a/ext/resindvd/rsnwrappedbuffer.c +++ /dev/null @@ -1,121 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 Jan Schmidt - * - * 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. - */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include - -#include "rsnwrappedbuffer.h" - -GstBuffer * -rsn_wrapped_buffer_new (GstBuffer * buf_to_wrap, GstElement * owner) -{ - GstBuffer *buf; - RsnMetaWrapped *meta; - - g_return_val_if_fail (buf_to_wrap, NULL); - - buf = gst_buffer_new (); - meta = RSN_META_WRAPPED_ADD (buf); - - meta->wrapped_buffer = buf_to_wrap; - meta->owner = gst_object_ref (owner); - - GST_BUFFER_DATA (buf) = GST_BUFFER_DATA (buf_to_wrap); - GST_BUFFER_SIZE (buf) = GST_BUFFER_SIZE (buf_to_wrap); - gst_buffer_copy_metadata (GST_BUFFER (buf), buf_to_wrap, GST_BUFFER_COPY_ALL); - - /* If the wrapped buffer isn't writable, make sure this one isn't either */ - if (!gst_buffer_is_writable (buf_to_wrap)) - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY); - - return buf; -} - -void -rsn_meta_wrapped_set_owner (RsnMetaWrapped * meta, GstElement * owner) -{ - g_return_if_fail (meta != NULL); - - if (meta->owner) - gst_object_unref (meta->owner); - - if (owner) - gst_object_ref (owner); - - meta->owner = owner; -} - -GstBuffer * -rsn_meta_wrapped_unwrap_and_unref (GstBuffer * wrap_buf, RsnMetaWrapped * meta) -{ - GstBuffer *buf; - gboolean is_readonly; - - g_return_val_if_fail (wrap_buf != NULL, NULL); - g_return_val_if_fail (meta->wrapped_buffer != NULL, NULL); - - buf = gst_buffer_ref (meta->wrapped_buffer); - buf = gst_buffer_make_metadata_writable (buf); - - /* Copy changed metadata back to the wrapped buffer from the wrapper, - * except the the read-only flag and the caps. */ - is_readonly = GST_BUFFER_FLAG_IS_SET (wrap_buf, GST_BUFFER_FLAG_READONLY); - gst_buffer_copy_metadata (buf, GST_BUFFER (wrap_buf), - GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS); - if (!is_readonly) - GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_READONLY); - - gst_buffer_unref (wrap_buf); - - return buf; -} - -static void -rsn_meta_wrapped_init (RsnMetaWrapped * meta, GstBuffer * buffer) -{ - meta->owner = NULL; -} - -static void -rsn_meta_wrapped_free (RsnMetaWrapped * meta, GstBuffer * buffer) -{ - gst_buffer_unref (meta->wrapped_buffer); - if (meta->owner) - gst_object_unref (meta->owner); -} - -const GstMetaInfo * -rsn_meta_wrapped_get_info (void) -{ - static const GstMetaInfo *meta_info = NULL; - - if (meta_info == NULL) { - meta_info = gst_meta_register ("RsnMetaWrapped", "RsnMetaWrapped", - sizeof (RsnMetaWrapped), - (GstMetaInitFunction) rsn_meta_wrapped_init, - (GstMetaFreeFunction) rsn_meta_wrapped_free, - (GstMetaTransformFunction) NULL, - (GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL); - } - return meta_info; -} diff --git a/ext/resindvd/rsnwrappedbuffer.h b/ext/resindvd/rsnwrappedbuffer.h deleted file mode 100644 index 3c0afe21f..000000000 --- a/ext/resindvd/rsnwrappedbuffer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 Jan Schmidt - * - * 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 __RSN_WRAPPERBUFFER_H__ -#define __RSN_WRAPPERBUFFER_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _RsnMetaWrapped RsnMetaWrapped; - -struct _RsnMetaWrapped { - GstMeta meta; - GstBuffer *wrapped_buffer; - - GstElement *owner; -}; - -GstBuffer *rsn_wrapped_buffer_new (GstBuffer *buf_to_wrap, GstElement *owner); - -GstBuffer *rsn_meta_wrapped_unwrap_and_unref (GstBuffer *wrap_buf, RsnMetaWrapped *meta); - -void rsn_meta_wrapped_set_owner (RsnMetaWrapped *meta, GstElement *owner); - -const GstMetaInfo * rsn_meta_wrapped_get_info (void); - -#define RSN_META_WRAPPED_GET(buf) ((RsnMetaWrapped *)gst_buffer_get_meta(buf,rsn_meta_wrapped_get_info())) -#define RSN_META_WRAPPED_ADD(buf) ((RsnMetaWrapped *)gst_buffer_add_meta(buf,rsn_meta_wrapped_get_info(),NULL)) - -G_END_DECLS - -#endif -- cgit v1.2.1