1 /* ASF muxer plugin for GStreamer
2 * Copyright (C) 2009 Thiago Santos <thiagoss@embedded.ufcg.edu.br>
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., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #ifndef __GST_ASF_MUX_H__
22 #define __GST_ASF_MUX_H__
26 #include <gst/base/gstcollectpads.h>
27 #include <gst/riff/riff-media.h>
29 #include "gstasfobjects.h"
32 #define GST_TYPE_ASF_MUX \
33 (gst_asf_mux_get_type())
34 #define GST_ASF_MUX(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASF_MUX,GstAsfMux))
36 #define GST_ASF_MUX_CLASS(klass) \
37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASF_MUX,GstAsfMuxClass))
38 #define GST_IS_ASF_MUX(obj) \
39 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASF_MUX))
40 #define GST_IS_ASF_MUX_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASF_MUX))
42 #define GST_ASF_MUX_CAST(obj) ((GstAsfMux*)(obj))
43 typedef struct _GstAsfMux GstAsfMux;
44 typedef struct _GstAsfMuxClass GstAsfMuxClass;
45 typedef struct _GstAsfPad GstAsfPad;
46 typedef struct _GstAsfAudioPad GstAsfAudioPad;
47 typedef struct _GstAsfVideoPad GstAsfVideoPad;
48 typedef enum _GstAsfMuxState GstAsfMuxState;
52 GST_ASF_MUX_STATE_NONE,
53 GST_ASF_MUX_STATE_HEADERS,
54 GST_ASF_MUX_STATE_DATA,
60 GstCollectData collect;
64 guint8 media_object_number;
67 GstClockTime play_duration;
68 GstClockTime first_ts;
70 GstBuffer *codec_data;
72 /* stream only metadata */
76 struct _GstAsfAudioPad
80 gst_riff_strf_auds audioinfo;
83 struct _GstAsfVideoPad
87 gst_riff_strf_vids vidinfo;
89 /* Simple Index Entries */
91 gboolean has_keyframe; /* if we have received one at least */
92 guint32 last_keyframe_packet;
93 guint16 last_keyframe_packet_count;
94 guint16 max_keyframe_packet_count;
95 GstClockTime next_index_time;
96 guint64 time_interval;
103 /* output stream state */
104 GstAsfMuxState state;
106 /* counter to assign stream numbers */
107 guint8 stream_number;
109 /* counting variables */
111 guint64 data_object_size;
112 guint64 total_data_packets;
115 * data object size field position
116 * needed for updating when finishing the file
118 guint64 data_object_position;
119 guint64 file_properties_object_position;
121 /* payloads still to be sent in a packet */
122 guint32 payload_data_size;
123 guint32 payload_parsing_info_size;
129 guint32 prop_packet_size;
130 guint64 prop_preroll;
131 gboolean prop_merge_stream_tags;
132 guint64 prop_padding;
133 gboolean prop_streamable;
135 /* same as properties, but those are stored here to be
136 * used without modification while muxing a single file */
138 guint64 preroll; /* milliseconds */
139 gboolean merge_stream_tags;
141 GstClockTime first_ts;
146 GstCollectPads *collect;
149 struct _GstAsfMuxClass
151 GstElementClass parent_class;
154 GType gst_asf_mux_get_type (void);
155 GST_ELEMENT_REGISTER_DECLARE (asfmux);
158 #endif /* __GST_ASF_MUX_H__ */