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

#include <mpeg2fix.h>

Collaboration diagram for MPEG2fixup:
Collaboration graph
[legend]

Public Member Functions

 MPEG2fixup (const QString &inf, const QString &outf, frm_dir_map_t *deleteMap, const char *fmt, bool norp, bool fixPTS, int maxf, bool showprog, int otype, void(*update_func)(float)=nullptr, int(*check_func)()=nullptr)
 
 ~MPEG2fixup ()
 
int Start ()
 
void AddRangeList (const QStringList &rangelist, int type)
 
int BuildKeyframeIndex (QString &file, frm_pos_map_t &posMap, frm_pos_map_t &durMap)
 
void SetAllAudio (bool keep)
 

Static Public Member Functions

static void ShowRangeMap (frm_dir_map_t *mapPtr, QString msg)
 
static void dec2x33 (int64_t *pts1, int64_t pts2)
 
static void inc2x33 (int64_t *pts1, int64_t pts2)
 
static int64_t udiff2x33 (int64_t pts1, int64_t pts2)
 
static int64_t diff2x33 (int64_t pts1, int64_t pts2)
 
static int64_t add2x33 (int64_t pts1, int64_t pts2)
 
static int cmp2x33 (int64_t pts1, int64_t pts2)
 

Static Protected Member Functions

static void * ReplexStart (void *data)
 

Protected Attributes

MPEG2replex m_rx
 

Private Member Functions

void InitReplex ()
 
void FrameInfo (MPEG2frame *f)
 
int AddFrame (MPEG2frame *f)
 
bool InitAV (const QString &inputfile, const char *type, int64_t offset)
 
void ScanAudio ()
 
int ProcessVideo (MPEG2frame *vf, mpeg2dec_t *dec)
 
void WriteFrame (const QString &filename, MPEG2frame *f)
 
void WriteFrame (const QString &filename, AVPacket *pkt)
 
bool BuildFrame (AVPacket *pkt, const QString &fname)
 
MPEG2frameGetPoolFrame (AVPacket *pkt)
 
MPEG2frameGetPoolFrame (MPEG2frame *f)
 
int GetFrame (AVPacket *pkt)
 
bool FindStart ()
 
MPEG2frameFindFrameNum (int frameNum)
 
void RenumberFrames (int start_pos, int delta)
 
void StoreSecondary ()
 
int PlaybackSecondary ()
 
MPEG2frameDecodeToFrame (int frameNum, int skip_reset)
 
int ConvertToI (FrameList *orderedFrames, int headPos)
 
int InsertFrame (int frameNum, int64_t deltaPTS, int64_t ptsIncrement, int64_t initPTS)
 
void AddSequence (MPEG2frame *frame1, MPEG2frame *frame2)
 
void InitialPTSFixup (MPEG2frame *curFrame, int64_t &origvPTS, int64_t &PTSdiscrep, int numframes, bool fix) const
 
int GetStreamType (int id) const
 
AVCodecContext * getCodecContext (uint id)
 
AVCodecParserContext * getCodecParserContext (uint id)
 

Static Private Member Functions

static int FindMPEG2Header (const uint8_t *buf, int size, uint8_t code)
 
static void WriteYUV (const QString &filename, const mpeg2_info_t *info)
 
static void WriteData (const QString &filename, uint8_t *data, int size)
 
static void SetRepeat (MPEG2frame *vf, int nb_fields, bool topff)
 
static void SetRepeat (uint8_t *ptr, int size, int fields, bool topff)
 
static FrameList ReorderDTStoPTS (FrameList *dtsOrder, int pos)
 
static void SetFrameNum (uint8_t *ptr, int num)
 
static int GetFrameNum (const MPEG2frame *frame)
 
static int GetFrameTypeN (const MPEG2frame *frame)
 
static char GetFrameTypeT (const MPEG2frame *frame)
 
static int GetNbFields (const MPEG2frame *frame)
 
static void dumpList (FrameList *list)
 

