Panda3D
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
FfmpegVideoCursor Class Reference
Inheritance diagram for FfmpegVideoCursor:
MovieVideoCursor TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

Classes

class  FfmpegBuffer
 

Public Member Functions

 FfmpegVideoCursor (FfmpegVideo *src)
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
virtual TypeHandle force_init_type ()
 
int get_max_readahead_frames () const
 Returns the maximum number of frames that a sub-thread will attempt to read ahead of the current frame. More...
 
ThreadPriority get_thread_priority () const
 Returns the current thread priority of the thread that decodes the ffmpeg video stream (if max_readahead_frames is nonzero). More...
 
virtual TypeHandle get_type () const
 
bool is_thread_started () const
 Returns true if the thread has been started, false if not. More...
 
virtual PT (Buffer) fetch_buffer()
 
void set_max_readahead_frames (int max_readahead_frames)
 Specifies the maximum number of frames that a sub-thread will attempt to read ahead of the current frame. More...
 
void set_thread_priority (ThreadPriority thread_priority)
 Changes the thread priority of the thread that decodes the ffmpeg video stream (if max_readahead_frames is nonzero). More...
 
virtual bool set_time (double timestamp, int loop_count)
 See MovieVideoCursor::set_time(). More...
 
void start_thread ()
 Explicitly starts the ffmpeg decoding thread after it has been stopped by a call to stop_thread(). More...
 
void stop_thread ()
 Explicitly stops the ffmpeg decoding thread. More...
 
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file. More...
 
- Public Member Functions inherited from MovieVideoCursor
bool aborted () const
 
virtual void apply_to_texture (const Buffer *buffer, Texture *t, int page)
 Stores this buffer's contents in the indicated texture. More...
 
virtual void apply_to_texture_alpha (const Buffer *buffer, Texture *t, int page, int alpha_src)
 Copies this buffer's contents into the alpha channel of the supplied texture. More...
 
virtual void apply_to_texture_rgb (const Buffer *buffer, Texture *t, int page)
 Copies this buffer's contents into the RGB channels of the supplied texture. More...
 
bool can_seek () const
 
bool can_seek_fast () const
 
virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
 
int get_num_components () const
 
double length () const
 
 PT (MovieVideo) get_source() const
 
bool ready () const
 
void setup_texture (Texture *tex) const
 Set up the specified Texture object to contain content from this movie. More...
 
int size_x () const
 
int size_y () const
 
bool streaming () const
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
void operator= (const TypedWritableReferenceCount &copy)
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
vector_uchar encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type FfmpegVideo. More...
 
- Static Public Member Functions inherited from MovieVideoCursor
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
static PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Friends

class FfmpegVideo
 

Additional Inherited Members

- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = nullptr)
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 
- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

Detailed Description

Definition at line 40 of file ffmpegVideoCursor.h.

Member Function Documentation

◆ finalize()

void FfmpegVideoCursor::finalize ( BamReader manager)
virtual

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented from TypedWritable.

Definition at line 1211 of file ffmpegVideoCursor.cxx.

◆ get_max_readahead_frames()

int FfmpegVideoCursor::get_max_readahead_frames ( ) const

Returns the maximum number of frames that a sub-thread will attempt to read ahead of the current frame.

See set_max_readahead_frames().

Definition at line 218 of file ffmpegVideoCursor.cxx.

◆ get_thread_priority()

ThreadPriority FfmpegVideoCursor::get_thread_priority ( ) const

Returns the current thread priority of the thread that decodes the ffmpeg video stream (if max_readahead_frames is nonzero).

See set_thread_priority().

Definition at line 246 of file ffmpegVideoCursor.cxx.

◆ is_thread_started()

bool FfmpegVideoCursor::is_thread_started ( ) const

Returns true if the thread has been started, false if not.

This will always return false if max_readahead_frames is 0.

Definition at line 315 of file ffmpegVideoCursor.cxx.

Referenced by set_thread_priority().

◆ register_with_read_factory()

void FfmpegVideoCursor::register_with_read_factory ( )
static

Tells the BamReader how to create objects of type FfmpegVideo.

Definition at line 1189 of file ffmpegVideoCursor.cxx.

References BamReader::get_factory(), and Factory< Type >::register_factory().

Referenced by init_libffmpeg().

◆ set_max_readahead_frames()

void FfmpegVideoCursor::set_max_readahead_frames ( int  max_readahead_frames)

Specifies the maximum number of frames that a sub-thread will attempt to read ahead of the current frame.

Setting this to a nonzero allows the video decoding to take place in a sub-thread, which smoothes out the video decoding time by spreading it evenly over several frames. Set this number larger to increase the buffer between the currently visible frame and the first undecoded frame; set it smaller to reduce memory consumption.

Setting this to zero forces the video to be decoded in the main thread. If threading is not available in the Panda build, this value is always zero.

Definition at line 191 of file ffmpegVideoCursor.cxx.

References start_thread(), and stop_thread().

◆ set_thread_priority()

void FfmpegVideoCursor::set_thread_priority ( ThreadPriority  thread_priority)

Changes the thread priority of the thread that decodes the ffmpeg video stream (if max_readahead_frames is nonzero).

Normally you shouldn't mess with this, but there may be special cases where a precise balance of CPU utilization between the main thread and the various ffmpeg service threads may be needed.

Definition at line 230 of file ffmpegVideoCursor.cxx.

References is_thread_started(), start_thread(), and stop_thread().

◆ set_time()

bool FfmpegVideoCursor::set_time ( double  timestamp,
int  loop_count 
)
virtual

See MovieVideoCursor::set_time().

Reimplemented from MovieVideoCursor.

Definition at line 323 of file ffmpegVideoCursor.cxx.

◆ start_thread()

void FfmpegVideoCursor::start_thread ( )

Explicitly starts the ffmpeg decoding thread after it has been stopped by a call to stop_thread().

The thread is normally started automatically, so there is no need to call this method unless you have previously called stop_thread() for some reason.

Definition at line 257 of file ffmpegVideoCursor.cxx.

References Filename::get_basename().

Referenced by set_max_readahead_frames(), and set_thread_priority().

◆ stop_thread()

void FfmpegVideoCursor::stop_thread ( )

Explicitly stops the ffmpeg decoding thread.

There is normally no reason to do this unless you want to maintain precise control over what threads are consuming CPU resources. Calling this method will make the video update in the main thread, regardless of the setting of max_readahead_frames, until you call start_thread() again.

Definition at line 285 of file ffmpegVideoCursor.cxx.

References ConditionVarDirect::notify().

Referenced by set_max_readahead_frames(), and set_thread_priority().

◆ write_datagram()

void FfmpegVideoCursor::write_datagram ( BamWriter manager,
Datagram dg 
)
virtual

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from MovieVideoCursor.

Definition at line 1198 of file ffmpegVideoCursor.cxx.

References MovieVideoCursor::write_datagram().


The documentation for this class was generated from the following files: