OpenShot Library | libopenshot  0.1.1
Public Member Functions | Public Attributes | List of all members
openshot::FFmpegReader Class Reference

This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame objects for any frame in the file. More...

#include <FFmpegReader.h>

Inheritance diagram for openshot::FFmpegReader:
openshot::ReaderBase

Public Member Functions

void Close ()
 Close File. More...
 
 FFmpegReader (string path) throw (InvalidFile, NoStreamsFound, InvalidCodec)
 
CacheGetCache ()
 Get the cache object used by this reader. More...
 
tr1::shared_ptr< FrameGetFrame (long int requested_frame) throw (OutOfBoundsFrame, ReaderClosed, TooManySeeks)
 
bool IsOpen ()
 Determine if reader is open or closed. More...
 
string Json ()
 Get and Set JSON methods. More...
 
Json::Value JsonValue ()
 Generate Json::JsonValue for this object. More...
 
string Name ()
 Return the type name of the class. More...
 
void Open () throw (InvalidFile, NoStreamsFound, InvalidCodec)
 Open File - which is called by the constructor automatically. More...
 
void SetJson (string value) throw (InvalidJSON)
 Load JSON string into this object. More...
 
void SetJsonValue (Json::Value root) throw (InvalidFile)
 Load Json::JsonValue into this object. More...
 
 ~FFmpegReader ()
 Destructor. More...
 
- Public Member Functions inherited from openshot::ReaderBase
void DisplayInfo ()
 Display file information in the standard output stream (stdout) More...
 
void DrawFrameOnScene (string path, long _graphics_scene_address)
 Test method to draw a bitmap on a Qt QGraphicsScene. More...
 
 ReaderBase ()
 Constructor for the base reader, where many things are initialized. More...
 

Public Attributes

bool enable_seek
 
Cache final_cache
 Final cache object used to hold final frames. More...
 
- Public Attributes inherited from openshot::ReaderBase
bool debug
 
ReaderInfo info
 Information about the current media file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from openshot::ReaderBase
void AppendDebugMethod (string method_name, string arg1_name, float arg1_value, string arg2_name, float arg2_value, string arg3_name, float arg3_value, string arg4_name, float arg4_value, string arg5_name, float arg5_value, string arg6_name, float arg6_value)
 Append debug information as JSON. More...
 
- Protected Attributes inherited from openshot::ReaderBase
CriticalSection getFrameCriticalSection
 Section lock for multiple threads. More...
 
CriticalSection processingCriticalSection
 

Detailed Description

This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame objects for any frame in the file.

All seeking and caching is handled internally, and the primary public interface is the GetFrame() method. To use this reader, simply create an instance of this class, and call the GetFrame method to start retrieving frames. Use the info struct to obtain information on the file, such as the length (# of frames), height, width, bit rate, frames per second (fps), etc...

// Create a reader for a video
FFmpegReader r("MyAwesomeVideo.webm");
r.Open(); // Open the reader
// Get frame number 1 from the video
tr1::shared_ptr<Frame> f = r.GetFrame(1);
// Now that we have an openshot::Frame object, lets have some fun!
f->Display(); // Display the frame on the screen
f->DisplayWaveform(); // Display the audio waveform as an image
f->Play(); // Play the audio through your speaker
// Close the reader
r.Close();

Definition at line 92 of file FFmpegReader.h.

Constructor & Destructor Documentation

FFmpegReader::FFmpegReader ( string  path)
throw (InvalidFile,
NoStreamsFound,
InvalidCodec
)

Constructor for FFmpegReader. This automatically opens the media file and loads frame 1, or it throws one of the following exceptions.

Definition at line 35 of file FFmpegReader.cpp.

FFmpegReader::~FFmpegReader ( )

Destructor.

Definition at line 56 of file FFmpegReader.cpp.

Member Function Documentation

void FFmpegReader::Close ( )
virtual

Close File.

Implements openshot::ReaderBase.

Definition at line 223 of file FFmpegReader.cpp.

Cache* openshot::FFmpegReader::GetCache ( )
inlinevirtual

Get the cache object used by this reader.

Implements openshot::ReaderBase.

Definition at line 248 of file FFmpegReader.h.

tr1::shared_ptr< Frame > FFmpegReader::GetFrame ( long int  requested_frame)
throw (OutOfBoundsFrame,
ReaderClosed,
TooManySeeks
)
virtual

Get a shared pointer to a openshot::Frame object for a specific frame number of this reader.

Returns
The requested frame of video
Parameters
requested_frameThe frame number that is requested.

Implements openshot::ReaderBase.

Definition at line 412 of file FFmpegReader.cpp.

bool openshot::FFmpegReader::IsOpen ( )
inlinevirtual

Determine if reader is open or closed.

Implements openshot::ReaderBase.

Definition at line 257 of file FFmpegReader.h.

string FFmpegReader::Json ( )
virtual

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::ReaderBase.

Definition at line 1869 of file FFmpegReader.cpp.

Json::Value FFmpegReader::JsonValue ( )
virtual

Generate Json::JsonValue for this object.

Implements openshot::ReaderBase.

Definition at line 1876 of file FFmpegReader.cpp.

string openshot::FFmpegReader::Name ( )
inlinevirtual

Return the type name of the class.

Implements openshot::ReaderBase.

Definition at line 260 of file FFmpegReader.h.

void FFmpegReader::Open ( )
throw (InvalidFile,
NoStreamsFound,
InvalidCodec
)
virtual

Open File - which is called by the constructor automatically.

Implements openshot::ReaderBase.

Definition at line 122 of file FFmpegReader.cpp.

void FFmpegReader::SetJson ( string  value)
throw (InvalidJSON
)
virtual

Load JSON string into this object.

Implements openshot::ReaderBase.

Definition at line 1888 of file FFmpegReader.cpp.

void FFmpegReader::SetJsonValue ( Json::Value  root)
throw (InvalidFile
)
virtual

Load Json::JsonValue into this object.

Implements openshot::ReaderBase.

Definition at line 1911 of file FFmpegReader.cpp.

Member Data Documentation

bool openshot::FFmpegReader::enable_seek

Enable or disable seeking. Seeking can more quickly locate the requested frame, but some codecs have trouble seeking, and can introduce artifacts or blank images into the video.

Definition at line 235 of file FFmpegReader.h.

Cache openshot::FFmpegReader::final_cache

Final cache object used to hold final frames.

Definition at line 231 of file FFmpegReader.h.


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