18#include <libavcodec/avcodec.h>
19#include <libavcodec/bsf.h>
21#include <libavutil/pixdesc.h>
24#include <vdr/thread.h>
59 LOGDEBUG2(
L_CODEC,
"videocodec: %s: PixelFormat: %s videoCtx->pix_fmt: %s sw_pix_fmt: %s Codecname: %s",
115 if (
codec->id != codecId)
151#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,18,100)
171 int width,
int height)
251 }
else if (width && height) {
287 LOGDEBUG2(
L_CODEC,
"videocodec: %s: %s: Could not open hw decoder \"%s\", force using software decoder",
294 LOGINFO(
"videocodec: %s: %s (%s) for codec \"%s\" opened%s, using %s decoding with %d threads%s",
591#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(58,7,100)
592 return frame->key_frame;
int m_lastCodedHeight
save coded height while closing for a directly reopen
bool m_isHardwareDecoder
true, if this is a hardware 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 dro...
cMutex m_mutex
mutex to lock codec context (TODO: is this needed?)
AVCodecContext * m_pVideoCtx
video codec context
int m_cntPacketsSent
number of packets sent to decoder
int m_lastCodedWidth
save coded width while closing for a directly reopen
const char * m_pCodecString
codec (long) name string
const char * m_identifier
identifier for logging
int m_hardwareQuirks
hardware specific quirks needed for decoder
Video Decoder Header File.
#define LOGDEBUG2
log to LOG_DEBUG and add a prefix
#define LOGERROR
log to LOG_ERR
static void LogFFmpegCallback(void *, int, const char *, va_list)
Callback for ffmpeg logs.
#define LOGWARNING
log to LOG_WARN
#define LOGINFO
log to LOG_INFO
#define LOGFATAL
log to LOG_ERR and abort
static bool isInterlacedFrame(AVFrame *frame)
Check, if this is an interlaced frame.
static const char * Timestamp2String(int64_t ts, uint8_t divisor)
Nice time-stamp string.
@ L_PACKET
decoder packet/frame tracking logs
@ QUIRK_CODEC_SKIP_FIRST_FRAMES
set, if codec should skip first I-Frames
@ QUIRK_CODEC_SKIP_NUM_FRAMES
skip QUIRK_CODEC_SKIP_NUM_FRAMES, in case QUIRK_CODEC_SKIP_FIRST_FRAMES is set
@ QUIRK_CODEC_DISABLE_MPEG_HW
set, if disable mpeg hardware decoder
@ QUIRK_CODEC_DISABLE_H264_HW
set, if disable h264 hardware decoder
int ReopenCodec(enum AVCodecID, AVCodecParameters *, AVRational, int)
Reopen the video decoder.
int SendPacket(const AVPacket *)
Send a video packet to be decoded.
int Open(enum AVCodecID, AVCodecParameters *, AVRational, bool, int, int)
Open the video decoder.
static const AVCodecHWConfig * FindHWConfig(const AVCodec *codec)
Find a hardware based video decoder config.
int GetExtraData(const AVPacket *)
Get extradata from avpkt.
static enum AVPixelFormat GetFormat(AVCodecContext *videoCtx, const enum AVPixelFormat *fmt)
Callback to negotiate the PixelFormat.
void FlushBuffers(void)
Flush the video decoder buffers.
bool IsKeyFrame(AVFrame *)
Check, if this is a key frame.
int ReceiveFrame(AVFrame **)
Receive a decoded a video frame.
static const AVCodec * FindHWDecoder(enum AVCodecID codecId)
Find a suitable video codec (hardware decoding)
void Close(void)
Close video decoder.
cVideoDecoder(int, const char *)
Create a new video decoder.
static const AVCodec * FindSWDecoder(enum AVCodecID codecId)
Find a suitable video codec (software decoding)
Video Input Stream Header File.