Private Attributes

int(* m_checkAbort )()
 
void(* m_updateStatus )(float percent_done)
 
FrameList m_vSecondary
 
bool m_useSecondary {false}
 
FrameList m_vFrame
 
FrameMap m_aFrame
 
FrameQueue m_framePool
 
FrameQueue m_unreadFrames
 
int m_displayFrame {0}
 
mpeg2dec_t * m_headerDecoder {nullptr}
 
mpeg2dec_t * m_imgDecoder {nullptr}
 
frm_dir_map_t m_delMap
 
frm_dir_map_t m_saveMap
 
pthread_t m_thread {}
 
MythCodecMap m_codecMap {}
 
AVFormatContext * m_inputFC {nullptr}
 
AVFramem_picture {nullptr}
 
int m_vidId {-1}
 
int m_extCount {0}
 
QMap< int, int > m_audMap
 
int64_t m_ptsIncrement {0}
 
bool m_mkvFile {false}
 
bool m_discard {false}
 
bool m_noRepeat
 
bool m_fixPts
 
int m_maxFrames
 
QString m_infile
 
const char * m_format {nullptr}
 
bool m_allAudio {false}
 
bool m_fileEnd {false}
 
bool m_realFileEnd {false}
 
QDateTime m_statusTime
 
bool m_showProgress {false}
 
uint64_t m_fileSize {0}
 
int m_frameNum {0}
 
int m_statusUpdateTime {5}
 
uint64_t m_lastWrittenPos {0}
 
uint16_t m_invZigzagDirect16 [64] {}
 
bool m_zigzagInit {false}
 

Detailed Description

Definition at line 117 of file mpeg2fix.h.

Constructor & Destructor Documentation

◆ MPEG2fixup()

MPEG2fixup::MPEG2fixup ( const QString &  inf,
const QString &  outf,
frm_dir_map_t deleteMap,
const char *  fmt,
bool  norp,
bool  fixPTS,
int  maxf,
bool  showprog,
int  otype,
void(*)(float)  update_func = nullptr,
int(*)()  check_func = nullptr 
)

Definition at line 232 of file mpeg2fix.cpp.

◆ ~MPEG2fixup()

MPEG2fixup::~MPEG2fixup ( )

Definition at line 310 of file mpeg2fix.cpp.

Member Function Documentation

◆ Start()

int MPEG2fixup::Start ( )

Definition at line 2012 of file mpeg2fix.cpp.

◆ AddRangeList()

void MPEG2fixup::AddRangeList ( const QStringList &  rangelist,
int  type 
)

Definition at line 1874 of file mpeg2fix.cpp.

◆ ShowRangeMap()

void MPEG2fixup::ShowRangeMap ( frm_dir_map_t mapPtr,
QString  msg 
)
static

Definition at line 1917 of file mpeg2fix.cpp.

Referenced by Start().

◆ BuildKeyframeIndex()

int MPEG2fixup::BuildKeyframeIndex ( QString &  file,
frm_pos_map_t posMap,
frm_pos_map_t durMap 
)

Definition at line 2748 of file mpeg2fix.cpp.

Referenced by BuildKeyframeIndex().

◆ SetAllAudio()

void MPEG2fixup::SetAllAudio ( bool  keep)
inline

Definition at line 130 of file mpeg2fix.h.

◆ dec2x33()

void MPEG2fixup::dec2x33 ( int64_t *  pts1,
int64_t  pts2 
)
static

Definition at line 372 of file mpeg2fix.cpp.

Referenced by Start().

◆ inc2x33()

void MPEG2fixup::inc2x33 ( int64_t *  pts1,
int64_t  pts2 
)
static

Definition at line 377 of file mpeg2fix.cpp.

Referenced by InsertFrame().

◆ udiff2x33()

int64_t MPEG2fixup::udiff2x33 ( int64_t  pts1,
int64_t  pts2 
)
static

Definition at line 382 of file mpeg2fix.cpp.

