Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

some cleanup and fixes

File size: 1.3 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#include "texture.h"
20
21// include base_object.h since all classes are derived from this one
22#include "base_object.h"
23
24// The state of the MoviePlayer
25typedef enum MP_STATUS {
26  PLAY,
27  PAUSE,
28  STOP
29};
30
31class MoviePlayer : public BaseObject
32{
33
34private:
35
36  AVFormatContext* format_context;
37  AVCodecContext* codec_context;
38  AVCodec* codec;
39  AVFrame* frame;
40  AVPacket packet;
41  AVFrame* RGB_frame;
42
43  GLuint texture;
44  uint8_t* data;
45  uint8_t* buffer;
46  int num_bytes;
47  int video_stream;
48
49  MP_STATUS status;
50  float timer;
51  int start_frame;
52  int actual_frame;
53  int frame_number;
54  float fps;
55  int duration;
56  bool loading;
57
58public:
59
60  MoviePlayer(const char* filename);
61  MoviePlayer();
62  ~MoviePlayer();
63
64  bool loadMovie(const char* filename);
65
66  void start(float start_time);
67  void resume();
68  void pause();
69  void stop();
70
71  void tick(float dt);
72  GLuint getTexture();
73
74  void setFPS(float fps);
75  float getFPS();
76  const MP_STATUS getStatus();
77  void printInformation();
78
79private:
80
81  void init();
82  void getNextFrame();
83  void skipFrame(int frames);
84  bool gotoFrame(int frames);
85
86};
87
88#endif // _MOVIE_PLAYER
Note: See TracBrowser for help on using the repository browser.