Remove unused variables in _class_init
[platform/upstream/gstreamer.git] / gst / rtp / gstrtpsirendepay.c
1 /*
2  * Siren Depayloader Gst Element
3  *
4  *   @author: Youness Alaoui <kakaroto@kakaroto.homelinux.net>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #  include "config.h"
24 #endif
25
26 #include <string.h>
27 #include <stdlib.h>
28 #include <gst/rtp/gstrtpbuffer.h>
29 #include "gstrtpsirendepay.h"
30
31 /* elementfactory information */
32 static const GstElementDetails gst_rtp_siren_depay_details =
33 GST_ELEMENT_DETAILS ("RTP Siren packet depayloader",
34     "Codec/Depayloader/Network",
35     "Extracts Siren audio from RTP packets",
36     "Philippe Kalaf <philippe.kalaf@collabora.co.uk>");
37
38
39 static GstStaticPadTemplate gst_rtp_siren_depay_sink_template =
40 GST_STATIC_PAD_TEMPLATE ("sink",
41     GST_PAD_SINK,
42     GST_PAD_ALWAYS,
43     GST_STATIC_CAPS ("application/x-rtp, "
44         "media = (string) \"audio\", "
45         "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
46         "clock-rate = (int) 16000, "
47         "encoding-name = (string) \"SIREN\", " "dct-length = (int) 320")
48     );
49
50 static GstStaticPadTemplate gst_rtp_siren_depay_src_template =
51 GST_STATIC_PAD_TEMPLATE ("src",
52     GST_PAD_SRC,
53     GST_PAD_ALWAYS,
54     GST_STATIC_CAPS ("audio/x-siren, " "dct-length = (int) 320")
55     );
56
57 static GstBuffer *gst_rtp_siren_depay_process (GstBaseRTPDepayload * depayload,
58     GstBuffer * buf);
59 static gboolean gst_rtp_siren_depay_setcaps (GstBaseRTPDepayload * depayload,
60     GstCaps * caps);
61
62 GST_BOILERPLATE (GstRTPSirenDepay, gst_rtp_siren_depay, GstBaseRTPDepayload,
63     GST_TYPE_BASE_RTP_DEPAYLOAD);
64
65 static void
66 gst_rtp_siren_depay_base_init (gpointer klass)
67 {
68   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
69
70   gst_element_class_add_pad_template (element_class,
71       gst_static_pad_template_get (&gst_rtp_siren_depay_src_template));
72   gst_element_class_add_pad_template (element_class,
73       gst_static_pad_template_get (&gst_rtp_siren_depay_sink_template));
74   gst_element_class_set_details (element_class, &gst_rtp_siren_depay_details);
75 }
76
77 static void
78 gst_rtp_siren_depay_class_init (GstRTPSirenDepayClass * klass)
79 {
80   GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
81
82   gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
83
84   gstbasertpdepayload_class->process = gst_rtp_siren_depay_process;
85   gstbasertpdepayload_class->set_caps = gst_rtp_siren_depay_setcaps;
86 }
87
88 static void
89 gst_rtp_siren_depay_init (GstRTPSirenDepay * rtpsirendepay,
90     GstRTPSirenDepayClass * klass)
91 {
92
93 }
94
95 static gboolean
96 gst_rtp_siren_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
97 {
98   GstCaps *srccaps;
99   gboolean ret;
100
101   srccaps = gst_caps_new_simple ("audio/x-siren",
102       "dct-length", G_TYPE_INT, 320, NULL);
103   ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
104
105   GST_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret);
106   gst_caps_unref (srccaps);
107
108   /* always fixed clock rate of 16000 */
109   depayload->clock_rate = 16000;
110
111   return ret;
112 }
113
114 static GstBuffer *
115 gst_rtp_siren_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
116 {
117   GstBuffer *outbuf;
118
119   outbuf = gst_rtp_buffer_get_payload_buffer (buf);
120
121   return outbuf;
122 }
123
124 gboolean
125 gst_rtp_siren_depay_plugin_init (GstPlugin * plugin)
126 {
127   return gst_element_register (plugin, "rtpsirendepay",
128       GST_RANK_MARGINAL, GST_TYPE_RTP_SIREN_DEPAY);
129 }