gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.h
author renatofilho
Tue Nov 14 18:02:43 2006 +0000 (2006-11-14)
branchtrunk
changeset 85 7f6ea4639cb9
parent 84 8b867c828e89
child 88 2a70ed80ed1a
permissions -rw-r--r--
[svn r86] implemented query
melunko@47
     1
/* GStreamer
melunko@47
     2
 * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
melunko@47
     3
 *                      Rosfran Borges <rosfran.borges@indt.org.br>
melunko@47
     4
 *
melunko@47
     5
 * This library is free software; you can redistribute it and/or
melunko@47
     6
 * modify it under the terms of the GNU Library General Public
melunko@47
     7
 * License as published by the Free Software Foundation; either
melunko@47
     8
 * version 2 of the License, or (at your option) any later version.
melunko@47
     9
 *
melunko@47
    10
 * This library is distributed in the hope that it will be useful,
melunko@47
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
melunko@47
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
melunko@47
    13
 * Library General Public License for more details.
melunko@47
    14
 *
melunko@47
    15
 * You should have received a copy of the GNU Library General Public
melunko@47
    16
 * License along with this library; if not, write to the
melunko@47
    17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
melunko@47
    18
 * Boston, MA 02111-1307, USA.
melunko@47
    19
 */
melunko@47
    20
melunko@47
    21
#ifndef __GST_NUV_DEMUX_H__
melunko@47
    22
#define __GST_NUV_DEMUX_H__
melunko@47
    23
melunko@47
    24
#include <gst/gst.h>
melunko@47
    25
melunko@47
    26
#include <gst/base/gstadapter.h>
melunko@47
    27
melunko@47
    28
G_BEGIN_DECLS
melunko@47
    29
melunko@47
    30
#define GST_TYPE_NUV_DEMUX \
melunko@47
    31
  (gst_nuv_demux_get_type ())
melunko@47
    32
#define GST_NUV_DEMUX(obj) \
melunko@47
    33
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux))
melunko@47
    34
#define GST_NUV_DEMUX_CLASS(klass) \
melunko@47
    35
  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass))
melunko@47
    36
#define GST_IS_NUV_DEMUX(obj) \
melunko@47
    37
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX))
melunko@47
    38
#define GST_IS_NUV_DEMUX_CLASS(klass) \
melunko@47
    39
  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
melunko@47
    40
rosfran@73
    41
#define DEMUX_INDEX_SIZE_MAX (100000)
rosfran@73
    42
rosfran@56
    43
/* Indexes (timecodes/offsets) conversion structures */
rosfran@56
    44
typedef struct
rosfran@56
    45
{
rosfran@56
    46
    gint64 i_time;
rosfran@56
    47
    gint64 i_offset;
rosfran@56
    48
rosfran@56
    49
} nuv_demux_index_entry;
rosfran@56
    50
rosfran@56
    51
typedef struct
rosfran@56
    52
{
rosfran@56
    53
    gint i_idx;
rosfran@56
    54
    gint i_idx_max;
rosfran@56
    55
rosfran@73
    56
    nuv_demux_index_entry idx[DEMUX_INDEX_SIZE_MAX];
rosfran@56
    57
} nuv_demux_index;
melunko@47
    58
melunko@47
    59
/* */
melunko@47
    60
typedef struct
melunko@47
    61
{
melunko@47
    62
    gchar id[12];       /* "NuppelVideo\0" or "MythTVVideo\0" */
melunko@47
    63
    gchar version[5];    /* "x.xx\0" */
melunko@47
    64
melunko@47
    65
    gint  i_width;
melunko@47
    66
    gint  i_height;
melunko@47
    67
    gint  i_width_desired;
melunko@47
    68
    gint  i_height_desired;
melunko@47
    69
melunko@47
    70
    gchar i_mode;            /* P progressive, I interlaced */
melunko@47
    71
melunko@47
    72
    gdouble  d_aspect;       /* 1.0 squared pixel */
melunko@47
    73
    gdouble  d_fps;
renatofilho@85
    74
    //fps num/denom
renatofilho@85
    75
    gint     i_fpsn;
renatofilho@85
    76
    gint     i_fpsd;
melunko@47
    77
melunko@47
    78
    gint     i_video_blocks; /* 0 no video, -1 unknown */
melunko@47
    79
    gint     i_audio_blocks;
melunko@47
    80
    gint     i_text_blocks;
melunko@47
    81
melunko@47
    82
    gint     i_keyframe_distance;
melunko@47
    83
melunko@47
    84
} nuv_header;
melunko@47
    85
melunko@47
    86