Referenced by dec2x33(), and Start().

◆ diff2x33()

int64_t MPEG2fixup::diff2x33 ( int64_t  pts1,
int64_t  pts2 
)
static

Definition at line 393 of file mpeg2fix.cpp.

Referenced by FindStart(), InitialPTSFixup(), PTSOffsetQueue::SetNextPos(), and Start().

◆ add2x33()

int64_t MPEG2fixup::add2x33 ( int64_t  pts1,
int64_t  pts2 
)
static

Definition at line 418 of file mpeg2fix.cpp.

Referenced by Start().

◆ cmp2x33()

int MPEG2fixup::cmp2x33 ( int64_t  pts1,
int64_t  pts2 
)
static

Definition at line 426 of file mpeg2fix.cpp.

Referenced by diff2x33(), FindStart(), and Start().

◆ ReplexStart()

void * MPEG2fixup::ReplexStart ( void *  data)
staticprotected

Definition at line 521 of file mpeg2fix.cpp.

Referenced by MPEG2fixup().

◆ FindMPEG2Header()

int MPEG2fixup::FindMPEG2Header ( const uint8_t *  buf,
int  size,
uint8_t  code 
)
staticprivate

Definition at line 449 of file mpeg2fix.cpp.

Referenced by BuildFrame().

◆ InitReplex()

void MPEG2fixup::InitReplex ( )
private

Definition at line 578 of file mpeg2fix.cpp.

Referenced by Start().

◆ FrameInfo()

void MPEG2fixup::FrameInfo ( MPEG2frame f)
private

Definition at line 647 of file mpeg2fix.cpp.

Referenced by AddFrame().

◆ AddFrame()

int MPEG2fixup::AddFrame ( MPEG2frame f)
private

Definition at line 663 of file mpeg2fix.cpp.

Referenced by Start().

◆ InitAV()

bool MPEG2fixup::InitAV ( const QString &  inputfile,
const char *  type,
int64_t  offset 
)
private

Definition at line 770 of file mpeg2fix.cpp.

Referenced by BuildKeyframeIndex(), and Start().

◆ ScanAudio()

void MPEG2fixup::ScanAudio ( )
private

◆ ProcessVideo()

int MPEG2fixup::ProcessVideo ( MPEG2frame vf,
mpeg2dec_t *  dec 
)
private

◆ WriteFrame() [1/2]

void MPEG2fixup::WriteFrame ( const QString &  filename,
MPEG2frame f 
)
private

Definition at line 1029 of file mpeg2fix.cpp.

Referenced by AddSequence(), BuildFrame(), and Start().

◆ WriteFrame() [2/2]

void MPEG2fixup::WriteFrame ( const QString &  filename,
AVPacket *  pkt 
)
private

Definition at line 1049 of file mpeg2fix.cpp.

◆ WriteYUV()

void MPEG2fixup::WriteYUV ( const QString &  filename,
const mpeg2_info_t *  info 
)
staticprivate

Definition at line 1075 of file mpeg2fix.cpp.

Referenced by BuildFrame(), and WriteFrame().

◆ WriteData()

void MPEG2fixup::WriteData ( const QString &  filename,
uint8_t *  data,
int  size 
)
staticprivate

Definition at line 1114 of file mpeg2fix.cpp.

Referenced by BuildFrame(), ProcessVideo(), and WriteFrame().

◆ BuildFrame()

bool MPEG2fixup::BuildFrame ( AVPacket *  pkt,
const QString &  fname 
)
private

Definition at line 1132 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ GetPoolFrame() [1/2]

MPEG2frame * MPEG2fixup::GetPoolFrame ( AVPacket *  pkt)
private

Definition at line 1307 of file mpeg2fix.cpp.

Referenced by DecodeToFrame(), GetFrame(), GetPoolFrame(), InsertFrame(), and WriteFrame().

◆ GetPoolFrame() [2/2]

MPEG2frame * MPEG2fixup::GetPoolFrame ( MPEG2frame f)
private

