2 * Copyright (c) 2015, Collabora Ltd.
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this
11 * list of conditions and the following disclaimer in the documentation and/or other
12 * materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
29 #include "sctpreceivemeta.h"
31 static gboolean gst_sctp_receive_meta_init (GstMeta * meta, gpointer params,
33 static gboolean gst_sctp_receive_meta_transform (GstBuffer * transbuf,
34 GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data);
37 gst_sctp_receive_meta_api_get_type (void)
39 static const gchar *tags[] = { NULL };
40 static volatile GType type;
41 if (g_once_init_enter (&type)) {
42 GType _type = gst_meta_api_type_register ("GstSctpReceiveMetaAPI", tags);
43 g_once_init_leave (&type, _type);
49 gst_sctp_receive_meta_get_info (void)
51 static const GstMetaInfo *gst_sctp_receive_meta_info = NULL;
53 if (g_once_init_enter (&gst_sctp_receive_meta_info)) {
54 const GstMetaInfo *meta = gst_meta_register (GST_SCTP_RECEIVE_META_API_TYPE,
56 sizeof (GstSctpReceiveMeta),
57 gst_sctp_receive_meta_init,
58 (GstMetaFreeFunction) NULL,
59 gst_sctp_receive_meta_transform);
60 g_once_init_leave (&gst_sctp_receive_meta_info, meta);
62 return gst_sctp_receive_meta_info;
66 gst_sctp_receive_meta_init (GstMeta * meta, gpointer params, GstBuffer * buffer)
68 GstSctpReceiveMeta *gst_sctp_receive_meta = (GstSctpReceiveMeta *) meta;
69 gst_sctp_receive_meta->ppid = 0;
74 gst_sctp_receive_meta_transform (GstBuffer * transbuf, GstMeta * meta,
75 GstBuffer * buffer, GQuark type, gpointer data)
77 GstSctpReceiveMeta *gst_sctp_receive_meta = (GstSctpReceiveMeta *) meta;
78 gst_sctp_buffer_add_receive_meta (transbuf, gst_sctp_receive_meta->ppid);
83 gst_sctp_buffer_add_receive_meta (GstBuffer * buffer, guint32 ppid)
85 GstSctpReceiveMeta *gst_sctp_receive_meta = NULL;
87 g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
88 gst_sctp_receive_meta =
89 (GstSctpReceiveMeta *) gst_buffer_add_meta (buffer,
90 GST_SCTP_RECEIVE_META_INFO, NULL);
91 gst_sctp_receive_meta->ppid = ppid;
92 return gst_sctp_receive_meta;