1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h Thu Nov 09 20:22:45 2006 +0000
1.3 @@ -0,0 +1,198 @@
1.4 +/* GStreamer
1.5 + * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
1.6 + * Rosfran Borges <rosfran.borges@indt.org.br>
1.7 + *
1.8 + * This library is free software; you can redistribute it and/or
1.9 + * modify it under the terms of the GNU Library General Public
1.10 + * License as published by the Free Software Foundation; either
1.11 + * version 2 of the License, or (at your option) any later version.
1.12 + *
1.13 + * This library is distributed in the hope that it will be useful,
1.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.16 + * Library General Public License for more details.
1.17 + *
1.18 + * You should have received a copy of the GNU Library General Public
1.19 + * License along with this library; if not, write to the
1.20 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.21 + * Boston, MA 02111-1307, USA.
1.22 + */
1.23 +
1.24 +#ifndef __GST_NUV_DEMUX_H__
1.25 +#define __GST_NUV_DEMUX_H__
1.26 +
1.27 +#include <gst/gst.h>
1.28 +
1.29 +#include <gst/base/gstadapter.h>
1.30 +
1.31 +G_BEGIN_DECLS
1.32 +
1.33 +#define GST_TYPE_NUV_DEMUX \
1.34 + (gst_nuv_demux_get_type ())
1.35 +#define GST_NUV_DEMUX(obj) \
1.36 + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux))
1.37 +#define GST_NUV_DEMUX_CLASS(klass) \
1.38 + (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass))
1.39 +#define GST_IS_NUV_DEMUX(obj) \
1.40 + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX))
1.41 +#define GST_IS_NUV_DEMUX_CLASS(klass) \
1.42 + (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
1.43 +
1.44 +#define DEMUX_INDEX_SIZE_MAX (100000)
1.45 +
1.46 +/* Indexes (timecodes/offsets) conversion structures */
1.47 +typedef struct
1.48 +{
1.49 + gint64 i_time;
1.50 + gint64 i_offset;
1.51 +
1.52 +} nuv_demux_index_entry;
1.53 +
1.54 +typedef struct
1.55 +{
1.56 + gint i_idx;
1.57 + gint i_idx_max;
1.58 +
1.59 + nuv_demux_index_entry idx[DEMUX_INDEX_SIZE_MAX];
1.60 +} nuv_demux_index;
1.61 +
1.62 +/* */
1.63 +typedef struct
1.64 +{
1.65 + gchar id[12]; /* "NuppelVideo\0" or "MythTVVideo\0" */
1.66 + gchar version[5]; /* "x.xx\0" */
1.67 +
1.68 + gint i_width;
1.69 + gint i_height;
1.70 + gint i_width_desired;
1.71 + gint i_height_desired;
1.72 +
1.73 + gchar i_mode; /* P progressive, I interlaced */
1.74 +
1.75 + gdouble d_aspect; /* 1.0 squared pixel */
1.76 + gdouble d_fps;
1.77 +
1.78 + gint i_video_blocks; /* 0 no video, -1 unknown */
1.79 + gint i_audio_blocks;
1.80 + gint i_text_blocks;
1.81 +
1.82 + gint i_keyframe_distance;
1.83 +
1.84 +} nuv_header;
1.85 +
1.86 +typedef struct
1.87 +{
1.88 + gchar i_type; /* A: audio, V: video, S: sync; T: test
1.89 + R: Seekpoint (string:RTjjjjjjjj)
1.90 + D: Extra data for codec */
1.91 + gchar i_compression; /* V: 0 uncompressed
1.92 + 1 RTJpeg
1.93 + 2 RTJpeg+lzo
1.94 + N black frame
1.95 + L copy last
1.96 + A: 0 uncompressed (44100 1-bits, 2ch)
1.97 + 1 lzo
1.98 + 2 layer 2
1.99 + 3 layer 3
1.100 + F flac
1.101 + S shorten
1.102 + N null frame loudless
1.103 + L copy last
1.104 + S: B audio and vdeo sync point
1.105 + A audio sync info (timecode == effective
1.106 + dsp frequency*100)
1.107 + V next video sync (timecode == next video
1.108 + frame num)
1.109 + S audio,video,text correlation */
1.110 + gchar i_keyframe; /* 0 keyframe, else no no key frame */
1.111 + guint8 i_filters; /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
1.112 + 0x02: gauss 5 pixel (8,1,1,1,1)/12
1.113 + 0x04: cartoon filter */
1.114 +
1.115 + gint32 i_timecode; /* ms */
1.116 +
1.117 + gint i_length; /* V,A,T: length of following data
1.118 + S: length of packet correl */
1.119 +} nuv_frame_header;
1.120 +
1.121 +/* FIXME Not sure of this one */
1.122 +typedef struct
1.123 +{
1.124 + gint i_version;
1.125 + guint32 i_video_fcc;
1.126 +
1.127 + guint32 i_audio_fcc;
1.128 + gint i_audio_sample_rate;
1.129 + gint i_audio_bits_per_sample;
1.130 + gint i_audio_channels;
1.131 + gint i_audio_compression_ratio;
1.132 + gint i_audio_quality;
1.133 + gint i_rtjpeg_quality;
1.134 + gint i_rtjpeg_luma_filter;
1.135 + gint i_rtjpeg_chroma_filter;
1.136 + gint i_lavc_bitrate;
1.137 + gint i_lavc_qmin;
1.138 + gint i_lavc_qmax;
1.139 + gint i_lavc_maxqdiff;
1.140 + gint64 i_seekable_offset;
1.141 + gint64 i_keyframe_adjust_offset;
1.142 +
1.143 +} nuv_extended_header;
1.144 +
1.145 +typedef enum {
1.146 + GST_NUV_DEMUX_START,
1.147 + GST_NUV_DEMUX_HEADER_DATA,
1.148 + GST_NUV_DEMUX_EXTRA_DATA,
1.149 + GST_NUV_DEMUX_MPEG_DATA,
1.150 + GST_NUV_DEMUX_EXTEND_HEADER,
1.151 + GST_NUV_DEMUX_EXTEND_HEADER_DATA,
1.152 + GST_NUV_DEMUX_FRAME_HEADER,
1.153 + GST_NUV_DEMUX_MOVI,
1.154 + GST_NUV_DEMUX_INVALID_DATA
1.155 +} GstNuvDemuxState;
1.156 +
1.157 +typedef struct _GstNuvDemux {
1.158 + GstElement parent;
1.159 +
1.160 + guint mode;
1.161 + GstAdapter *adapter;
1.162 + guint64 video_offset;
1.163 + guint64 audio_offset;
1.164 +
1.165 + /* pads */
1.166 +
1.167 + GstPad *sinkpad;
1.168 + GstPad *src_video_pad;
1.169 + GstPad *src_audio_pad;
1.170 + gboolean first_video;
1.171 + gboolean first_audio;
1.172 +
1.173 + /* NUV decoding state */
1.174 + GstNuvDemuxState state;
1.175 + guint64 offset;
1.176 +
1.177 + /* Mpeg ExtraData */
1.178 + guint64 mpeg_data_size;
1.179 + GstBuffer *mpeg_buffer;
1.180 +
1.181 + nuv_header *h;
1.182 + nuv_extended_header *eh;
1.183 + nuv_frame_header *fh;
1.184 +
1.185 + /* index */
1.186 + nuv_demux_index *index_entries;
1.187 + guint index_size;
1.188 + guint64 index_offset;
1.189 + guint current_entry;
1.190 +
1.191 +} GstNuvDemux;
1.192 +
1.193 +typedef struct _GstNuvDemuxClass {
1.194 + GstElementClass parent_class;
1.195 +} GstNuvDemuxClass;
1.196 +
1.197 +GType gst_nuv_demux_get_type (void);
1.198 +
1.199 +G_END_DECLS
1.200 +
1.201 +#endif /* __GST_NUV_DEMUX_H__ */