Subversion Repositories shark

Rev

Go to most recent revision | Details | 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
 * This is the abstract base class on which to easily build animation objects
48
 * for animation objects (MPEG, Quicktime, etc.)
49
 *
50
 * Original C version of the MPEG wrapper by Greg Ward <greg@pet.mni.mcgill.ca>,
51
 * reentrant C++ version by Loring Holden <lsh@cs.brown.edu>
52
 *
53
 */
54
 
55
#ifndef CPLUSPLUS_ANIM_WRAPPER
56
#include <stdio.h>
57
#include <errno.h>
58
#include <string.h>
59
//Originally from the MPEG Wrapper by Greg Ward
60
#ifndef BOOLEAN_TYPE_EXISTS
61
typedef char Boolean;
62
#define BOOLEAN_TYPE_EXISTS
63
#endif
64
 
65
#if (!defined(TRUE) || !defined(FALSE))
66
# define TRUE (char) 1
67
# define FALSE (char) 0
68
#endif
69
 
70
#ifndef NOTHREADS
71
#include "thread_mp.H"
72
#endif
73
#include "buffer.H"
74
 
75
class ANIMbase {
76
  public:
77
     ANIMbase();
78
     ANIMbase(const ANIMbase& rhs);    //Copy constructor (same
79
                                               //animation, but at start)
80
     virtual void newMovie(const char * const infile) = 0;
81
     const char * const getName() const {return fileName;};
82
     virtual Boolean open() = 0;
83
     virtual void rewind() = 0;
84
     virtual Boolean GetFrame(char **Frame, Boolean *newFrame) = 0;
85
     virtual Boolean OkFile() {return filePtr!=NULL;};
86
     virtual void InitDither(unsigned long /*red_mask*/,
87
                unsigned long /*green_mask*/,
88
                unsigned long /*blue_mask*/) {};
89
#ifndef NOTHREADS
90
     virtual void MultiThread(Boolean mt);
91
#endif
92
     virtual void Buffer(Boolean buff, Boolean compress=TRUE);
93
     virtual ~ANIMbase();
94
 
95
     int  Height;               // in pixels
96
     int  Width;
97
     int  Size;                 // bytes for whole image 
98
     int  frames;               // Frames so far 
99
 
100
     Boolean moreFrames;        // Are there more frames in the movie?
101
 
102
   protected:
103
     int threadNumber;          // the number of the thread we're using
104
     char *fileName;            // Name of the animation file
105
 
106
     FILE *filePtr;
107
     Boolean buffering,         // Are we buffering frames?
108
             allBuffered;       // We can stop if we have buffered all frames
109
     BUFFER *frameBuffer;       // Buffer object to hold frames
110
#ifndef NOTHREADS
111
     Boolean MultiThreaded;
112
     static THREADmp_manager *mp_man;
113
#endif
114
     void *(*thread_routine)(void *,void *);//Routine to run when multi-threaded
115
   private:
116
     ANIMbase& operator=(const ANIMbase& rhs);
117
};
118
 
119
#define CPLUSPLUS_ANIM_WRAPPER
120
#endif