Definition at line 1330 of file mpeg2fix.cpp.

◆ GetFrame()

int MPEG2fixup::GetFrame ( AVPacket *  pkt)
private

Definition at line 1344 of file mpeg2fix.cpp.

Referenced by FindStart(), and Start().

◆ FindStart()

bool MPEG2fixup::FindStart ( )
private

Definition at line 1461 of file mpeg2fix.cpp.

Referenced by Start().

◆ SetRepeat() [1/2]

void MPEG2fixup::SetRepeat ( MPEG2frame vf,
int  nb_fields,
bool  topff 
)
staticprivate

Definition at line 1587 of file mpeg2fix.cpp.

Referenced by BuildFrame(), and Start().

◆ SetRepeat() [2/2]

void MPEG2fixup::SetRepeat ( uint8_t *  ptr,
int  size,
int  fields,
bool  topff 
)
staticprivate

Definition at line 1594 of file mpeg2fix.cpp.

◆ FindFrameNum()

MPEG2frame * MPEG2fixup::FindFrameNum ( int  frameNum)
private

Definition at line 1624 of file mpeg2fix.cpp.

Referenced by DecodeToFrame().

◆ RenumberFrames()

void MPEG2fixup::RenumberFrames ( int  start_pos,
int  delta 
)
private

Definition at line 1635 of file mpeg2fix.cpp.

Referenced by InsertFrame(), and Start().

◆ StoreSecondary()

void MPEG2fixup::StoreSecondary ( )
private

Definition at line 1647 of file mpeg2fix.cpp.

Referenced by Start().

◆ PlaybackSecondary()

int MPEG2fixup::PlaybackSecondary ( )
private

Definition at line 1663 of file mpeg2fix.cpp.

Referenced by ConvertToI().

◆ DecodeToFrame()

MPEG2frame * MPEG2fixup::DecodeToFrame ( int  frameNum,
int  skip_reset 
)
private

Definition at line 1676 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ ConvertToI()

int MPEG2fixup::ConvertToI ( FrameList orderedFrames,
int  headPos 
)
private

Definition at line 1753 of file mpeg2fix.cpp.

Referenced by Start().

◆ InsertFrame()

int MPEG2fixup::InsertFrame ( int  frameNum,
int64_t  deltaPTS,
int64_t  ptsIncrement,
int64_t  initPTS 
)
private

Definition at line 1809 of file mpeg2fix.cpp.

Referenced by Start().

◆ AddSequence()

void MPEG2fixup::AddSequence ( MPEG2frame frame1,
MPEG2frame frame2 
)
private

Definition at line 883 of file mpeg2fix.cpp.

Referenced by Start(), and WriteFrame().

◆ ReorderDTStoPTS()

FrameList MPEG2fixup::ReorderDTStoPTS ( FrameList dtsOrder,
int  pos 
)
staticprivate

Definition at line 1936 of file mpeg2fix.cpp.

Referenced by Start().

◆ InitialPTSFixup()

void MPEG2fixup::InitialPTSFixup ( MPEG2frame curFrame,
int64_t &  origvPTS,
int64_t &  PTSdiscrep,
int  numframes,
bool  fix 
) const
private

Definition at line 1953 of file mpeg2fix.cpp.

Referenced by Start().

◆ SetFrameNum()

void MPEG2fixup::SetFrameNum ( uint8_t *  ptr,
int  num 
)
staticprivate

◆ GetFrameNum()

static int MPEG2fixup::GetFrameNum ( const MPEG2frame frame)
inlinestaticprivate

◆ GetFrameTypeN()

static int MPEG2fixup::GetFrameTypeN ( const MPEG2frame frame)
inlinestaticprivate

Definition at line 179 of file mpeg2fix.h.

Referenced by AddFrame(), and GetFrameTypeT().

◆ GetFrameTypeT()

static char MPEG2fixup::GetFrameTypeT ( const MPEG2frame frame)
inlinestaticprivate

