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, int norp, int fixPTS, int maxf, bool showprog, int otype, void(*update_func)(float)=nullptr, int(*check_func)()=nullptr)
 
 ~MPEG2fixup ()
 
int Start ()
 
void AddRangeList (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)
 
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(* check_abort )()
 
void(* update_status )(float percent_done)
 
FrameList m_vSecondary
 
bool m_use_secondary {false}
 
FrameList m_vFrame
 
FrameMap m_aFrame
 
FrameQueue m_framePool
 
FrameQueue m_unreadFrames
 
int m_displayFrame {0}
 
mpeg2dec_t * m_header_decoder {nullptr}
 
mpeg2dec_t * m_img_decoder {nullptr}
 
frm_dir_map_t m_delMap
 
frm_dir_map_t m_saveMap
 
pthread_t m_thread {}
 
AVFormatContext * m_inputFC {nullptr}
 
AVFramem_picture {nullptr}
 
int m_vid_id {-1}
 
int m_ext_count {0}
 
QMap< int, int > m_aud_map
 
int64_t m_ptsIncrement {0}
 
bool m_mkvfile {false}
 
bool m_discard {false}
 
int m_no_repeat
 
int m_fix_PTS
 
int m_maxframes
 
QString m_infile
 
const char * m_format {nullptr}
 
bool m_allaudio {false}
 
bool m_file_end {false}
 
bool m_real_file_end {false}
 
QDateTime m_statustime
 
bool m_showprogress {false}
 
uint64_t m_filesize {0}
 
int m_framenum {0}
 
int m_status_update_time {5}
 
uint64_t m_last_written_pos {0}
 
uint16_t m_inv_zigzag_direct16 [64] {}
 
bool m_zigzag_init {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,
int  norp,
int  fixPTS,
int  maxf,
bool  showprog,
int  otype,
void(*)(float)  update_func = nullptr,
int(*)()  check_func = nullptr 
)

Definition at line 231 of file mpeg2fix.cpp.

◆ ~MPEG2fixup()

MPEG2fixup::~MPEG2fixup ( )

Definition at line 309 of file mpeg2fix.cpp.

Member Function Documentation

◆ Start()

int MPEG2fixup::Start ( void  )

Definition at line 2004 of file mpeg2fix.cpp.

◆ AddRangeList()

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

Definition at line 1866 of file mpeg2fix.cpp.

◆ ShowRangeMap()

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

Definition at line 1909 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 2743 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 369 of file mpeg2fix.cpp.

Referenced by Start().

◆ inc2x33()

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

Definition at line 374 of file mpeg2fix.cpp.

Referenced by InsertFrame().

◆ udiff2x33()

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

Definition at line 379 of file mpeg2fix.cpp.

Referenced by dec2x33(), and Start().

◆ diff2x33()

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

Definition at line 390 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 415 of file mpeg2fix.cpp.

Referenced by Start().

◆ cmp2x33()

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

Definition at line 423 of file mpeg2fix.cpp.

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

◆ ReplexStart()

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

Definition at line 518 of file mpeg2fix.cpp.

Referenced by MPEG2fixup().

◆ FindMPEG2Header()

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

Definition at line 446 of file mpeg2fix.cpp.

Referenced by BuildFrame().

◆ InitReplex()

void MPEG2fixup::InitReplex ( )
private

Definition at line 576 of file mpeg2fix.cpp.

Referenced by Start().

◆ FrameInfo()

void MPEG2fixup::FrameInfo ( MPEG2frame f)
private

Definition at line 645 of file mpeg2fix.cpp.

Referenced by AddFrame().

◆ AddFrame()

int MPEG2fixup::AddFrame ( MPEG2frame f)
private

Definition at line 661 of file mpeg2fix.cpp.

Referenced by Start().

◆ InitAV()

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

Definition at line 766 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 1023 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 1043 of file mpeg2fix.cpp.

◆ WriteYUV()

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

Definition at line 1069 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 1108 of file mpeg2fix.cpp.

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

◆ BuildFrame()

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

Definition at line 1126 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ GetPoolFrame() [1/2]

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

Definition at line 1297 of file mpeg2fix.cpp.

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

◆ GetPoolFrame() [2/2]

MPEG2frame * MPEG2fixup::GetPoolFrame ( MPEG2frame f)
private

Definition at line 1320 of file mpeg2fix.cpp.

◆ GetFrame()

int MPEG2fixup::GetFrame ( AVPacket *  pkt)
private

Definition at line 1334 of file mpeg2fix.cpp.

Referenced by FindStart(), and Start().

◆ FindStart()

bool MPEG2fixup::FindStart ( )
private

Definition at line 1451 of file mpeg2fix.cpp.

Referenced by Start().

◆ SetRepeat() [1/2]

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

Definition at line 1579 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 1586 of file mpeg2fix.cpp.

◆ FindFrameNum()

MPEG2frame * MPEG2fixup::FindFrameNum ( int  frameNum)
private

