14 #ifndef FFMPEGVIDEOCURSOR_H 15 #define FFMPEGVIDEOCURSOR_H 30 struct AVFormatContext;
31 struct AVCodecContext;
49 void set_max_readahead_frames(
int max_readahead_frames);
50 int get_max_readahead_frames()
const;
52 void set_thread_priority(ThreadPriority thread_priority);
53 ThreadPriority get_thread_priority()
const;
56 BLOCKING
void stop_thread();
57 bool is_thread_started()
const;
60 virtual bool set_time(
double timestamp,
int loop_count);
61 virtual PT(
Buffer) fetch_buffer();
68 INLINE
FfmpegBuffer(
size_t block_size,
double video_timebase);
74 double _video_timebase;
80 static void init_type() {
82 register_type(_type_handle,
"FfmpegVideoCursor::FfmpegBuffer",
83 Buffer::get_class_type());
86 return get_class_type();
88 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
95 virtual PT(
Buffer) make_new_buffer();
103 std::string _sync_name;
104 int _max_readahead_frames;
105 ThreadPriority _thread_priority;
129 ThreadStatus _thread_status;
133 PT(FfmpegBuffer) _current_frame_buffer;
137 static void st_thread_main(
void *
self);
141 PT(FfmpegBuffer) do_alloc_frame();
142 void do_clear_all_frames();
144 bool fetch_packet(
int default_frame);
145 bool do_fetch_packet(
int default_frame);
146 void fetch_frame(
int frame);
147 void decode_frame(
int &finished);
148 void do_decode_frame(
int &finished);
149 void seek(
int frame,
bool backward);
150 void do_seek(
int frame,
bool backward);
151 int binary_seek(
int min_frame,
int max_frame,
int target_frame,
int num_iterations);
152 void advance_to_frame(
int frame);
154 void export_frame(FfmpegBuffer *buffer);
159 AVFormatContext *_format_ctx;
160 AVCodecContext *_video_ctx;
161 SwsContext *_convert_ctx;
165 double _video_timebase;
182 static void register_with_read_factory();
195 static void init_type() {
196 MovieVideoCursor::init_type();
198 MovieVideoCursor::get_class_type());
199 FfmpegBuffer::init_type();
202 return get_class_type();
204 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
214 #endif // FFMPEGVIDEO_H virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
virtual int compare_timestamp(const Buffer *other) const
Used to sort different buffers to ensure they correspond to the same source frame,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A generic thread type that allows calling a C-style thread function without having to subclass.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
virtual double get_timestamp() const
Returns the nearest timestamp value of this particular buffer.