gst-plugins-nuvdemux/src/gstnuvdemux.h
author rosfran
Mon Nov 06 22:59:51 2006 +0000 (2006-11-06)
branchtrunk
changeset 69 f7c91518d8f4
parent 60 98fa2109e716
child 73 959df0ca7621
permissions -rw-r--r--
[svn r70] Renamed these remote_encoder source files to recorder.
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@56
    41
/* Indexes (timecodes/offsets) conversion structures */
rosfran@56
    42
typedef struct
rosfran@56
    43
{
rosfran@56
    44
    gint64 i_time;
rosfran@56
    45
    gint64 i_offset;
rosfran@56
    46
rosfran@56
    47
} nuv_demux_index_entry;
rosfran@56
    48
rosfran@56
    49
typedef struct
rosfran@56
    50
{
rosfran@56
    51
    gint i_idx;
rosfran@56
    52
    gint i_idx_max;
rosfran@56
    53
renatofilho@66
    54
    nuv_demux_index_entry *idx;
rosfran@56
    55
} nuv_demux_index;
melunko@47
    56
melunko@47
    57
/* */
melunko@47
    58
typedef struct
melunko@47
    59
{
melunko@47
    60
    gchar id[12];       /* "NuppelVideo\0" or "MythTVVideo\0" */
melunko@47
    61
    gchar version[5];    /* "x.xx\0" */
melunko@47
    62
melunko@47
    63
    gint  i_width;
melunko@47
    64
    gint  i_height;
melunko@47
    65
    gint  i_width_desired;
melunko@47
    66
    gint  i_height_desired;
melunko@47
    67
melunko@47
    68
    gchar i_mode;            /* P progressive, I interlaced */
melunko@47
    69
melunko@47
    70
    gdouble  d_aspect;       /* 1.0 squared pixel */
melunko@47
    71
    gdouble  d_fps;
melunko@47
    72
melunko@47
    73
    gint     i_video_blocks; /* 0 no video, -1 unknown */
melunko@47
    74
    gint     i_audio_blocks;
melunko@47
    75
    gint     i_text_blocks;
melunko@47
    76
melunko@47
    77
    gint     i_keyframe_distance;
melunko@47
    78
melunko@47
    79
} nuv_header;
melunko@47
    80
melunko@47
    81
typedef struct
melunko@47
    82
{
melunko@47
    83
    gchar i_type;        /* A: audio, V: video, S: sync; T: test
melunko@47
    84
                           R: Seekpoint (string:RTjjjjjjjj)
melunko@47
    85
                           D: Extra data for codec */
melunko@47
    86
    gchar i_compression; /* V: 0 uncompressed
melunko@47
    87
                              1 RTJpeg
melunko@47
    88
                              2 RTJpeg+lzo
melunko@47
    89
                              N black frame
melunko@47
    90
                              L copy last
melunko@47
    91
                           A: 0 uncompressed (44100 1-bits, 2ch)
melunko@47
    92
                              1 lzo
melunko@47
    93
                              2 layer 2
melunko@47
    94
                              3 layer 3
melunko@47
    95
                              F flac
melunko@47
    96
                              S shorten
melunko@47
    97
                              N null frame loudless
melunko@47
    98
                              L copy last
melunko@47
    99
                            S: B audio and vdeo sync point
melunko@47
   100
                               A audio sync info (timecode == effective
melunko@47
   101
                                    dsp frequency*100)
melunko@47
   102
                               V next video sync (timecode == next video
melunko@47
   103
                                    frame num)
melunko@47
   104
                               S audio,video,text correlation */
melunko@47
   105
    gchar i_keyframe;    /* 0 keyframe, else no no key frame */
melunko@47
   106
    guint8 i_filters;  /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
melunko@47
   107
                           0x02: gauss 5 pixel (8,1,1,1,1)/12
melunko@47
   108
                           0x04: cartoon filter */
melunko@47
   109
renatofilho@60
   110
    gint i_timecode;     /* ms */
melunko@47
   111
rosfran@56
   112
    gint i_length;       /* V,A,T: length of following data
melunko@47
   113
                           S: length of packet correl */
melunko@47
   114
} nuv_frame_header;
melunko@47
   115
melunko@47
   116
/* FIXME Not sure of this one */
melunko@47
   117
