summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/mpegplay/videoDecoder.h
blob: cba45a29e6c2b160943b75509e170e9f086e4efb (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
115
116
117
118
/*
  mpeg I video decoder (derived from mpeg_play)
  Copyright (C) 2000  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 __VIDEO_H
#define __VIDEO_H


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#include "decoderClass.h"
#include "recon.h"
#include "motionVector.h"
#include "slice.h"
#include "proto.h"
#include "../input/inputStream.h"
#include "../output/outputStream.h"
#include "../util/timeStamp.h"
#include "mpegVideoHeader.h"
#include "gop.h"
#include "picture.h"
#include "macroBlock.h"
#include "startCodes.h"



/* Define Parsing error codes. */



#define SYNC_TO_CLOSED_GOP            1
#define SYNC_HAS_CLOSED_GOP           2
#define SYNC_HAS_I_FRAME_SYNC         3
#define SYNC_HAS_P_FRAME_SYNC         4
#define SYNC_HAS_FRAME_SYNC           5

#define _SYNC_TO_GOP                  1
#define _SYNC_TO_PIC                  2
#define _SYNC_TO_NONE                 3



/* Number of macroblocks to process in one call to mpegVidRsrc. */

#define MB_QUANTUM 100


/* Video stream structure. */
class VideoDecoder {


 public:
  VideoDecoder(MpegVideoStream* mpegVideoStream,
	       MpegVideoHeader* initSequence);

  ~VideoDecoder();
  int mpegVidRsrc(PictureArray* pictureArray);


  // ugly callbacks FIX ME!
  class MpegVideoStream* mpegVideoStream;
  class DecoderClass* decoderClass;
  class Recon* recon;
  class MotionVector* motionVector;
  class Slice* slice;                         /* Current slice.            */
  class MpegVideoHeader* mpegVideoHeader;     /* Sequence info in stream   */
  class GOP* group;
  class Picture* picture;                     /* Current picture.          */
  class MacroBlock* macroBlock;               /* Current macroblock.       */
  
  void resyncToI_Frame();



 private:

  int syncState;
 
  int ParseSeqHead();
  int ParseGOP();
  int ParsePicture();
  int ParseSlice();
  void doPictureDisplay(PictureArray* pictureArray);
  MpegExtension* extension;
  int frameCounter;

};   



/* Declaration of global display pointer. */



extern int qualityFlag;




extern int gXErrorFlag;




#endif /* videoDecoder.h already included */