summaryrefslogtreecommitdiff
path: root/gst/mve/gstmvedemux.h
blob: efc848d4e7f3dda2ec7d3f8e9cf4d5bcf9f2ce8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * GStreamer demultiplexer plugin for Interplay MVE movie files
 *
 * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_MVE_DEMUX_H__
#define __GST_MVE_DEMUX_H__

#include <gst/gst.h>
#include <gst/base/gstadapter.h>

G_BEGIN_DECLS

#define GST_TYPE_MVE_DEMUX \
  (gst_mve_demux_get_type())
#define GST_MVE_DEMUX(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MVE_DEMUX,GstMveDemux))
#define GST_MVE_DEMUX_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MVE_DEMUX,GstMveDemuxClass))
#define GST_IS_MVE_DEMUX(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MVE_DEMUX))
#define GST_IS_MVE_DEMUX_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MVE_DEMUX))

typedef struct _GstMveDemux       GstMveDemux;
typedef struct _GstMveDemuxClass  GstMveDemuxClass;
typedef struct _GstMveDemuxStream GstMveDemuxStream;

struct _GstMveDemux
{
  GstElement element;

  GstPad *sinkpad;

  GstMveDemuxStream *video_stream;
  GstMveDemuxStream *audio_stream;

  gint state;

  /* time per frame (1/framerate) */
  GstClockTime frame_duration;

  /* push based variables */
  guint16 needed_bytes;
  GstAdapter *adapter;
  
  /* size of current chunk */
  guint32 chunk_size;
  /* offset in current chunk */
  guint32 chunk_offset;
};

struct _GstMveDemuxClass 
{
  GstElementClass parent_class;
};

struct _GstMveDemuxStream {
  /* shared properties */
  GstCaps *caps;
  GstPad *pad;
  GstClockTime last_ts;
  gint64 offset;

  GstFlowReturn last_flow;

  /* video properties */
  guint16 width;
  guint16 height;
  guint8 bpp;   /* bytes per pixel */
  guint8 *code_map;
  gboolean code_map_avail;
  guint8 *back_buf1;
  guint8 *back_buf2;
  guint32 max_block_offset;
  GstBuffer *palette;
  GstBuffer *buffer;

  /* audio properties */
  guint16 sample_rate;
  guint16 n_channels;
  guint16 sample_size;
  gboolean compression;
};

GType gst_mve_demux_get_type (void);

int ipvideo_decode_frame8 (const GstMveDemuxStream * s,
    const unsigned char *data, unsigned short len);
int ipvideo_decode_frame16 (const GstMveDemuxStream * s,
    const unsigned char *data, unsigned short len);

void ipaudio_uncompress (short *buffer,
    unsigned short buf_len, const unsigned char *data, unsigned char channels);

G_END_DECLS

#endif /* __GST_MVE_DEMUX_H__ */