Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Copyright (c) 1994 by Gregory P. Ward.
 * All rights reserved.
 *
 * This file is part of the MNI front end of the Berkeley MPEG decoder.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice and the following
 * two paragraphs appear in all copies of this software.
 *
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE
 * UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER
 * IS ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE
 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.  
 */


/*
 * Portions of this software Copyright (c) 1995 Brown University.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement
 * is hereby granted, provided that the above copyright notice and the
 * following two paragraphs appear in all copies of this software.
 *
 * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR DIRECT,
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
 * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
 * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */


/*
 *
 * Original C version by Greg Ward <greg@pet.mni.mcgill.ca>,
 * reentrant C++ version by Loring Holden <lsh@cs.brown.edu>
 *
 */


#ifndef CPLUSPLUS_MPEG_WRAPPER
#include <stdio.h>
#include <errno.h>
#include <string.h>
extern "C" {
#include "video.h"
}
#include "ANIMbase.H"

#ifndef __STDC__
#define __STDC__
#endif

extern "C" {
#include "proto.h"
}
#undef const

extern "C" {
#include "dither.h"
#include "mpeg.h"
}
#undef const

const int BUF_LENGTH=100000;

class ANIMmpeg : public ANIMbase {
  public:
     ANIMmpeg(const char * const inFileName); //Makes a copy of the filename
     ANIMmpeg(const ANIMmpeg& rhs);          //Copy constructor (same
                                               //movie, but at start)
     virtual void newMovie(const char * const infile);
     virtual Boolean open();
     virtual void rewind();
     virtual Boolean GetFrame(char **Frame, Boolean *newFrame);
     virtual ~ANIMmpeg();
     virtual void InitDither(unsigned long red_mask=0xff,
                                unsigned long green_mask=0xff00,
                                unsigned long blue_mask=0xff0000);

     int  BlockHeight;          // in Macroblocks
     int  BlockWidth;
     int  Depth;                // image depth (bits)
     int  PixelSize;            // bits actually stored per pixel
     int  BitmapPad;            // "quantum" of a scanline -- each scanline
                                // starts on an even interval of this
                                // many bits
     int  PictureRate;          // required number of frames/sec [?]
     int  BitRate;              // ???

   private:
     VidStream *vid_stream;     // Pointer to the vid stream itself

     void init();               // initialize the object
     static void *RunDecode(void *ptr, void *ptr2); //Does the decoding
     static int numMovies;      // Total number of movies so far
     void GetInfo();
     void InitStream();
};

#define CPLUSPLUS_MPEG_WRAPPER
#endif