Stubs in place, now it compiles.
This commit is contained in:
parent
f99d339ddf
commit
9f15224b03
|
|
@ -1,5 +1,5 @@
|
|||
// Filename: config_movies.cxx
|
||||
// Created by: cary (04Jan00)
|
||||
// Created by: jyelon (02Jul07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -22,6 +22,10 @@
|
|||
ConfigureDef(config_movies);
|
||||
NotifyCategoryDef(movies, "");
|
||||
|
||||
ConfigureFn(config_movies) {
|
||||
init_libmovies();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libmovies
|
||||
// Description: Initializes the library. This must be called at
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Filename: config_movies.h
|
||||
// Created by: cary (04Jan00)
|
||||
// Created by: jyelon (02Jul07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -25,9 +25,9 @@
|
|||
#include "configVariableDouble.h"
|
||||
#include "dconfig.h"
|
||||
|
||||
ConfigureDecl(config_movies, EXPCL_PANDA, EXPTP_PANDA);
|
||||
NotifyCategoryDecl(movies, EXPCL_PANDA, EXPTP_PANDA);
|
||||
ConfigureDecl(config_movies, EXPCL_PANDASKEL, EXPTP_PANDASKEL);
|
||||
NotifyCategoryDecl(movies, EXPCL_PANDASKEL, EXPTP_PANDASKEL);
|
||||
|
||||
extern EXPCL_PANDA void init_libmovies();
|
||||
extern EXPCL_PANDASKEL void init_libmovies();
|
||||
|
||||
#endif /* __CONFIG_MOVIES_H__ */
|
||||
|
|
|
|||
|
|
@ -16,3 +16,49 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::rate
|
||||
// Access: Public
|
||||
// Description: Returns the audio sample rate, in samples per sec.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovieAudio::
|
||||
rate() const {
|
||||
return _rate;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::channels
|
||||
// Access: Public
|
||||
// Description: Returns the number of audio channels. Ie, 1 for
|
||||
// mono, 2 for stereo.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovieAudio::
|
||||
channels() const {
|
||||
return _channels;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::samples_read
|
||||
// Access: Public
|
||||
// Description: Returns the number of audio samples you have read
|
||||
// from the audio stream so far.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovieAudio::
|
||||
samples_read() const {
|
||||
return _samples_read;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::approx_time_remaining
|
||||
// Access: Public
|
||||
// Description: Returns a "best guess" amount of time left on the
|
||||
// stream. For ffmpeg streams, this is usually a
|
||||
// pretty close approximation --- ie, off by a few
|
||||
// hundred samples. For infinite streams, always
|
||||
// returns the constant value 1.0E10.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double MovieAudio::
|
||||
approx_time_remaining() const {
|
||||
return _approx_time_remaining;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,21 +23,59 @@ TypeHandle MovieAudio::_type_handle;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::Constructor
|
||||
// Access: Protected
|
||||
// Description: Normally, the MovieAudio constructor is not
|
||||
// called directly; these are created by calling
|
||||
// the MoviePool::load functions. Furthermore,
|
||||
// MovieAudio itself is just an abstract base class.
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
MovieAudio::
|
||||
MovieAudio() {
|
||||
MovieAudio(const string &name) :
|
||||
Namable(name),
|
||||
_rate(44100),
|
||||
_samples_read(0),
|
||||
_approx_time_remaining(1.0E10)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::Destructor
|
||||
// Access: Published, Virtual
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
MovieAudio::
|
||||
~MovieAudio() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::read_samples
|
||||
// Access: Public, Virtual
|
||||
// Description: Read audio samples from the stream. N is the
|
||||
// number of samples you wish to read. Your buffer
|
||||
// must be at least as large as N * channels.
|
||||
// Multiple-channel audio will be interleaved. Returns
|
||||
// the actual number of samples read. This will always
|
||||
// be equal to N unless end-of-stream has been reached.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int MovieAudio::
|
||||
read_samples(int n, PN_int16 *data) {
|
||||
|
||||
// This is a dummy implementation. This method should be overridden.
|
||||
nassertr(n > 0, 0);
|
||||
for (int i=0; i<n * _channels; i++) {
|
||||
data[i] = 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieAudio::skip_samples
|
||||
// Access: Public, Virtual
|
||||
// Description: Skip audio samples from the stream. This is mostly
|
||||
// for debugging purposes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int MovieAudio::
|
||||
skip_samples(int n) {
|
||||
nassertr(n > 0, 0);
|
||||
PN_int16 *data = new PN_int16[n];
|
||||
int res = read_samples(n, data);
|
||||
delete data;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MOVIEVIDEO_H
|
||||
#define MOVIEVIDEO_H
|
||||
#ifndef MOVIEAUDIO_H
|
||||
#define MOVIEAUDIO_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "namable.h"
|
||||
#include "texture.h"
|
||||
#include "pointerTo.h"
|
||||
|
||||
|
|
@ -27,21 +28,35 @@
|
|||
// Class : MovieAudio
|
||||
// Description : A stream that generates a sequence of audio samples.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA MovieAudio : public TypedWritableReferenceCount, public Namable {
|
||||
class EXPCL_PANDASKEL MovieAudio : public TypedWritableReferenceCount, public Namable {
|
||||
protected:
|
||||
MovieAudio();
|
||||
MovieAudio(const string &name);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE int rate() const;
|
||||
INLINE int channels() const;
|
||||
INLINE int samples_read() const;
|
||||
INLINE double approx_time_remaining() const;
|
||||
virtual int skip_samples(int n);
|
||||
|
||||
public:
|
||||
virtual int read_samples(int n, PN_int16 *data);
|
||||
virtual ~MovieAudio();
|
||||
|
||||
private:
|
||||
int _rate;
|
||||
int _channels;
|
||||
int _samples_read;
|
||||
double _approx_time_remaining;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
GraphicsOutput::init_type();
|
||||
TypedWritableReferenceCount::init_type();
|
||||
register_type(_type_handle, "MovieAudio",
|
||||
MovieAudio::get_class_type());
|
||||
TypedWritableReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
|
|||
|
|
@ -16,3 +16,65 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::size_x
|
||||
// Access: Published
|
||||
// Description: Get the horizontal size of the movie.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovieVideo::
|
||||
size_x() const {
|
||||
return _size_x;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::size_y
|
||||
// Access: Published
|
||||
// Description: Get the vertical size of the movie.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int MovieVideo::
|
||||
size_y() const {
|
||||
return _size_y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::frame_start
|
||||
// Access: Published
|
||||
// Description: MovieVideo streams have variable frame rates. Each
|
||||
// frame will specify how long it is to be displayed.
|
||||
// These lengths may not be equal from frame to frame.
|
||||
//
|
||||
// The frame_start function returns the time at which
|
||||
// the current frame should start being displayed. This
|
||||
// time is relative to the start of the stream.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double MovieVideo::
|
||||
frame_start() const {
|
||||
return _frame_start;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::frame_end
|
||||
// Access: Published
|
||||
// Description: Return the time at which this frame should stop
|
||||
// being displayed. This time is relative to the start
|
||||
// of the stream.
|
||||
//
|
||||
// The frame_end function returns the time at which
|
||||
// the current frame should stop being displayed. This
|
||||
// time is relative to the start of the stream.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double MovieVideo::
|
||||
frame_end() const {
|
||||
return _frame_end;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::approx_time_remaining
|
||||
// Access: Published
|
||||
// Description: Get the vertical size of the movie.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double MovieVideo::
|
||||
approx_time_remaining() const {
|
||||
return _approx_time_remaining;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "movieVideo.h"
|
||||
#include "config_movies.h"
|
||||
|
||||
TypeHandle MovieVideo::_type_handle;
|
||||
|
||||
|
|
@ -41,3 +42,22 @@ MovieVideo::
|
|||
~MovieVideo() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::load_image
|
||||
// Access: Published, Virtual
|
||||
// Description: Copy the current frame into a texture's ram image.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MovieVideo::
|
||||
load_image(Texture *t) {
|
||||
movies_cat.error() << "load_image: this virtual method must be overridden.";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MovieVideo::next_frame
|
||||
// Access: Published, Virtual
|
||||
// Description: Advances to the next frame.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MovieVideo::
|
||||
next_frame() {
|
||||
movies_cat.error() << "next_frame: this virtual method must be overridden.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,21 +27,37 @@
|
|||
// Class : MovieVideo
|
||||
// Description : A stream that generates a series of images.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA MovieVideo : public TypedWritableReferenceCount, public Namable {
|
||||
class EXPCL_PANDASKEL MovieVideo : public TypedWritableReferenceCount, public Namable {
|
||||
protected:
|
||||
MovieVideo();
|
||||
|
||||
PUBLISHED:
|
||||
PUBLISHED:
|
||||
INLINE int size_x() const;
|
||||
INLINE int size_y() const;
|
||||
INLINE double frame_start() const;
|
||||
INLINE double frame_end() const;
|
||||
INLINE double approx_time_remaining() const;
|
||||
virtual void load_image(Texture *t);
|
||||
virtual void next_frame();
|
||||
|
||||
public:
|
||||
virtual ~MovieVideo();
|
||||
|
||||
|
||||
private:
|
||||
int _size_x;
|
||||
int _size_y;
|
||||
double _frame_start;
|
||||
double _frame_end;
|
||||
double _approx_time_remaining;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
GraphicsOutput::init_type();
|
||||
TypedWritableReferenceCount::init_type();
|
||||
register_type(_type_handle, "MovieVideo",
|
||||
MovieVideo::get_class_type());
|
||||
TypedWritableReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
|
|||
Loading…
Reference in New Issue