2 * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
3 * Rosfran Borges <rosfran.borges@indt.org.br>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __GST_NUV_DEMUX_H__
22 #define __GST_NUV_DEMUX_H__
26 #include <gst/base/gstadapter.h>
30 #define GST_TYPE_NUV_DEMUX \
31 (gst_nuv_demux_get_type ())
32 #define GST_NUV_DEMUX(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux))
34 #define GST_NUV_DEMUX_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass))
36 #define GST_IS_NUV_DEMUX(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX))
38 #define GST_IS_NUV_DEMUX_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
41 #define DEMUX_INDEX_SIZE_MAX (100000)
43 /* Indexes (timecodes/offsets) conversion structures */
49 } nuv_demux_index_entry;
56 nuv_demux_index_entry idx[DEMUX_INDEX_SIZE_MAX];
62 gchar id[12]; /* "NuppelVideo\0" or "MythTVVideo\0" */
63 gchar version[5]; /* "x.xx\0" */
68 gint i_height_desired;
70 gchar i_mode; /* P progressive, I interlaced */
72 gdouble d_aspect; /* 1.0 squared pixel */
75 gint i_video_blocks; /* 0 no video, -1 unknown */
79 gint i_keyframe_distance;
85 gchar i_type; /* A: audio, V: video, S: sync; T: test
86 R: Seekpoint (string:RTjjjjjjjj)
87 D: Extra data for codec */
88 gchar i_compression; /* V: 0 uncompressed
93 A: 0 uncompressed (44100 1-bits, 2ch)
101 S: B audio and vdeo sync point
102 A audio sync info (timecode == effective
104 V next video sync (timecode == next video
106 S audio,video,text correlation */
107 gchar i_keyframe; /* 0 keyframe, else no no key frame */
108 guint8 i_filters; /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
109 0x02: gauss 5 pixel (8,1,1,1,1)/12
110 0x04: cartoon filter */
112 gint32 i_timecode; /* ms */
114 gint i_length; /* V,A,T: length of following data
115 S: length of packet correl */
118 /* FIXME Not sure of this one */
125 gint i_audio_sample_rate;
126 gint i_audio_bits_per_sample;
127 gint i_audio_channels;
128 gint i_audio_compression_ratio;
129 gint i_audio_quality;
130 gint i_rtjpeg_quality;
131 gint i_rtjpeg_luma_filter;
132 gint i_rtjpeg_chroma_filter;
136 gint i_lavc_maxqdiff;
137 gint64 i_seekable_offset;
138 gint64 i_keyframe_adjust_offset;
140 } nuv_extended_header;
144 GST_NUV_DEMUX_HEADER_DATA,
145 GST_NUV_DEMUX_EXTRA_DATA,
146 GST_NUV_DEMUX_MPEG_DATA,
147 GST_NUV_DEMUX_EXTEND_HEADER,
148 GST_NUV_DEMUX_EXTEND_HEADER_DATA,
149 GST_NUV_DEMUX_FRAME_HEADER,
151 GST_NUV_DEMUX_INVALID_DATA
154 typedef struct _GstNuvDemux {
162 GstPad *src_video_pad;
163 GstPad *src_audio_pad;
165 /* NUV decoding state */
166 GstNuvDemuxState state;
172 guint64 mpeg_data_size;
173 GstBuffer *mpeg_buffer;
176 nuv_extended_header *eh;
177 nuv_frame_header *fh;
180 nuv_demux_index *index_entries;
182 guint64 index_offset;
185 /* FIXME: change these fields to private struct */
186 /* first data buffer received, should sent new_segment */
187 gboolean new_audio_segment;
188 gboolean new_video_segment;
191 typedef struct _GstNuvDemuxClass {
192 GstElementClass parent_class;
195 GType gst_nuv_demux_get_type (void);
199 #endif /* __GST_NUV_DEMUX_H__ */