MythTV  master
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
MythCodecMap Class Reference

MythCodecMap Utility class that keeps pointers to an AVStream and its AVCodecContext. More...

#include <mythavutil.h>

Public Member Functions

 MythCodecMap ()=default
 ~MythCodecMap ()
AVCodecContext * getCodecContext (const AVStream *stream, const AVCodec *pCodec=nullptr, bool nullCodec=false)
AVCodecContext * hasCodecContext (const AVStream *stream)
void freeCodecContext (const AVStream *stream)
void freeAllCodecContexts ()

Static Public Member Functions

static MythCodecMapgetInstance ()

Protected Attributes

QMap< const AVStream *, AVCodecContext * > m_streamMap
QMutex m_mapLock {QMutex::Recursive}

Detailed Description

MythCodecMap Utility class that keeps pointers to an AVStream and its AVCodecContext.

The codec member of AVStream was previously used for this but is now deprecated.

This is a singeton class - only 1 instance gets created.

Definition at line 88 of file mythavutil.h.

Constructor & Destructor Documentation

◆ MythCodecMap()

MythCodecMap::MythCodecMap ( )

◆ ~MythCodecMap()

MythCodecMap::~MythCodecMap ( )

Definition at line 510 of file mythavutil.cpp.

Member Function Documentation

◆ getInstance()

static MythCodecMap* MythCodecMap::getInstance ( )

◆ getCodecContext()

AVCodecContext * MythCodecMap::getCodecContext ( const AVStream *  stream,
const AVCodec *  pCodec = nullptr,
bool  nullCodec = false 

◆ hasCodecContext()

AVCodecContext * MythCodecMap::hasCodecContext ( const AVStream *  stream)

◆ freeCodecContext()

void MythCodecMap::freeCodecContext ( const AVStream *  stream)
This will not free a hardware or frames context that is in anyway referenced outside of the decoder. Probably need to force the VideoOutput class to discard buffers as well. Leaking hardware contexts is a very bad idea.

Definition at line 557 of file mythavutil.cpp.

Referenced by AVFormatWriter::AddVideoStream(), ThumbFinder::closeAVCodec(), AvFormatDecoder::CloseCodecs(), avfDecoder::deinit(), freeAllCodecContexts(), MythMediaCodecContext::GetBestSupportedCodec(), getFileInfo(), MythDRMPRIMEContext::GetPrimeCodec(), MythMMALContext::GetSupportedCodec(), MythNVDECContext::GetSupportedCodec(), grabThumbnail(), AvFormatDecoder::RemoveAudioStreams(), and AvFormatDecoder::ScanStreams().

◆ freeAllCodecContexts()

void MythCodecMap::freeAllCodecContexts ( )

Definition at line 569 of file mythavutil.cpp.

Referenced by ~MythCodecMap().

Member Data Documentation

◆ m_streamMap

QMap<const AVStream*, AVCodecContext*> MythCodecMap::m_streamMap

◆ m_mapLock

QMutex MythCodecMap::m_mapLock {QMutex::Recursive}

Definition at line 101 of file mythavutil.h.

Referenced by freeAllCodecContexts(), freeCodecContext(), and getCodecContext().

The documentation for this class was generated from the following files: