MythTV  master
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MythAVFormatWriter Class Reference

#include <mythavformatwriter.h>

Inheritance diagram for MythAVFormatWriter:
Inheritance graph
[legend]
Collaboration diagram for MythAVFormatWriter:
Collaboration graph
[legend]

Public Member Functions

 MythAVFormatWriter ()=default
 
 ~MythAVFormatWriter () override
 
bool Init (void) override
 
bool OpenFile (void) override
 
bool CloseFile (void) override
 
int WriteVideoFrame (MythVideoFrame *Frame) override
 
int WriteAudioFrame (unsigned char *Buffer, int FrameNumber, std::chrono::milliseconds &Timecode) override
 
int WriteTextFrame (int VBIMode, unsigned char *Buffer, int Length, std::chrono::milliseconds Timecode, int PageNumber) override
 
int WriteSeekTable (void) override
 
bool SwitchToNextFile (void) override
 
bool NextFrameIsKeyFrame (void)
 
bool ReOpen (const QString &Filename)
 
- Public Member Functions inherited from MythMediaWriter
 MythMediaWriter ()=default
 
virtual ~MythMediaWriter ()=default
 
void SetFilename (const QString &FileName)
 
void SetContainer (const QString &Cont)
 
void SetVideoCodec (const QString &Codec)
 
void SetVideoBitrate (int Bitrate)
 
void SetWidth (int Width)
 
void SetHeight (int Height)
 
void SetAspect (float Aspect)
 
void SetFramerate (double Rate)
 
void SetKeyFrameDist (int Dist)
 
void SetAudioCodec (const QString &Codec)
 
void SetAudioBitrate (int Bitrate)
 
void SetAudioChannels (int Channels)
 
void SetAudioFrameRate (int Rate)
 
void SetAudioFormat (AudioFormat Format)
 
void SetThreadCount (int Count)
 
void SetTimecodeOffset (std::chrono::milliseconds Offset)
 
void SetEncodingPreset (const QString &Preset)
 
void SetEncodingTune (const QString &Tune)
 
long long GetFramesWritten (void) const
 
std::chrono::milliseconds GetTimecodeOffset (void) const
 
int GetAudioFrameSize (void) const
 

Private Member Functions

AVStream * AddVideoStream (void)
 
bool OpenVideo (void)
 
AVStream * AddAudioStream (void)
 
bool OpenAudio (void)
 
AVFrameAllocPicture (enum AVPixelFormat PixFmt)
 
void Cleanup (void)
 
AVRational GetCodecTimeBase (void)
 

Static Private Member Functions

static bool FindAudioFormat (AVCodecContext *Ctx, const AVCodec *Codec, AVSampleFormat Format)
 

Private Attributes

MythAVFormatBufferm_avfBuffer { nullptr }
 
MythMediaBufferm_buffer { nullptr }
 
AVOutputFormat m_fmt { }
 
AVFormatContext * m_ctx { nullptr }
 
MythCodecMap m_codecMap
 
AVStream * m_videoStream { nullptr }
 
const AVCodec * m_avVideoCodec { nullptr }
 
AVStream * m_audioStream { nullptr }
 
const AVCodec * m_avAudioCodec { nullptr }
 
AVFramem_picture { nullptr }
 
AVFramem_audPicture { nullptr }
 
unsigned char * m_audioInBuf { nullptr }
 
unsigned char * m_audioInPBuf { nullptr }
 
QList< std::chrono::milliseconds > m_bufferedVideoFrameTimes
 
QList< int > m_bufferedVideoFrameTypes
 
QList< std::chrono::milliseconds > m_bufferedAudioFrameTimes
 

Additional Inherited Members

- Protected Attributes inherited from MythMediaWriter
QString m_filename
 
QString m_container
 
QString m_videoCodec
 
int m_videoBitrate { 800000 }
 
int m_width { 0 }
 
int m_height { 0 }
 
float m_aspect { 1.333333F }
 
double m_frameRate { 29.97 }
 
int m_keyFrameDist { 15 }
 
QString m_audioCodec
 
int m_audioBitrate { 0 }
 
int m_audioChannels { 2 }
 
int m_audioFrameRate { 48000 }
 