typedef struct
melunko@47
    87
{
melunko@47
    88
    gchar i_type;        /* A: audio, V: video, S: sync; T: test
melunko@47
    89
                           R: Seekpoint (string:RTjjjjjjjj)
melunko@47
    90
                           D: Extra data for codec */
melunko@47
    91
    gchar i_compression; /* V: 0 uncompressed
melunko@47
    92
                              1 RTJpeg
melunko@47
    93
                              2 RTJpeg+lzo
melunko@47
    94
                              N black frame
melunko@47
    95
                              L copy last
melunko@47
    96
                           A: 0 uncompressed (44100 1-bits, 2ch)
melunko@47
    97
                              1 lzo
melunko@47
    98
                              2 layer 2
melunko@47
    99
                              3 layer 3
melunko@47
   100
                              F flac
melunko@47
   101
                              S shorten
melunko@47
   102
                              N null frame loudless
melunko@47
   103
                              L copy last
melunko@47
   104
                            S: B audio and vdeo sync point
melunko@47
   105
                               A audio sync info (timecode == effective
melunko@47
   106
                                    dsp frequency*100)
melunko@47
   107
                               V next video sync (timecode == next video
melunko@47
   108
                                    frame num)
melunko@47
   109
                               S audio,video,text correlation */
melunko@47
   110
    gchar i_keyframe;    /* 0 keyframe, else no no key frame */
melunko@47
   111
    guint8 i_filters;  /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
melunko@47
   112
                           0x02: gauss 5 pixel (8,1,1,1,1)/12
melunko@47
   113
                           0x04: cartoon filter */
melunko@47
   114
rosfran@73
   115
    gint32 i_timecode;     /* ms */
melunko@47
   116
rosfran@56
   117
    gint i_length;       /* V,A,T: length of following data
melunko@47
   118
                           S: length of packet correl */
melunko@47
   119
} nuv_frame_header;
melunko@47
   120
melunko@47
   121
/* FIXME Not sure of this one */
melunko@47
   122
typedef struct
melunko@47
   123
{
melunko@47
   124
    gint             i_version;
melunko@47
   125
    guint32		     i_video_fcc;
melunko@47
   126
melunko@47
   127
    guint32		     i_audio_fcc;
melunko@47
   128
    gint             i_audio_sample_rate;
melunko@47
   129
    gint             i_audio_bits_per_sample;
melunko@47
   130
    gint             i_audio_channels;
melunko@47
   131
    gint             i_audio_compression_ratio;
melunko@47
   132
    gint             i_audio_quality;
melunko@47
   133
    gint             i_rtjpeg_quality;
melunko@47
   134
    gint             i_rtjpeg_luma_filter;
melunko@47
   135
    gint             i_rtjpeg_chroma_filter;
melunko@47
   136
    gint             i_lavc_bitrate;
melunko@47
   137
    gint             i_lavc_qmin;
melunko@47
   138
    gint             i_lavc_qmax;
melunko@47
   139
    gint             i_lavc_maxqdiff;
melunko@47
   140
    gint64         	 i_seekable_offset;
melunko@47
   141
    gint64           i_keyframe_adjust_offset;
melunko@47
   142
melunko@47
   143
} nuv_extended_header;
melunko@47
   144
melunko@47
   145
typedef enum {
melunko@47
   146
  GST_NUV_DEMUX_START,
melunko@47
   147
  GST_NUV_DEMUX_HEADER_DATA,
melunko@47
   148
  GST_NUV_DEMUX_EXTRA_DATA,
melunko@47
   149
  GST_NUV_DEMUX_MPEG_DATA,
melunko@47
   150
  GST_NUV_DEMUX_EXTEND_HEADER,
melunko@47
   151
  GST_NUV_DEMUX_EXTEND_HEADER_DATA,
melunko@47
   152
  GST_NUV_DEMUX_FRAME_HEADER,
melunko@47
   153
  GST_NUV_DEMUX_MOVI,
melunko@47
   154
  GST_NUV_DEMUX_INVALID_DATA
melunko@47
   155
} GstNuvDemuxState;
melunko@47
   156
melunko@47
   157
typedef struct _GstNuvDemux {
melunko@47
   158
  GstElement     parent;
melunko@47
   159
melunko@47
   160
  guint         mode;
melunko@47
   161
  GstAdapter    *adapter; 
melunko@47
   162
melunko@47
   163
  /* pads */
melunko@47
   164
  GstPad        *sinkpad;
melunko@47
   165
  GstPad        *src_video_pad;  
melunko@47
   166
  GstPad        *src_audio_pad;
melunko@47
   167
melunko@47
   168
  /* NUV decoding state */
renatofilho@84
   169
  GstNuvDemuxState  state;
renatofilho@85
   170
  guint64           duration;
renatofilho@84
   171
  guint64           offset;
renatofilho@85
   172
  guint64           time_offset;
renatofilho@85
   173
  guint64           last_frame_time;
renatofilho@84
   174
  gboolean          new_audio_segment;
renatofilho@84
   175
  gboolean          new_video_segment;
renatofilho@77
   176
melunko@47
   177
  /* Mpeg ExtraData */
melunko@47
   178
  guint64       mpeg_data_size;
melunko@47
   179
  GstBuffer     *mpeg_buffer;
melunko@47
   180
  
melunko@47
   181
  nuv_header *h;
melunko@47
   182
  nuv_extended_header *eh;
melunko@47
   183
  nuv_frame_header *fh;
rosfran@56
   184
  
leo_sobral@80
   185
  /* FIXME: change these fields to private struct */
leo_sobral@80
   186
  /* first data buffer received, should sent new_segment */
melunko@47
   187
} GstNuvDemux;
melunko@47
   188
melunko@47
   189
typedef struct _GstNuvDemuxClass {
melunko@47
   190
  GstElementClass parent_class;
melunko@47
   191
} GstNuvDemuxClass;
melunko@47
   192
melunko@47
   193
GType           gst_nuv_demux_get_type          (void);
melunko@47
   194
melunko@47
   195
G_END_DECLS
melunko@47
   196
melunko@47
   197
#endif /* __GST_NUV_DEMUX_H__ */