20#include <libavcodec/avcodec.h>
21#include <libavcodec/bsf.h>
23#include <libavutil/pixdesc.h>
55 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)
178 auto now = std::chrono::steady_clock::now();
267 LOGDEBUG2(
L_CODEC,
"videocodec: %s: %s: Could not open hw decoder \"%s\", force using software decoder",
275 LOGDEBUG(
"videocodec: %s: %s (%s) for codec \"%s\" opened%s, using %s decoding with %d threads%s",
288 now = std::chrono::steady_clock::now();
438 auto now = std::chrono::steady_clock::now();
493 auto now = std::chrono::steady_clock::now();
static void LogFFmpegCallback(void *, int, const char *, va_list)
Callback for ffmpeg logs.
cVideoDecoder(const char *)
Create a new video decoder.
int ReopenCodec(enum AVCodecID, AVCodecParameters *, AVRational, int)
Reopen the video decoder.
bool m_isHardwareDecoder
true, if this is a hardware decoder
int SendPacket(const AVPacket *)
Send a video packet to be decoded.
int m_cntFramesReceived
number of decoded frames received from decoder
int GetExtraData(const AVPacket *)
Get extradata from avpkt.
int Open(enum AVCodecID, AVCodecParameters *, AVRational, bool)
Open the video decoder.
void FlushBuffers(void)
Flush the video decoder buffers.
void ResetPacketCounter(void)
std::mutex m_mutex
mutex to lock codec context
AVCodecContext * m_pVideoCtx
video codec context
int m_cntPacketsSent
number of packets sent to decoder
const char * m_pCodecString
codec (long) name string
const char * m_identifier
identifier for logging
int ReceiveFrame(AVFrame **)
Receive a decoded a video frame.
void Close(void)
Close video decoder.
Video Decoder Header File.
#define LOGDEBUG2
log to LOG_DEBUG and add a prefix
#define LOGDEBUG
log to LOG_DEBUG
#define LOGERROR
log to LOG_ERR
#define LOGWARNING
log to LOG_WARN
#define LOGGER
shortcut to the logger
#define LOGFATAL
log to LOG_ERR and abort
static const char * Timestamp2StringPts(int64_t ts)
Input PTS is in PTSTICKS.
static bool isInterlacedFrame(AVFrame *frame)
Check, if this is an interlaced frame.
@ L_PACKET
decoder packet/frame tracking logs
@ L_AV_SYNC
audio/video sync logs
static const AVCodecHWConfig * FindHWConfig(const AVCodec *codec)
Find a hardware based video decoder config.
static enum AVPixelFormat GetFormat(AVCodecContext *videoCtx, const enum AVPixelFormat *fmt)
Callback to negotiate the PixelFormat.
static const AVCodec * FindHWDecoder(enum AVCodecID codecId)
Find a suitable video codec (hardware decoding)
static const AVCodec * FindSWDecoder(enum AVCodecID codecId)
Find a suitable video codec (software decoding)