AudioFormat m_audioFormat { FORMAT_S16 }
 
int m_audioFrameSize { -1 }
 
int m_encodingThreadCount { 1 }
 
long long m_framesWritten { 0 }
 
std::chrono::milliseconds m_startingTimecodeOffset { -1ms }
 
QString m_encodingPreset
 
QString m_encodingTune
 

Detailed Description

Definition at line 19 of file mythavformatwriter.h.

Constructor & Destructor Documentation

◆ MythAVFormatWriter()

MythAVFormatWriter::MythAVFormatWriter ( )
default

◆ ~MythAVFormatWriter()

MythAVFormatWriter::~MythAVFormatWriter ( )
override

Definition at line 45 of file mythavformatwriter.cpp.

Member Function Documentation

◆ Init()

bool MythAVFormatWriter::Init ( void  )
overridevirtual

Implements MythMediaWriter.

Definition at line 64 of file mythavformatwriter.cpp.

◆ OpenFile()

bool MythAVFormatWriter::OpenFile ( void  )
overridevirtual

Implements MythMediaWriter.

Definition at line 139 of file mythavformatwriter.cpp.

◆ CloseFile()

bool MythAVFormatWriter::CloseFile ( void  )
overridevirtual

Implements MythMediaWriter.

Definition at line 184 of file mythavformatwriter.cpp.

◆ WriteVideoFrame()

int MythAVFormatWriter::WriteVideoFrame ( MythVideoFrame Frame)
overridevirtual

Implements MythMediaWriter.

Definition at line 203 of file mythavformatwriter.cpp.

◆ WriteAudioFrame()

int MythAVFormatWriter::WriteAudioFrame ( unsigned char *  Buffer,
int  FrameNumber,
std::chrono::milliseconds &  Timecode 
)
overridevirtual

Implements MythMediaWriter.

Definition at line 286 of file mythavformatwriter.cpp.

◆ WriteTextFrame()

int MythAVFormatWriter::WriteTextFrame ( int  VBIMode,
unsigned char *  Buffer,
int  Length,
std::chrono::milliseconds  Timecode,
int  PageNumber 
)
overridevirtual

Implements MythMediaWriter.

Definition at line 393 of file mythavformatwriter.cpp.

◆ WriteSeekTable()

int MythAVFormatWriter::WriteSeekTable ( void  )
overridevirtual

Implements MythMediaWriter.

Definition at line 399 of file mythavformatwriter.cpp.

◆ SwitchToNextFile()

bool MythAVFormatWriter::SwitchToNextFile ( void  )
overridevirtual

Implements MythMediaWriter.

Definition at line 404 of file mythavformatwriter.cpp.

◆ NextFrameIsKeyFrame()

bool MythAVFormatWriter::NextFrameIsKeyFrame ( void  )

Definition at line 197 of file mythavformatwriter.cpp.

◆ ReOpen()

bool MythAVFormatWriter::ReOpen ( const QString &  Filename)

Definition at line 409 of file mythavformatwriter.cpp.

◆ AddVideoStream()

AVStream * MythAVFormatWriter::AddVideoStream ( void  )
private

Definition at line 417 of file mythavformatwriter.cpp.

Referenced by Init().

◆ OpenVideo()

bool MythAVFormatWriter::OpenVideo ( void  )
private

Definition at line 535 of file mythavformatwriter.cpp.

Referenced by Init().

◆ AddAudioStream()

AVStream * MythAVFormatWriter::AddAudioStream ( void  )
private

Definition at line 564 of file mythavformatwriter.cpp.

Referenced by Init().

◆ OpenAudio()

bool MythAVFormatWriter::OpenAudio ( void  )
private

Definition at line 614 of file mythavformatwriter.cpp.

Referenced by Init().

◆ AllocPicture()

AVFrame * MythAVFormatWriter::AllocPicture ( enum AVPixelFormat  PixFmt)
private

Definition at line 667 of file mythavformatwriter.cpp.

Referenced by OpenVideo().

◆ Cleanup()

void MythAVFormatWriter::Cleanup ( void  )
private

Definition at line 174 of file mythavformatwriter.cpp.

Referenced by OpenFile(), and ~MythAVFormatWriter().

◆ GetCodecTimeBase()

AVRational MythAVFormatWriter::GetCodecTimeBase ( void  )
private

Definition at line 689 of file mythavformatwriter.cpp.

Referenced by AddAudioStream(), and AddVideoStream().

◆ FindAudioFormat()

bool MythAVFormatWriter::FindAudioFormat ( AVCodecContext *  Ctx,
const AVCodec *  Codec,
AVSampleFormat  Format 
)
staticprivate

Definition at line 598 of file mythavformatwriter.cpp.

Referenced by OpenAudio().

Member Data Documentation

◆ m_avfBuffer

MythAVFormatBuffer* MythAVFormatWriter::m_avfBuffer { nullptr }
private

Definition at line 48 of file mythavformatwriter.h.

Referenced by Cleanup(), and OpenFile().

◆ m_buffer

MythMediaBuffer* MythAVFormatWriter::m_buffer { nullptr }
private

Definition at line 49 of file mythavformatwriter.h.

Referenced by Cleanup(), OpenFile(), and ReOpen().

◆ m_fmt

AVOutputFormat MythAVFormatWriter::m_fmt { }
private

Definition at line 50 of file mythavformatwriter.h.

Referenced by Init(), and OpenFile().

◆ m_ctx

AVFormatContext* MythAVFormatWriter::m_ctx { nullptr }
private

◆ m_codecMap

MythCodecMap MythAVFormatWriter::m_codecMap
private

◆ m_videoStream

AVStream* MythAVFormatWriter::m_videoStream { nullptr }
private

Definition at line 53 of file mythavformatwriter.h.

Referenced by Init(), OpenVideo(), WriteAudioFrame(), and WriteVideoFrame().

◆ m_avVideoCodec

const AVCodec* MythAVFormatWriter::m_avVideoCodec { nullptr }
private

Definition at line 54 of file mythavformatwriter.h.

Referenced by AddAudioStream(), GetCodecTimeBase(), Init(), and WriteAudioFrame().

◆ m_audioStream

AVStream* MythAVFormatWriter::m_audioStream { nullptr }
private

Definition at line 55 of file mythavformatwriter.h.

Referenced by Init(), OpenAudio(), and WriteAudioFrame().

◆ m_avAudioCodec

const AVCodec* MythAVFormatWriter::m_avAudioCodec { nullptr }
private

Definition at line 56 of file mythavformatwriter.h.

Referenced by Init().

◆ m_picture

AVFrame* MythAVFormatWriter::m_picture { nullptr }
private

Definition at line 57 of file mythavformatwriter.h.

Referenced by OpenVideo(), WriteVideoFrame(), and ~MythAVFormatWriter().

◆ m_audPicture

AVFrame* MythAVFormatWriter::m_audPicture { nullptr }
private

Definition at line 58 of file mythavformatwriter.h.

Referenced by OpenAudio(), WriteAudioFrame(), and ~MythAVFormatWriter().

◆ m_audioInBuf

unsigned char* MythAVFormatWriter::m_audioInBuf { nullptr }
private

Definition at line 59 of file mythavformatwriter.h.

Referenced by OpenAudio(), WriteAudioFrame(), and ~MythAVFormatWriter().

◆ m_audioInPBuf

unsigned char* MythAVFormatWriter::m_audioInPBuf { nullptr }
private

Definition at line 60 of file mythavformatwriter.h.

Referenced by OpenAudio(), WriteAudioFrame(), and ~MythAVFormatWriter().

◆ m_bufferedVideoFrameTimes

QList<std::chrono::milliseconds> MythAVFormatWriter::m_bufferedVideoFrameTimes
private

Definition at line 61 of file mythavformatwriter.h.

Referenced by WriteVideoFrame().

◆ m_bufferedVideoFrameTypes

QList<int> MythAVFormatWriter::m_bufferedVideoFrameTypes
private

Definition at line 62 of file mythavformatwriter.h.

Referenced by NextFrameIsKeyFrame(), and WriteVideoFrame().

◆ m_bufferedAudioFrameTimes

QList<std::chrono::milliseconds> MythAVFormatWriter::m_bufferedAudioFrameTimes
private

Definition at line 63 of file mythavformatwriter.h.

Referenced by WriteAudioFrame().


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