gst-indent
[platform/upstream/gst-plugins-good.git] / gst / avi / gstavidemux.h
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 #ifndef __GST_AVI_DEMUX_H__
21 #define __GST_AVI_DEMUX_H__
22
23 #include <gst/gst.h>
24
25 #include "gst/riff/riff-ids.h"
26 #include "gst/riff/riff-read.h"
27
28 G_BEGIN_DECLS
29 #define GST_TYPE_AVI_DEMUX \
30   (gst_avi_demux_get_type ())
31 #define GST_AVI_DEMUX(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_AVI_DEMUX, GstAviDemux))
33 #define GST_AVI_DEMUX_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_AVI_DEMUX, GstAviDemux))
35 #define GST_IS_AVI_DEMUX(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_AVI_DEMUX))
37 #define GST_IS_AVI_DEMUX_CLASS(obj) \
38   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_AVI_DEMUX))
39 #define GST_AVI_DEMUX_MAX_STREAMS       16
40 #define CHUNKID_TO_STREAMNR(chunkid) \
41   ((((chunkid) & 0xff) - '0') * 10 + \
42    (((chunkid) >> 8) & 0xff) - '0')
43     typedef struct
44 {
45   gint index_nr;
46   gint stream_nr;
47   guint64 ts;
48   guint32 flags;
49   guint32 offset;
50   gint size;
51   guint64 bytes_before;
52   guint32 frames_before;
53 } gst_avi_index_entry;
54
55 typedef struct
56 {
57   /* index of this streamcontext */
58   guint num;
59
60   /* pad, strh */
61   GstPad *pad;
62   GstCaps *caps;
63   gst_riff_strh *strh;
64
65   /* current position (byte, frame, time) */
66   guint current_frame;
67   guint64 current_byte;
68   gint current_entry;
69
70   /* delay in time (init_frames) */
71   guint64 delay;
72
73   /* stream length */
74   guint64 total_bytes;
75   guint32 total_frames;
76
77   guint32 skip;
78 } avi_stream_context;
79
80 typedef enum
81 {
82   GST_AVI_DEMUX_START,
83   GST_AVI_DEMUX_HEADER,
84   GST_AVI_DEMUX_MOVI,
85 } GstAviDemuxState;
86
87 typedef struct _GstAviDemux
88 {
89   GstRiffRead parent;
90
91   /* pads */
92   GstPad *sinkpad;
93
94   /* AVI decoding state */
95   GstAviDemuxState state;
96   guint level_up;
97
98   /* index */
99   gst_avi_index_entry *index_entries;
100   guint index_size;
101   guint64 index_offset;
102
103   /* streams */
104   guint num_streams;
105   guint num_v_streams;
106   guint num_a_streams;
107   avi_stream_context stream[GST_AVI_DEMUX_MAX_STREAMS];
108
109   /* some stream info for length */
110   guint32 us_per_frame;
111   guint32 num_frames;
112
113   /* seeking */
114   guint64 seek_offset;
115   guint64 last_seek;
116
117   /* info */
118   GstCaps *streaminfo;
119 } GstAviDemux;
120
121 typedef struct _GstAviDemuxClass
122 {
123   GstRiffReadClass parent_class;
124 } GstAviDemuxClass;
125
126 GType gst_avi_demux_get_type (void);
127
128 G_END_DECLS
129 #endif /* __GST_AVI_DEMUX_H__ */