typedef struct
melunko@47
   118
{
melunko@47
   119
    gint             i_version;
melunko@47
   120
    guint32		     i_video_fcc;
melunko@47
   121
melunko@47
   122
    guint32		     i_audio_fcc;
melunko@47
   123
    gint             i_audio_sample_rate;
melunko@47
   124
    gint             i_audio_bits_per_sample;
melunko@47
   125
    gint             i_audio_channels;
melunko@47
   126
    gint             i_audio_compression_ratio;
melunko@47
   127
    gint             i_audio_quality;
melunko@47
   128
    gint             i_rtjpeg_quality;
melunko@47
   129
    gint             i_rtjpeg_luma_filter;
melunko@47
   130
    gint             i_rtjpeg_chroma_filter;
melunko@47
   131
    gint             i_lavc_bitrate;
melunko@47
   132
    gint             i_lavc_qmin;
melunko@47
   133
    gint             i_lavc_qmax;
melunko@47
   134
    gint             i_lavc_maxqdiff;
melunko@47
   135
    gint64         	 i_seekable_offset;
melunko@47
   136
    gint64           i_keyframe_adjust_offset;
melunko@47
   137
melunko@47
   138
} nuv_extended_header;
melunko@47
   139
melunko@47
   140
typedef enum {
melunko@47
   141
  GST_NUV_DEMUX_START,
melunko@47
   142
  GST_NUV_DEMUX_HEADER_DATA,
melunko@47
   143
  GST_NUV_DEMUX_EXTRA_DATA,
melunko@47
   144
  GST_NUV_DEMUX_MPEG_DATA,
melunko@47
   145
  GST_NUV_DEMUX_EXTEND_HEADER,
melunko@47
   146
  GST_NUV_DEMUX_EXTEND_HEADER_DATA,
melunko@47
   147
  GST_NUV_DEMUX_FRAME_HEADER,
melunko@47
   148
  GST_NUV_DEMUX_MOVI,
melunko@47
   149
  GST_NUV_DEMUX_INVALID_DATA
melunko@47
   150
} GstNuvDemuxState;
melunko@47
   151
melunko@47
   152
typedef struct _GstNuvDemux {
melunko@47
   153
  GstElement     parent;
melunko@47
   154
melunko@47
   155
  guint         mode;
melunko@47
   156
  GstAdapter    *adapter; 
melunko@47
   157
  guint64       video_offset;
melunko@47
   158
  guint64       audio_offset;
melunko@47
   159
melunko@47
   160
  /* pads */
rosfran@57
   161
  
melunko@47
   162
  GstPad        *sinkpad;
melunko@47
   163
  GstPad        *src_video_pad;  
melunko@47
   164
  GstPad        *src_audio_pad;
melunko@47
   165
  gboolean      first_video;
melunko@47
   166
  gboolean      first_audio;
melunko@47
   167
melunko@47
   168
  /* NUV decoding state */
melunko@47
   169
  GstNuvDemuxState state;
melunko@47
   170
  guint64        offset;
melunko@47
   171
melunko@47
   172
  /* Mpeg ExtraData */
melunko@47
   173
  guint64       mpeg_data_size;
melunko@47
   174
  GstBuffer     *mpeg_buffer;
melunko@47
   175
  
melunko@47
   176
  nuv_header *h;
melunko@47
   177
  nuv_extended_header *eh;
melunko@47
   178
  nuv_frame_header *fh;
rosfran@56
   179
  
rosfran@56
   180
  /* index */
rosfran@56
   181
  nuv_demux_index *index_entries;
rosfran@56
   182
  guint          index_size;
rosfran@56
   183
  guint64        index_offset;
rosfran@56
   184
  guint          current_entry;
rosfran@56
   185
melunko@47
   186
} GstNuvDemux;
melunko@47
   187
melunko@47
   188
typedef struct _GstNuvDemuxClass {
melunko@47
   189
  GstElementClass parent_class;
melunko@47
   190
} GstNuvDemuxClass;
melunko@47
   191
melunko@47
   192
GType           gst_nuv_demux_get_type          (void);
melunko@47
   193
melunko@47
   194
G_END_DECLS
melunko@47
   195
melunko@47
   196
#endif /* __GST_NUV_DEMUX_H__ */