Audio/Video decoder implementation that uses Libav as a backend. More...
#include <VideoDisplay/LibavDecoder.hpp>
Public Member Functions | |
| virtual void | close () |
| Marks the decoder for shutting down, doesn't block. | |
| virtual double | duration () const |
| First this value is based on stream headers, but might be fine-tuned after the stream reaches to the end / maybe starts a new loop cycle. More... | |
| virtual VideoFrame * | getFrame (const Timestamp &ts, ErrorFlags &errors) const |
| Gets a video frame from buffer that should be visible at the given timestamp. More... | |
| virtual Timestamp | getTimestampAt (const Radiant::TimeStamp &ts) const |
| Based on the current playback and audio state, converts an absolute wall-clock timestamp to video timestamp. More... | |
| virtual bool | isLooping () const |
| virtual Timestamp | latestDecodedVideoTimestamp () const |
| Decoder might have many frames in a buffer, this is the video timestamp of the latest decoded frame in that buffer. More... | |
| virtual void | panAudioTo (Nimble::Vector2f location) const |
| Sets audio panning to specific location. More... | |
| virtual PlayMode | playMode () const |
| virtual bool | realTimeSeeking () const |
| Special mode for low-latency seeking without buffering. More... | |
| virtual int | releaseOldVideoFrames (const Timestamp &ts, bool *eof=nullptr) |
| Deletes older video frames from the buffer, this needs to be called after the frame has been consumed, otherwise the buffer will fill quickly. More... | |
| virtual void | seek (const SeekRequest &req) |
| Schedules a seek. More... | |
| virtual void | setAudioGain (float gain) |
| Controls the gain (volume) of the video sound-track. More... | |
| virtual void | setLooping (bool doLoop) |
| virtual void | setPlayMode (PlayMode mode) |
| virtual void | setRealTimeSeeking (bool value) |
| virtual Nimble::Size | videoSize () const |
| Decoded video resolution. More... | |
| virtual Nimble::Matrix4f | yuvMatrix () const |
| YUV to RGB conversion matrix using the active video color profile. More... | |
Public Member Functions inherited from VideoDisplay::AVDecoder | |
| bool | finished () const |
| Checks if decoder has done running. More... | |
| bool | hasError () const |
| Checks if there has been an unrecoverable error. More... | |
| bool | isHeaderReady () const |
| Has the decoder opened the media file correctly. More... | |
| void | seek (double seconds) |
| Shorthand for making absolute seeking request. More... | |
| void | seekRelative (double pos) |
| Shorthand for making a relative seek request. More... | |
| void | setPreviousDecoder (std::shared_ptr< AVDecoder > decoder) |
| This decoder might require that the previous version of the decoder should be first deleted. More... | |
| DecoderState & | state () |
| Current decoder state. More... | |
| const DecoderState & | state () const |
| Current decoder state. More... | |
| virtual | ~AVDecoder () |
| Deletes the decoder, blocks until all decoder threads have died. | |
Public Member Functions inherited from Radiant::Thread | |
| bool | isRunning () const |
| Check if the thread is running. More... | |
| void | run () |
| Starts the thread. | |
| void | setName (const QString &name) |
| Set the thread name. More... | |
| Thread (const QString &name="Radiant::Thread") | |
| Construct a thread structure. More... | |
| bool | waitEnd (int timeoutms=0) |
| Waits until thread is finished. More... | |
| virtual | ~Thread () |
| Destructor. More... | |
Protected Member Functions | |
| virtual void | load (const Options &options) |
| Initializes the decoder, but doesn't start the decoder thread. More... | |
| virtual void | runDecoder () |
| Run the actual decoder, called from the decoder thread. | |
Protected Member Functions inherited from VideoDisplay::AVDecoder | |
| AVDecoder () | |
| Constructs a new empty decoder, load() function will always be called after this. | |
Additional Inherited Members | |
Public Types inherited from VideoDisplay::AVDecoder | |
| typedef Valuable::State< State > | DecoderState |
| State class used in the decoder. | |
|
typedef Radiant::FlagsT < ErrorFlagsEnum > | ErrorFlags |
| enum | ErrorFlagsEnum { ERROR_VIDEO_FRAME_BUFFER_UNDERRUN = 1 << 0 } |
| enum | PlayMode { PAUSE, PLAY } |
| Decoder playing state. More... | |
| enum | SeekDirection { SEEK_ANY_DIRECTION = 0, SEEK_ONLY_FORWARD, SEEK_ONLY_BACKWARD } |
| Seeking direction constraint for SeekRequest. More... | |
| enum | SeekFlags { SEEK_FLAGS_NONE = 0, SEEK_REAL_TIME } |
| Seeking flags. More... | |
| enum | SeekType { SEEK_NONE = 0, SEEK_BY_SECONDS, SEEK_RELATIVE, SEEK_BY_BYTES } |
| Describes the unit used in SeekRequest. More... | |
| enum | State { STATE_LOADING = 1 << 1, STATE_HEADER_READY = 1 << 2, STATE_READY = 1 << 3, STATE_ERROR = 1 << 4, STATE_FINISHED = 1 << 5 } |
| AVDecoder loading state. More... | |
Static Public Member Functions inherited from VideoDisplay::AVDecoder | |
| static std::shared_ptr< AVDecoder > | create (const Options &options, const QString &backend="") |
| Creates a new decoder and loads it with given options. More... | |
Audio/Video decoder implementation that uses Libav as a backend.
|
virtual |
First this value is based on stream headers, but might be fine-tuned after the stream reaches to the end / maybe starts a new loop cycle.
Implements VideoDisplay::AVDecoder.
|
virtual |
Gets a video frame from buffer that should be visible at the given timestamp.
If this frame can't be found, then the closest frame will be used.
| ts | video timestamp | |
| [out] | errors | ErrorFlags |
Implements VideoDisplay::AVDecoder.
|
virtual |
Based on the current playback and audio state, converts an absolute wall-clock timestamp to video timestamp.
This is most useful for video/audio synchronization
| ts | real (wall-clock) timestamp |
Implements VideoDisplay::AVDecoder.
|
virtual |
Implements VideoDisplay::AVDecoder.
|
virtual |
Decoder might have many frames in a buffer, this is the video timestamp of the latest decoded frame in that buffer.
Implements VideoDisplay::AVDecoder.
|
protectedvirtual |
Initializes the decoder, but doesn't start the decoder thread.
| options | opening options |
Implements VideoDisplay::AVDecoder.
|
virtual |
Sets audio panning to specific location.
| location | 2D location of the audio |
Implements VideoDisplay::AVDecoder.
|
virtual |
Implements VideoDisplay::AVDecoder.
|
virtual |
Special mode for low-latency seeking without buffering.
This should be used only with certain UI elements, where the seeking target might change in real-time. When in real-time seeking mode, the video acts like it's paused
Implements VideoDisplay::AVDecoder.
|
virtual |
Deletes older video frames from the buffer, this needs to be called after the frame has been consumed, otherwise the buffer will fill quickly.
| ts | timestamp of the previous consumed frame |
| eof | null or pointer to bool that will be set to true if the stream is at EOF |
Implements VideoDisplay::AVDecoder.
|
virtual |
Schedules a seek.
If the previous request is still waiting, new request will replace the old one
| req | new seek request |
Implements VideoDisplay::AVDecoder.
|
virtual |
Controls the gain (volume) of the video sound-track.
| gain | new audio gain, typical range is 0-1, although larger values can be used as well. Default value is 1. |
Implements VideoDisplay::AVDecoder.
|
virtual |
| doLoop | new looping mode |
Implements VideoDisplay::AVDecoder.
|
virtual |
| mode | new play mode |
Implements VideoDisplay::AVDecoder.
|
virtual |
| value | true if real-time seeking is asked |
Implements VideoDisplay::AVDecoder.
|
virtual |
Decoded video resolution.
Will return invalid Nimble::Size if isHeaderReady returns false, we are not decoding a video stream, or if video decoding is disabled.
Implements VideoDisplay::AVDecoder.
|
virtual |
YUV to RGB conversion matrix using the active video color profile.
This can be used directly in GLSL: vec4 rgb = m * vec4(y, u, v, 1.0);
Implements VideoDisplay::AVDecoder.