diff --git a/app/decoder/decoder.cpp b/app/decoder/decoder.cpp index d0e1732af..1659614d9 100644 --- a/app/decoder/decoder.cpp +++ b/app/decoder/decoder.cpp @@ -55,6 +55,26 @@ void Decoder::set_stream(StreamPtr fs) stream_ = fs; } +FramePtr Decoder::RetrieveVideo(const rational &/*timecode*/) +{ + return nullptr; +} + +FramePtr Decoder::RetrieveAudio(const rational &/*timecode*/, const rational &/*length*/, const AudioRenderingParams &/*params*/) +{ + return nullptr; +} + +bool Decoder::SupportsVideo() +{ + return false; +} + +bool Decoder::SupportsAudio() +{ + return false; +} + /* * DECODER STATIC PUBLIC MEMBERS */ diff --git a/app/decoder/decoder.h b/app/decoder/decoder.h index 6e7db488a..3e0d8ef3e 100644 --- a/app/decoder/decoder.h +++ b/app/decoder/decoder.h @@ -107,10 +107,33 @@ public: virtual bool Open() = 0; /** - * @brief Retrieve frame/data + * @brief Retrieve video frame * - * The main function for retrieving data from the Decoder. This function should always provide complete frame data - * (i.e. no partial frames or missing samples) at the timecode provided. The Decoder should perform any steps + * The main function for retrieving video data from the Decoder. This function should always provide complete frame + * data (i.e. no partial frames) at the timecode provided. The Decoder should perform any steps required to retrieve + * a complete frame separate from the rest of the program, using any form of caching/indexing to keep this as + * performant as possible. + * + * It's acceptable for this function to check whether the Decoder is open, and call Open() if not. If Open() returns + * false, this function should return nullptr. + * + * @param timecode + * + * The timecode (a rational in seconds) to retrieve the frame at. If there is not a frame at this precise location + * this should be corrected internally to the closest fit for the timecode. + * + * @return + * + * A FramePtr of valid data at this timecode or nullptr if there was nothing to retrieve at the provided timecode or + * the media could not be opened. + */ + virtual FramePtr RetrieveVideo(const rational& timecode); + + /** + * @brief Retrieve video frame + * + * The main function for retrieving audio data from the Decoder. This function should always provide complete frame + * data (i.e. no missing samples) at the timecode and length requested. The Decoder should perform any steps * required to retrieve a complete frame separate from the rest of the program, using any form of caching/indexing * to keep this as performant as possible. * @@ -119,18 +142,21 @@ public: * * @param timecode * - * The timecode (a rational in seconds) to retrieve the data at. + * The starting timecode (a rational in seconds) to retrieve the data at. * * @param length * - * Audio only - ignored for video decoders. The total length of audio data to retrieve (a rational in seconds). + * The total length of audio data to retrieve (a rational in seconds). * * @return * - * A FramePtr of valid data at this timecode (of the requested length if this is audio media), or nullptr if there - * was nothing to retrieve at the provided timecode or the media could not be opened. + * A FramePtr of valid data at this timecode of the requested length or nullptr if there was nothing to retrieve at + * the provided timecode or the media could not be opened. */ - virtual FramePtr Retrieve(const rational& timecode, const rational& length = 0) = 0; + virtual FramePtr RetrieveAudio(const rational& timecode, const rational& length, const AudioRenderingParams& params); + + virtual bool SupportsVideo(); + virtual bool SupportsAudio(); /** * @brief Close media/deallocate memory