|
vdr-plugin-softhddevice-drm-gles 1.6.4-d0291bb
|
Video Decoder. More...
#include <codec_video.h>
Public Member Functions | |
| cVideoDecoder (const char *) | |
| Create a new video decoder. | |
| int | Open (enum AVCodecID, AVCodecParameters *, AVRational, bool, int, int) |
| Open the video decoder. | |
| void | Close (void) |
| Close video decoder. | |
| int | SendPacket (const AVPacket *) |
| Send a video packet to be decoded. | |
| int | ReceiveFrame (AVFrame **) |
| Receive a decoded a video frame. | |
| void | FlushBuffers (void) |
| Flush the video decoder buffers. | |
| int | ReopenCodec (enum AVCodecID, AVCodecParameters *, AVRational, int) |
| Reopen the video decoder. | |
| AVCodecContext * | GetContext (void) |
| bool | IsHardwareDecoder (void) |
| const char * | Name (void) |
| int | GetPacketsSent (void) |
| int | GetFramesReceived (void) |
| void | SetSkipKeyFramesNum (int num) |
Private Member Functions | |
| int | GetExtraData (const AVPacket *) |
| Get extradata from avpkt. | |
| bool | IsKeyFrame (AVFrame *) |
| Check, if this is a key frame. | |
Private Attributes | |
| AVCodecContext * | m_pVideoCtx = nullptr |
| video codec context | |
| const char * | m_identifier |
| identifier for logging | |
| const char * | m_pCodecString = "unknown" |
| codec (long) name string | |
| std::mutex | m_mutex |
| mutex to lock codec context | |
| int | m_cntPacketsSent |
| number of packets sent to decoder | |
| int | m_cntFramesReceived |
| number of decoded frames received from decoder | |
| int | m_cntStartKeyFrames |
| number of keyframes arrived while starting the coded (needed for amlogic h264 decoder in order to drop some frames in ReceiveFrame() before sending them to the renderer) | |
| int | m_lastCodedWidth |
| save coded width while closing for a directly reopen | |
| int | m_lastCodedHeight |
| save coded height while closing for a directly reopen | |
| int | m_skipKeyFramesNum = 0 |
| number of Keyframes (= I-Frames in VDR) to be skipped at stream start (hardware specific quirk) | |
| bool | m_isHardwareDecoder = false |
| true, if this is a hardware decoder | |
Video Decoder.
FFmpeg based Video Decoder Frontend
Handles:
Definition at line 37 of file codec_video.h.
Create a new video decoder.
| identifier | string to identify decoder for video or pip stream (used within logging only) |
Definition at line 144 of file codec_video.cpp.
References cSoftHdLogger::LogFFmpegCallback().
Close video decoder.
Definition at line 299 of file codec_video.cpp.
References L_CODEC, LOGDEBUG2, m_cntFramesReceived, m_cntPacketsSent, m_identifier, m_lastCodedHeight, m_lastCodedWidth, m_mutex, and m_pVideoCtx.
Referenced by cVideoStream::CloseDecoder(), cVideoStream::Exit(), and ReopenCodec().
Flush the video decoder buffers.
Also reset packet sent/ frame received counter
Definition at line 547 of file codec_video.cpp.
References L_CODEC, LOGDEBUG2, m_cntFramesReceived, m_cntPacketsSent, m_identifier, m_mutex, and m_pVideoCtx.
Referenced by cVideoStream::FlushDecoder().
|
inline |
Definition at line 46 of file codec_video.h.
References m_pVideoCtx.
Referenced by cVideoStream::GetVideoSize(), and cVideoStream::RenderFrame().
Get extradata from avpkt.
| avpkt | video packet |
| 0 | extradata set |
| -1 | something went wrong |
Definition at line 321 of file codec_video.cpp.
References LOGERROR, m_identifier, and m_pVideoCtx.
Referenced by SendPacket().
Definition at line 50 of file codec_video.h.
References m_cntFramesReceived.
Referenced by cVideoStream::DecodeInput().
Definition at line 49 of file codec_video.h.
References m_cntPacketsSent.
Referenced by cVideoStream::DecodeInput().
Definition at line 47 of file codec_video.h.
References m_isHardwareDecoder.
Referenced by cVideoStream::DecodeInput(), cVideoStream::FlushDecoder(), and cVideoStream::OpenDecoder().
Check, if this is a key frame.
| frame | AVFrame |
Definition at line 566 of file codec_video.cpp.
Referenced by ReceiveFrame().
Definition at line 48 of file codec_video.h.
References m_pCodecString.
Referenced by cVideoStream::OpenDecoder().
| int cVideoDecoder::Open | ( | enum AVCodecID | codecId, |
| AVCodecParameters * | par, | ||
| AVRational | timebase, | ||
| bool | forceSoftwareDecoder, | ||
| int | width, | ||
| int | height | ||
| ) |
Open the video decoder.
| codecId | video codec id |
| par | codec parameters |
| timebase | timebase |
| forceSoftwareDecoder | force software decoding |
| width | force width (only for H264 and if par is not set) |
| height | force height (only for H264 and if par is not set) |
| 0 | decoder successfully opend |
| -1 | opening the decoder failed |
Definition at line 167 of file codec_video.cpp.
References av_err2str, FindHWConfig(), FindHWDecoder(), FindSWDecoder(), GetFormat(), L_CODEC, LOGDEBUG2, LOGERROR, LOGINFO, m_cntFramesReceived, m_cntPacketsSent, m_cntStartKeyFrames, m_identifier, m_isHardwareDecoder, m_mutex, m_pCodecString, m_pVideoCtx, and Open().
Referenced by Open(), cVideoStream::OpenDecoder(), and ReopenCodec().
Receive a decoded a video frame.
| [out] | frame | decoded AVFrame |
| instance | instance name for logging |
| 0 | received frame |
| AVERROR(EAGAIN) | get no frame, send avpkt again |
| AVERROR_EOF | EOF, needs flushing |
| AVERROR(EINVAL) | get no frame, something went wrong |
| ret | return other ffmpeg error |
Definition at line 457 of file codec_video.cpp.
References av_err2str, isInterlacedFrame(), IsKeyFrame(), L_CODEC, L_PACKET, LOGDEBUG2, LOGFATAL, m_cntFramesReceived, m_cntPacketsSent, m_cntStartKeyFrames, m_identifier, m_mutex, m_pVideoCtx, m_skipKeyFramesNum, and Timestamp2String().
Referenced by cVideoStream::DecodeInput().
| int cVideoDecoder::ReopenCodec | ( | enum AVCodecID | codecId, |
| AVCodecParameters * | par, | ||
| AVRational | timebase, | ||
| int | forceSoftwareDecoding | ||
| ) |
Reopen the video decoder.
| codecId | video codec id |
| par | codec parameters |
| timebase | timebase |
| forceSoftwareDecoding | force software decoding |
| 0 | success |
| -1 | reopen decoder failed |
Definition at line 529 of file codec_video.cpp.
References Close(), L_CODEC, LOGDEBUG2, m_cntFramesReceived, m_cntPacketsSent, m_cntStartKeyFrames, m_identifier, m_lastCodedHeight, m_lastCodedWidth, m_pVideoCtx, and Open().
Referenced by cVideoStream::DecodeInput(), and cVideoStream::FlushDecoder().
Send a video packet to be decoded.
| avpkt | video packet |
| 0 | packet was sent |
| AVERROR(EAGAIN) | packet was not accepted, first receive frame and send packet again |
| AVERROR(EINVAL) | invalid input or missing m_pVideoCtx |
| ret | other ffmpeg error |
Definition at line 407 of file codec_video.cpp.
References av_err2str, GetExtraData(), L_CODEC, L_PACKET, LOGDEBUG2, m_cntPacketsSent, m_identifier, m_mutex, m_pVideoCtx, and Timestamp2String().
Referenced by cVideoStream::CheckForcingFrameDecode(), and cVideoStream::DecodeInput().
Definition at line 51 of file codec_video.h.
References m_skipKeyFramesNum.
Referenced by cVideoStream::StartDecoder().
|
private |
number of decoded frames received from decoder
Definition at line 59 of file codec_video.h.
Referenced by Close(), FlushBuffers(), GetFramesReceived(), Open(), ReceiveFrame(), and ReopenCodec().
|
private |
number of packets sent to decoder
Definition at line 58 of file codec_video.h.
Referenced by Close(), FlushBuffers(), GetPacketsSent(), Open(), ReceiveFrame(), ReopenCodec(), and SendPacket().
|
private |
number of keyframes arrived while starting the coded (needed for amlogic h264 decoder in order to drop some frames in ReceiveFrame() before sending them to the renderer)
Definition at line 60 of file codec_video.h.
Referenced by Open(), ReceiveFrame(), and ReopenCodec().
identifier for logging
Definition at line 55 of file codec_video.h.
Referenced by Close(), FlushBuffers(), GetExtraData(), Open(), ReceiveFrame(), ReopenCodec(), and SendPacket().
true, if this is a hardware decoder
Definition at line 66 of file codec_video.h.
Referenced by IsHardwareDecoder(), and Open().
|
private |
save coded height while closing for a directly reopen
Definition at line 64 of file codec_video.h.
Referenced by Close(), and ReopenCodec().
|
private |
save coded width while closing for a directly reopen
Definition at line 63 of file codec_video.h.
Referenced by Close(), and ReopenCodec().
|
private |
mutex to lock codec context
Definition at line 57 of file codec_video.h.
Referenced by Close(), FlushBuffers(), Open(), ReceiveFrame(), and SendPacket().
codec (long) name string
Definition at line 56 of file codec_video.h.
|
private |
video codec context
Definition at line 54 of file codec_video.h.
Referenced by Close(), FlushBuffers(), GetContext(), GetExtraData(), Open(), ReceiveFrame(), ReopenCodec(), and SendPacket().
|
private |
number of Keyframes (= I-Frames in VDR) to be skipped at stream start (hardware specific quirk)
Definition at line 65 of file codec_video.h.
Referenced by ReceiveFrame(), and SetSkipKeyFramesNum().