Definition at line 183 of file mpeg2fix.h.

Referenced by ConvertToI(), dumpList(), InsertFrame(), ReorderDTStoPTS(), Start(), and StoreSecondary().

◆ GetNbFields()

static int MPEG2fixup::GetNbFields ( const MPEG2frame frame)
inlinestaticprivate

Definition at line 189 of file mpeg2fix.h.

Referenced by dumpList(), InitialPTSFixup(), InsertFrame(), and Start().

◆ GetStreamType()

int MPEG2fixup::GetStreamType ( int  id) const
inlineprivate

Definition at line 193 of file mpeg2fix.h.

Referenced by AddFrame(), and InitReplex().

◆ getCodecContext()

AVCodecContext* MPEG2fixup::getCodecContext ( uint  id)
inlineprivate

Definition at line 198 of file mpeg2fix.h.

Referenced by InitReplex(), and Start().

◆ getCodecParserContext()

AVCodecParserContext* MPEG2fixup::getCodecParserContext ( uint  id)
inlineprivate

Definition at line 204 of file mpeg2fix.h.

Referenced by Start().

◆ dumpList()

void MPEG2fixup::dumpList ( FrameList list)
staticprivate

Definition at line 1992 of file mpeg2fix.cpp.

Member Data Documentation

◆ m_rx

MPEG2replex MPEG2fixup::m_rx
protected

Definition at line 141 of file mpeg2fix.h.

Referenced by AddFrame(), FrameInfo(), InitReplex(), MPEG2fixup(), ReplexStart(), and Start().

◆ m_checkAbort

int(* MPEG2fixup::m_checkAbort) ()
inlineprivate

Definition at line 213 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_updateStatus

void(* MPEG2fixup::m_updateStatus) (float percent_done)
inlineprivate

Definition at line 214 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_vSecondary

FrameList MPEG2fixup::m_vSecondary
private

Definition at line 214 of file mpeg2fix.h.

Referenced by PlaybackSecondary(), StoreSecondary(), and ~MPEG2fixup().

◆ m_useSecondary

bool MPEG2fixup::m_useSecondary {false}
private

Definition at line 217 of file mpeg2fix.h.

Referenced by AddRangeList(), MPEG2fixup(), Start(), and StoreSecondary().

◆ m_vFrame

FrameList MPEG2fixup::m_vFrame
private

◆ m_aFrame

FrameMap MPEG2fixup::m_aFrame
private

Definition at line 220 of file mpeg2fix.h.

Referenced by FindStart(), GetFrame(), InitAV(), InitReplex(), Start(), and ~MPEG2fixup().

◆ m_framePool

FrameQueue MPEG2fixup::m_framePool
private

◆ m_unreadFrames

FrameQueue MPEG2fixup::m_unreadFrames
private

Definition at line 222 of file mpeg2fix.h.

Referenced by GetFrame(), and Start().

◆ m_displayFrame

int MPEG2fixup::m_displayFrame {0}
private

Definition at line 223 of file mpeg2fix.h.

Referenced by DecodeToFrame(), and Start().

◆ m_headerDecoder

mpeg2dec_t* MPEG2fixup::m_headerDecoder {nullptr}
private

◆ m_imgDecoder

mpeg2dec_t* MPEG2fixup::m_imgDecoder {nullptr}
private

Definition at line 225 of file mpeg2fix.h.

Referenced by BuildFrame(), DecodeToFrame(), MPEG2fixup(), PlaybackSecondary(), and ~MPEG2fixup().

◆ m_delMap

frm_dir_map_t MPEG2fixup::m_delMap
private

Definition at line 227 of file mpeg2fix.h.

Referenced by AddRangeList(), MPEG2fixup(), and Start().

◆ m_saveMap

frm_dir_map_t MPEG2fixup::m_saveMap
private

Definition at line 228 of file mpeg2fix.h.

Referenced by AddRangeList(), and Start().

◆ m_thread

pthread_t MPEG2fixup::m_thread {}
private

