MythTV  master
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 ()

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.

Definition at line 86 of file mythavutil.h.

Constructor & Destructor Documentation

◆ MythCodecMap()

MythCodecMap::MythCodecMap ( )

◆ ~MythCodecMap()

MythCodecMap::~MythCodecMap ( )

Definition at line 508 of file mythavutil.cpp.

Member Function Documentation

◆ 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 555 of file mythavutil.cpp.

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

◆ freeAllCodecContexts()

void MythCodecMap::freeAllCodecContexts ( )

Definition at line 567 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 98 of file mythavutil.h.

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

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