summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/frame/rawFrame.h
blob: e1a05e9e51118a9217778328ef3e63eeda498bac (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
/*
  base class for raw frames (encoded data, where only the type is known)
  Copyright (C) 2001  Martin Vogt

  This program 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.

  For more information look at the file COPYRIGHT in this package

 */



#ifndef __RAW_FRAME_H
#define __RAW_FRAME_H

#include "frame.h"

/**
   Raw frames represents bitstreams. They most likely have have now
   real value for anyone but a decoder.
   In general you simply allocate a rawFrame with a given size, This
   size should make sure, that the bitstream packet does fit into
   the frame. Sometime, in derived classes you can set thes pointer
   to the allocated directly by calling the protected method: setRemoteData.
*/


#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifndef WORDS_BIGENDIAN
#define RAWFRAME_BIGENDIAN 1
#else
#define RAWFRAME_BIGENDIAN 0
#endif


class RawFrame : public Frame {

  unsigned char* data;
  int size;
  int len;
  int lRemoteData;

 public:
  RawFrame(int size);
  RawFrame(int type,int size);
  ~RawFrame();

  // access start of frameData
  unsigned char* getData()                { return data; }

  // current size in byte
  int getLen()                            { return len; }
  void setLen(int bytes)                  { this->len=bytes; }

  // maximum size of allocated memory
  int getSize()                           { return size; }


  void print(const char* msg);

 private:
  void init(int type,int size);

 protected:
  void setRemoteData(unsigned char* data,int size);
};



#endif