Definition at line 1616 of file mpeg2fix.cpp.

Referenced by DecodeToFrame().

◆ RenumberFrames()

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

Definition at line 1627 of file mpeg2fix.cpp.

Referenced by InsertFrame(), and Start().

◆ StoreSecondary()

void MPEG2fixup::StoreSecondary ( )
private

Definition at line 1639 of file mpeg2fix.cpp.

Referenced by Start().

◆ PlaybackSecondary()

int MPEG2fixup::PlaybackSecondary ( )
private

Definition at line 1655 of file mpeg2fix.cpp.

Referenced by ConvertToI().

◆ DecodeToFrame()

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

Definition at line 1668 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ ConvertToI()

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

Definition at line 1745 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 1801 of file mpeg2fix.cpp.

Referenced by Start().

◆ AddSequence()

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

Definition at line 877 of file mpeg2fix.cpp.

Referenced by Start(), and WriteFrame().

◆ ReorderDTStoPTS()

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

Definition at line 1926 of file mpeg2fix.cpp.

Referenced by Start().

◆ InitialPTSFixup()

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

Definition at line 1943 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 1982 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(), and Start().

◆ check_abort

int(* MPEG2fixup::check_abort) ()
inlineprivate

Definition at line 213 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ update_status

void(* MPEG2fixup::update_status) (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_use_secondary

bool MPEG2fixup::m_use_secondary {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_header_decoder

mpeg2dec_t* MPEG2fixup::m_header_decoder {nullptr}
private

◆ m_img_decoder

mpeg2dec_t* MPEG2fixup::m_img_decoder {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_inputFC

AVFormatContext* MPEG2fixup::m_inputFC {nullptr}
private

◆ m_picture

AVFrame* MPEG2fixup::m_picture {nullptr}
private

Definition at line 233 of file mpeg2fix.h.

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

◆ m_vid_id

int MPEG2fixup::m_vid_id {-1}
private

Definition at line 235 of file mpeg2fix.h.

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

◆ m_ext_count

int MPEG2fixup::m_ext_count {0}
private

Definition at line 236 of file mpeg2fix.h.

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

◆ m_aud_map

QMap<int, int> MPEG2fixup::m_aud_map
private

Definition at line 237 of file mpeg2fix.h.

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

◆ m_ptsIncrement

int64_t MPEG2fixup::m_ptsIncrement {0}
private

Definition at line 238 of file mpeg2fix.h.

Referenced by InitialPTSFixup(), and Start().

◆ m_mkvfile

bool MPEG2fixup::m_mkvfile {false}
private

Definition at line 239 of file mpeg2fix.h.

Referenced by BuildKeyframeIndex(), and InitAV().

◆ m_discard

bool MPEG2fixup::m_discard {false}
private

Definition at line 241 of file mpeg2fix.h.

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

◆ m_no_repeat

int MPEG2fixup::m_no_repeat
private

Definition at line 243 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_fix_PTS

int MPEG2fixup::m_fix_PTS
private

Definition at line 243 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_maxframes

int MPEG2fixup::m_maxframes
private

Definition at line 243 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_infile

QString MPEG2fixup::m_infile
private

Definition at line 244 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_format

const char* MPEG2fixup::m_format {nullptr}
private

Definition at line 245 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ m_allaudio

bool MPEG2fixup::m_allaudio {false}
private

Definition at line 246 of file mpeg2fix.h.

Referenced by InitAV(), and SetAllAudio().

◆ m_file_end

bool MPEG2fixup::m_file_end {false}
private

Definition at line 249 of file mpeg2fix.h.

Referenced by GetFrame(), and Start().

◆ m_real_file_end

bool MPEG2fixup::m_real_file_end {false}
private

Definition at line 250 of file mpeg2fix.h.

Referenced by GetFrame().

◆ m_statustime

QDateTime MPEG2fixup::m_statustime
private

Definition at line 253 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_showprogress

bool MPEG2fixup::m_showprogress {false}
private

Definition at line 254 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_filesize

uint64_t MPEG2fixup::m_filesize {0}
private

Definition at line 255 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_framenum

int MPEG2fixup::m_framenum {0}
private

Definition at line 256 of file mpeg2fix.h.

Referenced by GetFrame().

◆ m_status_update_time

int MPEG2fixup::m_status_update_time {5}
private

Definition at line 257 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ m_last_written_pos

uint64_t MPEG2fixup::m_last_written_pos {0}
private

Definition at line 258 of file mpeg2fix.h.

Referenced by AddFrame().

◆ m_inv_zigzag_direct16

uint16_t MPEG2fixup::m_inv_zigzag_direct16[64] {}
private

Definition at line 259 of file mpeg2fix.h.

Referenced by BuildFrame().

◆ m_zigzag_init

bool MPEG2fixup::m_zigzag_init {false}
private

Definition at line 260 of file mpeg2fix.h.

Referenced by BuildFrame().


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