~oah-dev/oah/gst-plugins-bad

« back to all changes in this revision

Viewing changes to gst/rtjpeg/gstrtjpegdec.c

  • Committer: Haakon Sporsheim
  • Date: 2009-03-12 13:52:03 UTC
  • Revision ID: haakon.sporsheim@tandberg.com-20090312135203-i5k294hgkushb0mt
Initial import of git repository: git://anongit.freedesktop.org/gstreamer/gst-plugins-bad (tag: RELEASE-0_10_10)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GStreamer
 
2
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Library General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Library General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Library General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
 
 
21
#ifdef HAVE_CONFIG_H
 
22
#include "config.h"
 
23
#endif
 
24
#include "gstrtjpegdec.h"
 
25
 
 
26
 
 
27
 
 
28
/* elementfactory information */
 
29
static const GstElementDetails gst_rtjpegdec_details =
 
30
GST_ELEMENT_DETAILS ("RTjpeg video decoder",
 
31
    "Codec/Decoder/Video",
 
32
    "Decodes video in RTjpeg format",
 
33
    "Erik Walthinsen <omega@cse.ogi.edu>");
 
34
 
 
35
/* GstRTJpegDec signals and args */
 
36
enum
 
37
{
 
38
  /* FILL ME */
 
39
  LAST_SIGNAL
 
40
};
 
41
 
 
42
enum
 
43
{
 
44
  ARG_0,
 
45
  ARG_QUALITY
 
46
};
 
47
 
 
48
 
 
49
static void gst_rtjpegdec_class_init (GstRTJpegDecClass * klass);
 
50
static void gst_rtjpegdec_base_init (GstRTJpegDecClass * klass);
 
51
static void gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec);
 
52
 
 
53
static void gst_rtjpegdec_chain (GstPad * pad, GstData * _data);
 
54
 
 
55
static GstElementClass *parent_class = NULL;
 
56
 
 
57
/*static guint gst_rtjpegdec_signals[LAST_SIGNAL] = { 0 }; */
 
58
 
 
59
GType
 
60
gst_rtjpegdec_get_type (void)
 
61
{
 
62
  static GType rtjpegdec_type = 0;
 
63
 
 
64
  if (!rtjpegdec_type) {
 
65
    static const GTypeInfo rtjpegdec_info = {
 
66
      sizeof (GstRTJpegDecClass),
 
67
      (GBaseInitFunc) gst_rtjpegdec_base_init,
 
68
      NULL,
 
69
      (GClassInitFunc) gst_rtjpegdec_class_init,
 
70
      NULL,
 
71
      NULL,
 
72
      sizeof (GstRTJpegDec),
 
73
      0,
 
74
      (GInstanceInitFunc) gst_rtjpegdec_init,
 
75
    };
 
76
 
 
77
    rtjpegdec_type =
 
78
        g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegDec",
 
79
        &rtjpegdec_info, 0);
 
80
  }
 
81
  return rtjpegdec_type;
 
82
}
 
83
 
 
84
static void
 
85
gst_rtjpegdec_base_init (GstRTJpegDecClass * klass)
 
86
{
 
87
  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
 
88
 
 
89
  gst_element_class_set_details (element_class, &gst_rtjpegdec_details);
 
90
}
 
91
 
 
92
static void
 
93
gst_rtjpegdec_class_init (GstRTJpegDecClass * klass)
 
94
{
 
95
  GstElementClass *gstelement_class;
 
96
 
 
97
  gstelement_class = (GstElementClass *) klass;
 
98
 
 
99
  parent_class = g_type_class_peek_parent (klass);
 
100
}
 
101
 
 
102
static void
 
103
gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec)
 
104
{
 
105
  rtjpegdec->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
 
106
  gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->sinkpad);
 
107
  gst_pad_set_chain_function (rtjpegdec->sinkpad, gst_rtjpegdec_chain);
 
108
  rtjpegdec->srcpad = gst_pad_new ("src", GST_PAD_SRC);
 
109
  gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->srcpad);
 
110
}
 
111
 
 
112
static void
 
113
gst_rtjpegdec_chain (GstPad * pad, GstData * _data)
 
114
{
 
115
  GstBuffer *buf = GST_BUFFER (_data);
 
116
  GstRTJpegDec *rtjpegdec;
 
117
  guchar *data;
 
118
  gulong size;
 
119
 
 
120
  g_return_if_fail (pad != NULL);
 
121
  g_return_if_fail (GST_IS_PAD (pad));
 
122
  g_return_if_fail (buf != NULL);
 
123
 
 
124
  rtjpegdec = GST_RTJPEGDEC (GST_OBJECT_PARENT (pad));
 
125
  data = GST_BUFFER_DATA (buf);
 
126
  size = GST_BUFFER_SIZE (buf);
 
127
 
 
128
  g_warning ("would be encoding frame here\n");
 
129
 
 
130
  gst_pad_push (rtjpegdec->srcpad, GST_DATA (buf));
 
131
}