Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/avi_play/src/lib/graphics/importer/movie_player.h @ 6353

Last change on this file since 6353 was 6353, checked in by hdavid, 18 years ago

branches\avi_play: MoviePlayer works again

File size: 1.4 KB
Line 
1/*!
2 * @file movie_player.h
3  *  Manages the media files
4
5*/
6
7#ifndef _MOVIE_PLAYER
8#define _MOVIE_PLAYER
9
10#include <SDL.h>
11
12#ifdef HAVE_AVFORMAT_H
13  #include <avformat.h>
14#else
15  #include <ffmpeg/avformat.h>
16#endif
17
18#include "glincl.h"
19
20#include "light.h"
21#include "texture.h"
22#include "material.h"
23#include "primitive_model.h"
24
25// include base_object.h since all classes are derived from this one
26#include "base_object.h"
27
28// The state of the MoviePlayer
29typedef enum MP_STATUS {
30  PLAY,
31        PAUSE,
32        STOP
33};
34
35class MoviePlayer : public BaseObject
36{
37
38private:
39
40  Model* model;
41  Material* material;
42
43  AVFormatContext* format_context;
44  AVCodecContext* codec_context;
45  AVCodec* codec;
46  AVFrame* frame;
47  AVPacket packet;
48  AVFrame* RGB_frame;
49
50  SDL_Surface* surface;
51  GLuint texture;
52  uint8_t* data;
53  uint8_t* buffer;
54  int num_bytes;
55  int video_stream;
56
57  MP_STATUS status;     
58  float speed;
59  float timer;
60  int actual_frame;
61  int frame_number;
62  float fps;
63  int duration; 
64
65public:
66
67  MoviePlayer(const char* filename);
68  MoviePlayer();
69  ~MoviePlayer();
70
71  void loadMovie(const char* filename);
72
73        void start(unsigned int start_time);
74        void resume();
75        void pause();
76        void stop();
77
78        void tick(float dt);
79        const void draw();
80
81        void setSpeed(float speed);
82        float getSpeed();
83        const MP_STATUS getStatus();
84  void printInformation();
85
86private:
87 
88  void init();
89  void getNextFrame();
90  void skipFrame(int frames);
91  void gotoFrame(int frame);
92
93};
94
95
96
97#endif // _MOVIE_PLAYER
Note: See TracBrowser for help on using the repository browser.