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