Panda3D
|
00001 // Filename: ffmpegVideoCursor.h 00002 // Created by: jyelon (01Aug2007) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef FFMPEGVIDEOCURSOR_H 00016 #define FFMPEGVIDEOCURSOR_H 00017 #ifdef HAVE_FFMPEG 00018 00019 #include "pandabase.h" 00020 #include "texture.h" 00021 #include "pointerTo.h" 00022 00023 struct AVFormatContext; 00024 struct AVCodecContext; 00025 struct AVStream; 00026 struct AVPacket; 00027 struct AVFrame; 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : FfmpegVideoCursor 00031 // Description : 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDA_MOVIES FfmpegVideoCursor : public MovieVideoCursor { 00034 friend class FfmpegVideo; 00035 00036 PUBLISHED: 00037 FfmpegVideoCursor(FfmpegVideo *src); 00038 virtual ~FfmpegVideoCursor(); 00039 00040 public: 00041 virtual void fetch_into_texture(double time, Texture *t, int page); 00042 virtual void fetch_into_buffer(double time, unsigned char *block, bool rgba); 00043 00044 protected: 00045 void fetch_packet(double default_time); 00046 void fetch_frame(); 00047 void seek(double t); 00048 void fetch_time(double time); 00049 void export_frame(unsigned char *data, bool bgra, int bufx); 00050 void cleanup(); 00051 00052 Filename _filename; 00053 AVPacket *_packet; 00054 double _packet_time; 00055 AVFormatContext *_format_ctx; 00056 AVCodecContext *_video_ctx; 00057 int _video_index; 00058 double _video_timebase; 00059 AVFrame *_frame; 00060 AVFrame *_frame_out; 00061 int _initial_dts; 00062 double _min_fseek; 00063 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 MovieVideoCursor::init_type(); 00070 register_type(_type_handle, "FfmpegVideoCursor", 00071 MovieVideoCursor::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00077 00078 private: 00079 static TypeHandle _type_handle; 00080 }; 00081 00082 #include "ffmpegVideoCursor.I" 00083 00084 #endif // HAVE_FFMPEG 00085 #endif // FFMPEGVIDEO_H