melunko@47: /* GStreamer melunko@47: * Copyright (C) <2006> Renato Araujo Oliveira Filho melunko@47: * Rosfran Borges melunko@47: * melunko@47: * This library is free software; you can redistribute it and/or melunko@47: * modify it under the terms of the GNU Library General Public melunko@47: * License as published by the Free Software Foundation; either melunko@47: * version 2 of the License, or (at your option) any later version. melunko@47: * melunko@47: * This library is distributed in the hope that it will be useful, melunko@47: * but WITHOUT ANY WARRANTY; without even the implied warranty of melunko@47: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU melunko@47: * Library General Public License for more details. melunko@47: * melunko@47: * You should have received a copy of the GNU Library General Public melunko@47: * License along with this library; if not, write to the melunko@47: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, melunko@47: * Boston, MA 02111-1307, USA. melunko@47: */ melunko@47: melunko@47: #ifndef __GST_NUV_DEMUX_H__ melunko@47: #define __GST_NUV_DEMUX_H__ melunko@47: melunko@47: #include melunko@47: melunko@47: #include melunko@47: melunko@47: G_BEGIN_DECLS melunko@47: melunko@47: #define GST_TYPE_NUV_DEMUX \ melunko@47: (gst_nuv_demux_get_type ()) melunko@47: #define GST_NUV_DEMUX(obj) \ melunko@47: (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux)) melunko@47: #define GST_NUV_DEMUX_CLASS(klass) \ melunko@47: (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass)) melunko@47: #define GST_IS_NUV_DEMUX(obj) \ melunko@47: (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX)) melunko@47: #define GST_IS_NUV_DEMUX_CLASS(klass) \ melunko@47: (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX)) melunko@47: rosfran@56: #define DEMUX_INDEX_SIZE_MAX (100000) rosfran@56: rosfran@56: /* Indexes (timecodes/offsets) conversion structures */ rosfran@56: typedef struct rosfran@56: { rosfran@56: gint64 i_time; rosfran@56: gint64 i_offset; rosfran@56: rosfran@56: } nuv_demux_index_entry; rosfran@56: rosfran@56: typedef struct rosfran@56: { rosfran@56: gint i_idx; rosfran@56: gint i_idx_max; rosfran@56: rosfran@57: nuv_demux_index_entry idx[DEMUX_INDEX_SIZE_MAX]; rosfran@56: } nuv_demux_index; melunko@47: melunko@47: /* */ melunko@47: typedef struct melunko@47: { melunko@47: gchar id[12]; /* "NuppelVideo\0" or "MythTVVideo\0" */ melunko@47: gchar version[5]; /* "x.xx\0" */ melunko@47: melunko@47: gint i_width; melunko@47: gint i_height; melunko@47: gint i_width_desired; melunko@47: gint i_height_desired; melunko@47: melunko@47: gchar i_mode; /* P progressive, I interlaced */ melunko@47: melunko@47: gdouble d_aspect; /* 1.0 squared pixel */ melunko@47: gdouble d_fps; melunko@47: melunko@47: gint i_video_blocks; /* 0 no video, -1 unknown */ melunko@47: gint i_audio_blocks; melunko@47: gint i_text_blocks; melunko@47: melunko@47: gint i_keyframe_distance; melunko@47: melunko@47: } nuv_header; melunko@47: melunko@47: typedef struct melunko@47: { melunko@47: gchar i_type; /* A: audio, V: video, S: sync; T: test melunko@47: R: Seekpoint (string:RTjjjjjjjj) melunko@47: D: Extra data for codec */ melunko@47: gchar i_compression; /* V: 0 uncompressed melunko@47: 1 RTJpeg melunko@47: 2 RTJpeg+lzo melunko@47: N black frame melunko@47: L copy last melunko@47: A: 0 uncompressed (44100 1-bits, 2ch) melunko@47: 1 lzo melunko@47: 2 layer 2 melunko@47: 3 layer 3 melunko@47: F flac melunko@47: S shorten melunko@47: N null frame loudless melunko@47: L copy last melunko@47: S: B audio and vdeo sync point melunko@47: A audio sync info (timecode == effective melunko@47: dsp frequency*100) melunko@47: V next video sync (timecode == next video melunko@47: frame num) melunko@47: S audio,video,text correlation */ melunko@47: gchar i_keyframe; /* 0 keyframe, else no no key frame */ melunko@47: guint8 i_filters; /* 0x01: gauss 5 pixel (8,2,2,2,2)/16 melunko@47: 0x02: gauss 5 pixel (8,1,1,1,1)/12 melunko@47: 0x04: cartoon filter */ melunko@47: rosfran@56: gint32 i_timecode; /* ms */ melunko@47: rosfran@56: gint i_length; /* V,A,T: length of following data melunko@47: S: length of packet correl */ melunko@47: } nuv_frame_header; melunko@47: melunko@47: /* FIXME Not sure of this one */ melunko@47: typedef struct melunko@47: { melunko@47: gint i_version; melunko@47: guint32 i_video_fcc; melunko@47: melunko@47: guint32 i_audio_fcc; melunko@47: gint i_audio_sample_rate; melunko@47: gint i_audio_bits_per_sample; melunko@47: gint i_audio_channels; melunko@47: gint i_audio_compression_ratio; melunko@47: gint i_audio_quality; melunko@47: gint i_rtjpeg_quality; melunko@47: gint i_rtjpeg_luma_filter; melunko@47: gint i_rtjpeg_chroma_filter; melunko@47: gint i_lavc_bitrate; melunko@47: gint i_lavc_qmin; melunko@47: gint i_lavc_qmax; melunko@47: gint i_lavc_maxqdiff; melunko@47: gint64 i_seekable_offset; melunko@47: gint64 i_keyframe_adjust_offset; melunko@47: melunko@47: } nuv_extended_header; melunko@47: melunko@47: typedef enum { melunko@47: GST_NUV_DEMUX_START, melunko@47: GST_NUV_DEMUX_HEADER_DATA, melunko@47: GST_NUV_DEMUX_EXTRA_DATA, melunko@47: GST_NUV_DEMUX_MPEG_DATA, melunko@47: GST_NUV_DEMUX_EXTEND_HEADER, melunko@47: GST_NUV_DEMUX_EXTEND_HEADER_DATA, melunko@47: GST_NUV_DEMUX_FRAME_HEADER, melunko@47: GST_NUV_DEMUX_MOVI, melunko@47: GST_NUV_DEMUX_INVALID_DATA melunko@47: } GstNuvDemuxState; melunko@47: melunko@47: typedef struct _GstNuvDemux { melunko@47: GstElement parent; melunko@47: melunko@47: guint mode; melunko@47: GstAdapter *adapter; melunko@47: guint64 video_offset; melunko@47: guint64 audio_offset; melunko@47: melunko@47: /* pads */ rosfran@57: melunko@47: GstPad *sinkpad; melunko@47: GstPad *src_video_pad; melunko@47: GstPad *src_audio_pad; melunko@47: gboolean first_video; melunko@47: gboolean first_audio; melunko@47: melunko@47: /* NUV decoding state */ melunko@47: GstNuvDemuxState state; melunko@47: guint64 offset; melunko@47: melunko@47: /* Mpeg ExtraData */ melunko@47: guint64 mpeg_data_size; melunko@47: GstBuffer *mpeg_buffer; melunko@47: melunko@47: nuv_header *h; melunko@47: nuv_extended_header *eh; melunko@47: nuv_frame_header *fh; rosfran@56: rosfran@56: /* index */ rosfran@56: nuv_demux_index *index_entries; rosfran@56: guint index_size; rosfran@56: guint64 index_offset; rosfran@56: guint current_entry; rosfran@56: melunko@47: } GstNuvDemux; melunko@47: melunko@47: typedef struct _GstNuvDemuxClass { melunko@47: GstElementClass parent_class; melunko@47: } GstNuvDemuxClass; melunko@47: melunko@47: GType gst_nuv_demux_get_type (void); melunko@47: melunko@47: G_END_DECLS melunko@47: melunko@47: #endif /* __GST_NUV_DEMUX_H__ */