Definition at line 230 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_codecMap

MythCodecMap MPEG2fixup::m_codecMap {}
private

Definition at line 232 of file mpeg2fix.h.

Referenced by getCodecContext().

◆ m_inputFC

AVFormatContext* MPEG2fixup::m_inputFC {nullptr}
private

◆ m_picture

AVFrame* MPEG2fixup::m_picture {nullptr}
private

Definition at line 234 of file mpeg2fix.h.

Referenced by BuildFrame(), and ~MPEG2fixup().

◆ m_vidId

int MPEG2fixup::m_vidId {-1}
private

Definition at line 236 of file mpeg2fix.h.

Referenced by AddFrame(), BuildKeyframeIndex(), FindStart(), GetFrame(), InitAV(), and Start().

◆ m_extCount

int MPEG2fixup::m_extCount {0}
private

Definition at line 237 of file mpeg2fix.h.

Referenced by AddFrame(), FrameInfo(), InitAV(), and InitReplex().

◆ m_audMap

QMap<int, int> MPEG2fixup::m_audMap
private

Definition at line 238 of file mpeg2fix.h.

Referenced by AddFrame(), InitAV(), and InitReplex().

◆ m_ptsIncrement

int64_t MPEG2fixup::m_ptsIncrement {0}
private

Definition at line 239 of file mpeg2fix.h.

Referenced by InitialPTSFixup(), and Start().

◆ m_mkvFile

bool MPEG2fixup::m_mkvFile {false}
private

Definition at line 240 of file mpeg2fix.h.

Referenced by BuildKeyframeIndex(), and InitAV().

◆ m_discard

bool MPEG2fixup::m_discard {false}
private

Definition at line 242 of file mpeg2fix.h.

Referenced by AddRangeList(), MPEG2fixup(), and Start().

◆ m_noRepeat

bool MPEG2fixup::m_noRepeat
private

Definition at line 244 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_fixPts

bool MPEG2fixup::m_fixPts
private

Definition at line 245 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_maxFrames

int MPEG2fixup::m_maxFrames
private

Definition at line 246 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_infile

QString MPEG2fixup::m_infile
private

Definition at line 247 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_format

const char* MPEG2fixup::m_format {nullptr}
private

Definition at line 248 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_allAudio

bool MPEG2fixup::m_allAudio {false}
private

Definition at line 249 of file mpeg2fix.h.

Referenced by InitAV(), and SetAllAudio().

◆ m_fileEnd

bool MPEG2fixup::m_fileEnd {false}
private

Definition at line 252 of file mpeg2fix.h.

Referenced by GetFrame(), and Start().

◆ m_realFileEnd

bool MPEG2fixup::m_realFileEnd {false}
private

Definition at line 253 of file mpeg2fix.h.

Referenced by GetFrame().

◆ m_statusTime

QDateTime MPEG2fixup::m_statusTime
private

Definition at line 256 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_showProgress

bool MPEG2fixup::m_showProgress {false}
private

Definition at line 257 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_fileSize

uint64_t MPEG2fixup::m_fileSize {0}
private

Definition at line 258 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_frameNum

int MPEG2fixup::m_frameNum {0}
private

Definition at line 259 of file mpeg2fix.h.

Referenced by GetFrame().

◆ m_statusUpdateTime

int MPEG2fixup::m_statusUpdateTime {5}
private

Definition at line 260 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_lastWrittenPos

uint64_t MPEG2fixup::m_lastWrittenPos {0}
private

Definition at line 261 of file mpeg2fix.h.

Referenced by AddFrame().

◆ m_invZigzagDirect16

uint16_t MPEG2fixup::m_invZigzagDirect16[64] {}
private

Definition at line 262 of file mpeg2fix.h.

Referenced by BuildFrame().

◆ m_zigzagInit

bool MPEG2fixup::m_zigzagInit {false}
private

Definition at line 263 of file mpeg2fix.h.

Referenced by BuildFrame().


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