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 85 of file mythavutil.h.

Constructor & Destructor Documentation

◆ MythCodecMap()

MythCodecMap::MythCodecMap ( )
default

◆ ~MythCodecMap()

MythCodecMap::~MythCodecMap ( )

Definition at line 507 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)
Note
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 554 of file mythavutil.cpp.

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

◆ freeAllCodecContexts()

void MythCodecMap::freeAllCodecContexts ( )

Definition at line 566 of file mythavutil.cpp.

Referenced by ~MythCodecMap().

Member Data Documentation

◆ m_streamMap

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

◆ m_mapLock

QMutex MythCodecMap::m_mapLock {QMutex::Recursive}
protected

Definition at line 97 of file mythavutil.h.

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


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