15 #ifndef FFMPEGVIDEOCURSOR_H
16 #define FFMPEGVIDEOCURSOR_H
18 #include "pandabase.h"
19 #include "movieVideoCursor.h"
21 #include "pointerTo.h"
22 #include "ffmpegVirtualFile.h"
23 #include "genericThread.h"
24 #include "threadPriority.h"
27 #include "conditionVar.h"
31 struct AVFormatContext;
32 struct AVCodecContext;
51 void set_max_readahead_frames(
int max_readahead_frames);
52 int get_max_readahead_frames()
const;
54 void set_thread_priority(ThreadPriority thread_priority);
55 ThreadPriority get_thread_priority()
const;
58 BLOCKING
void stop_thread();
59 bool is_thread_started()
const;
62 virtual bool set_time(
double timestamp,
int loop_count);
63 virtual PT(
Buffer) fetch_buffer();
70 INLINE
FfmpegBuffer(
size_t block_size,
double video_timebase);
71 virtual int compare_timestamp(
const Buffer *other)
const;
72 virtual double get_timestamp()
const;
76 double _video_timebase;
82 static void init_type() {
84 register_type(_type_handle,
"FfmpegVideoCursor::FfmpegBuffer",
85 Buffer::get_class_type());
88 return get_class_type();
90 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
97 virtual PT(
Buffer) make_new_buffer();
106 int _max_readahead_frames;
107 ThreadPriority _thread_priority;
121 Buffers _readahead_frames;
130 ThreadStatus _thread_status;
134 PT(FfmpegBuffer) _current_frame_buffer;
138 static
void st_thread_main(
void *self);
142 PT(FfmpegBuffer) do_alloc_frame();
143 void do_clear_all_frames();
145 bool fetch_packet(
int default_frame);
146 bool do_fetch_packet(
int default_frame);
147 void fetch_frame(
int frame);
148 void decode_frame(
int &finished);
149 void do_decode_frame(
int &finished);
150 void seek(
int frame,
bool backward);
151 void do_seek(
int frame,
bool backward);
152 int binary_seek(
int min_frame,
int max_frame,
int target_frame,
int num_iterations);
153 void advance_to_frame(
int frame);
155 void export_frame(FfmpegBuffer *buffer);
160 AVFormatContext *_format_ctx;
161 AVCodecContext *_video_ctx;
162 SwsContext *_convert_ctx;
166 double _video_timebase;
183 static
void register_with_read_factory();
186 virtual
void finalize(
BamReader *manager);
196 static void init_type() {
197 MovieVideoCursor::init_type();
198 register_type(_type_handle,
"FfmpegVideoCursor",
199 MovieVideoCursor::get_class_type());
200 FfmpegBuffer::init_type();
203 return get_class_type();
205 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
213 #include "ffmpegVideoCursor.I"
215 #endif // FFMPEGVIDEO_H
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Base class for objects that can be written to and read from Bam files.
A standard mutex, or mutual exclusion lock.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Enables ffmpeg to access panda's VFS.
This is our own Panda specialization on the default STL deque.
A condition variable, usually used to communicate information about changing state to a thread that i...
A lightweight class that represents a single element that may be timed and/or counted via stats...
virtual bool set_time(double timestamp, int loop_count)
Updates the cursor to the indicated time.
The name of a file, such as a texture file or an Egg file.
A MovieVideo is actually any source that provides a sequence of video frames.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
A generic thread type that allows calling a C-style thread function without having to subclass...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...