• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #ifndef __GST_FFMPEGAUDDEC_H__
20 #define __GST_FFMPEGAUDDEC_H__
21 
22 #include <glib.h>
23 
24 G_BEGIN_DECLS
25 
26 #include <gst/gst.h>
27 #include <gst/audio/audio.h>
28 #include <libavcodec/avcodec.h>
29 
30 typedef struct _GstFFMpegAudDec GstFFMpegAudDec;
31 struct _GstFFMpegAudDec
32 {
33   GstAudioDecoder parent;
34 
35   /* decoding */
36   AVCodecContext *context;
37   gboolean opened;
38 
39   AVFrame *frame;
40 
41   guint8 *padded;
42   gint padded_size;
43 
44   /* prevent reopening the decoder on GST_EVENT_CAPS when caps are same as last time. */
45   GstCaps *last_caps;
46 
47   /* current output format */
48   GstAudioInfo info;
49   GstAudioChannelPosition ffmpeg_layout[64];
50   gboolean needs_reorder;
51 };
52 
53 typedef struct _GstFFMpegAudDecClass GstFFMpegAudDecClass;
54 
55 struct _GstFFMpegAudDecClass
56 {
57   GstAudioDecoderClass parent_class;
58 
59   AVCodec *in_plugin;
60   GstPadTemplate *srctempl, *sinktempl;
61 };
62 
63 #define GST_TYPE_FFMPEGDEC \
64   (gst_ffmpegauddec_get_type())
65 #define GST_FFMPEGDEC(obj) \
66   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegAudDec))
67 #define GST_FFMPEGAUDDEC_CLASS(klass) \
68   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegAudDecClass))
69 #define GST_IS_FFMPEGDEC(obj) \
70   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
71 #define GST_IS_FFMPEGAUDDEC_CLASS(klass) \
72   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
73 
74 G_END_DECLS
75 
76 #endif
77