1 /* AVI muxer plugin for GStreamer
2 * Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
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.
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.
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.
21 #ifndef __GST_AVI_MUX_H__
22 #define __GST_AVI_MUX_H__
26 #include <gst/base/gstcollectpads.h>
27 #include <gst/riff/riff-ids.h>
32 #define GST_TYPE_AVI_MUX \
33 (gst_avi_mux_get_type())
34 #define GST_AVI_MUX(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVI_MUX,GstAviMux))
36 #define GST_AVI_MUX_CLASS(klass) \
37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVI_MUX,GstAviMuxClass))
38 #define GST_IS_AVI_MUX(obj) \
39 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVI_MUX))
40 #define GST_IS_AVI_MUX_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVI_MUX))
43 #define GST_AVI_INDEX_OF_INDEXES 0
44 #define GST_AVI_INDEX_OF_CHUNKS 1
46 /* this allows indexing up to 64GB avi file */
47 #define GST_AVI_SUPERINDEX_COUNT 32
50 #define GST_AVI_MAX_SIZE 0x40000000
52 typedef struct _gst_avi_superindex_entry {
56 } gst_avi_superindex_entry;
58 typedef struct _gst_riff_strh_full {
60 /* rcFrame, RECT structure (struct of 4 shorts) */
67 typedef struct _GstAviPad GstAviPad;
68 typedef struct _GstAviMux GstAviMux;
69 typedef struct _GstAviMuxClass GstAviMuxClass;
71 typedef GstFlowReturn (*GstAviPadHook) (GstAviMux * avi, GstAviPad * avipad,
75 /* do not extend, link to it */
76 /* is NULL if original sink request pad has been removed */
77 GstCollectData *collect;
89 /* odml super indexes */
90 gst_avi_superindex_entry idx[GST_AVI_SUPERINDEX_COUNT];
94 /* stream specific hook */
98 typedef struct _GstAviVideoPad {
102 gst_riff_strf_vids vids;
104 GstBuffer *vids_codec_data;
105 /* ODML video properties */
108 GstBuffer *prepend_buffer;
112 typedef struct _GstAviAudioPad {
116 gst_riff_strf_auds auds;
117 /* audio info for bps calculation */
121 /* counts the number of samples to put in indx chunk
122 * useful for raw audio where usually there are more than
123 * 1 sample in each GstBuffer */
127 GstBuffer *auds_codec_data;
130 typedef struct _GstAviCollectData {
131 /* extend the CollectData */
132 GstCollectData collect;
142 /* sinkpads, video first */
144 /* video restricted to 1 pad */
145 guint video_pads, audio_pads;
146 GstCollectPads *collect;
147 GstPadEventFunction collect_event;
150 /* still some single stream video data in mux struct */
151 gst_riff_avih avi_hdr;
152 /* total number of (video) frames */
153 guint32 total_frames;
154 /* amount of total data (bytes) */
156 /* amount of data (bytes) in the AVI/AVIX block;
157 * actually the movi list, so counted from and including the movi tag */
158 guint32 data_size, datax_size;
159 /* num (video) frames in the AVI/AVIX block */
160 guint32 num_frames, numx_frames;
161 /* size of hdrl list, including tag as usual */
163 /* total size of extra codec data */
164 guint32 codec_data_size;
166 gboolean write_header;
170 GstTagList *tags_snap;
172 /* information about the AVI index ('idx') */
173 gst_riff_index_entry *idx;
174 gint idx_index, idx_count;
175 /* offset of *chunk* (relative to a base offset); entered in the index */
177 /* size of idx1 chunk (including! chunk header and size bytes) */
180 /* are we a big file already? */
184 /* whether to use "large AVI files" or just stick to small indexed files */
185 gboolean enable_large_avi;
188 struct _GstAviMuxClass {
189 GstElementClass parent_class;
192 GType gst_avi_mux_get_type(void);
197 #endif /* __GST_AVI_MUX_H__ */