Subversion Repositories shark

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Copyright (c) 1994 by Gregory P. Ward.
3
 * All rights reserved.
4
 *
5
 * This file is part of the MNI front end of the Berkeley MPEG decoder.
6
 *
7
 * Permission to use, copy, modify, and distribute this software and its
8
 * documentation for any purpose, without fee, and without written agreement is
9
 * hereby granted, provided that the above copyright notice and the following
10
 * two paragraphs appear in all copies of this software.
11
 *
12
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
13
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
14
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE
15
 * UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
16
 * SUCH DAMAGE.
17
 *
18
 * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
19
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER
21
 * IS ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE
22
 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.  
23
 */
24
 
25
/*
26
 * Portions of this software Copyright (c) 1995 Brown University.
27
 * All rights reserved.
28
 *
29
 * Permission to use, copy, modify, and distribute this software and its
30
 * documentation for any purpose, without fee, and without written agreement
31
 * is hereby granted, provided that the above copyright notice and the
32
 * following two paragraphs appear in all copies of this software.
33
 *
34
 * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR DIRECT,
35
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
36
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
37
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
 *
39
 * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
40
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
41
 * PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
42
 * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
43
 * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44
 */
45
 
46
/*
47
 *
48
 * Original C version by Greg Ward <greg@pet.mni.mcgill.ca>,
49
 * reentrant C++ version by Loring Holden <lsh@cs.brown.edu>
50
 *
51
 */
52
 
53
#ifndef CPLUSPLUS_MPEG_WRAPPER
54
#include <stdio.h>
55
#include <errno.h>
56
#include <string.h>
57
extern "C" {
58
#include "video.h"
59
}
60
#include "ANIMbase.H"
61
 
62
#ifndef __STDC__
63
#define __STDC__
64
#endif
65
 
66
extern "C" {
67
#include "proto.h"
68
}
69
#undef const
70
 
71
extern "C" {
72
#include "dither.h"
73
#include "mpeg.h"
74
}
75
#undef const
76
 
77
const int BUF_LENGTH=100000;
78
 
79
class ANIMmpeg : public ANIMbase {
80
  public:
81
     ANIMmpeg(const char * const inFileName); //Makes a copy of the filename
82
     ANIMmpeg(const ANIMmpeg& rhs);          //Copy constructor (same
83
                                               //movie, but at start)
84
     virtual void newMovie(const char * const infile);
85
     virtual Boolean open();
86
     virtual void rewind();
87
     virtual Boolean GetFrame(char **Frame, Boolean *newFrame);
88
     virtual ~ANIMmpeg();
89
     virtual void InitDither(unsigned long red_mask=0xff,
90
                                unsigned long green_mask=0xff00,
91
                                unsigned long blue_mask=0xff0000);
92
 
93
     int  BlockHeight;          // in Macroblocks
94
     int  BlockWidth;
95
     int  Depth;                // image depth (bits) 
96
     int  PixelSize;            // bits actually stored per pixel 
97
     int  BitmapPad;            // "quantum" of a scanline -- each scanline 
98
                                // starts on an even interval of this 
99
                                // many bits 
100
     int  PictureRate;          // required number of frames/sec [?] 
101
     int  BitRate;              // ??? 
102
 
103
   private:
104
     VidStream *vid_stream;     // Pointer to the vid stream itself
105
 
106
     void init();               // initialize the object
107
     static void *RunDecode(void *ptr, void *ptr2); //Does the decoding
108
     static int numMovies;      // Total number of movies so far
109
     void GetInfo();
110
     void InitStream();
111
};
112
 
113
#define CPLUSPLUS_MPEG_WRAPPER
114
#endif