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 cutlist, int type)
 
void ShowRangeMap (frm_dir_map_t *mapPtr, QString msg)
 
int BuildKeyframeIndex (QString &file, frm_pos_map_t &posMap, frm_pos_map_t &durMap)
 
void SetAllAudio (bool keep)
 

Static Public Member Functions

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 rx
 

Private Member Functions

int FindMPEG2Header (uint8_t *buf, int size, uint8_t code)
 
void InitReplex ()
 
void FrameInfo (MPEG2frame *f)
 
int AddFrame (MPEG2frame *f)
 
bool InitAV (QString inputfile, const char *type, int64_t offset)
 
void ScanAudio ()
 
int ProcessVideo (MPEG2frame *vf, mpeg2dec_t *dec)
 
void WriteFrame (QString filename, MPEG2frame *f)
 
void WriteFrame (QString filename, AVPacket *pkt)
 
void WriteYUV (QString filename, const mpeg2_info_t *info)
 
void WriteData (QString filename, uint8_t *data, int size)
 
bool BuildFrame (AVPacket *pkt, QString fname)
 
MPEG2frameGetPoolFrame (AVPacket *pkt)
 
MPEG2frameGetPoolFrame (MPEG2frame *f)
 
int GetFrame (AVPacket *pkt)
 
bool FindStart ()
 
void SetRepeat (MPEG2frame *vf, int nb_fields, bool topff)
 
void SetRepeat (uint8_t *ptr, int size, int fields, bool topff)
 
MPEG2frameFindFrameNum (int frameNum)
 
void RenumberFrames (int frame_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)
 
FrameList ReorderDTStoPTS (FrameList *dtsOrder, int pos)
 
void InitialPTSFixup (MPEG2frame *curFrame, int64_t &origvPTS, int64_t &PTSdiscrep, int numframes, bool fix)
 
void SetFrameNum (uint8_t *ptr, int num)
 
int GetStreamType (int id) const
 
AVCodecContext * getCodecContext (uint id)
 
AVCodecParserContext * getCodecParserContext (uint id)
 
void dumpList (FrameList *list)
 

Static Private Member Functions

static int GetFrameNum (const MPEG2frame *frame)
 
static int GetFrameTypeN (const MPEG2frame *frame)
 
static char GetFrameTypeT (const MPEG2frame *frame)
 
static int GetNbFields (const MPEG2frame *frame)
 

Private Attributes

int(* check_abort )()
 
void(* update_status )(float percent_done)
 
FrameList vSecondary
 
bool use_secondary
 
FrameList vFrame
 
FrameMap aFrame
 
FrameQueue framePool
 
FrameQueue unreadFrames
 
int displayFrame
 
mpeg2dec_t * header_decoder
 
mpeg2dec_t * img_decoder
 
frm_dir_map_t delMap
 
frm_dir_map_t saveMap
 
pthread_t thread
 
AVFormatContext * inputFC
 
AVFramepicture
 
int vid_id
 
int ext_count
 
QMap< int, int > aud_map
 
int aud_stream_count
 
int64_t ptsIncrement
 
int64_t ptsOffset
 
bool mkvfile
 
int discard
 
int no_repeat
 
int fix_PTS
 
int maxframes
 
QString infile
 
const char * format
 
bool allaudio
 
bool file_end
 
bool real_file_end
 
QDateTime statustime
 
bool showprogress
 
uint64_t filesize
 
int framenum
 
int status_update_time
 
uint64_t last_written_pos
 
uint16_t inv_zigzag_direct16 [64]
 
bool zigzag_init
 

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 237 of file mpeg2fix.cpp.

◆ ~MPEG2fixup()

MPEG2fixup::~MPEG2fixup ( )

Definition at line 327 of file mpeg2fix.cpp.

Member Function Documentation

◆ Start()

int MPEG2fixup::Start ( void  )

Definition at line 2063 of file mpeg2fix.cpp.

Referenced by main().

◆ AddRangeList()

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

Definition at line 1924 of file mpeg2fix.cpp.

◆ ShowRangeMap()

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

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

Referenced by BuildKeyframeIndex().

◆ SetAllAudio()

void MPEG2fixup::SetAllAudio ( bool  keep)
inline

Definition at line 130 of file mpeg2fix.h.

Referenced by main().

◆ dec2x33()

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

Definition at line 391 of file mpeg2fix.cpp.

Referenced by Start().

◆ inc2x33()

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

Definition at line 396 of file mpeg2fix.cpp.

Referenced by InsertFrame().

◆ udiff2x33()

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

Definition at line 401 of file mpeg2fix.cpp.

Referenced by dec2x33(), and Start().

◆ diff2x33()

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

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

Referenced by Start().

◆ cmp2x33()

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

Definition at line 447 of file mpeg2fix.cpp.

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

◆ ReplexStart()

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

Definition at line 560 of file mpeg2fix.cpp.

Referenced by MPEG2fixup().

◆ FindMPEG2Header()

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

Definition at line 470 of file mpeg2fix.cpp.

Referenced by BuildFrame().

◆ InitReplex()

void MPEG2fixup::InitReplex ( )
private

Definition at line 618 of file mpeg2fix.cpp.

Referenced by Start().

◆ FrameInfo()

void MPEG2fixup::FrameInfo ( MPEG2frame f)
private

Definition at line 686 of file mpeg2fix.cpp.

Referenced by AddFrame().

◆ AddFrame()

int MPEG2fixup::AddFrame ( MPEG2frame f)
private

Definition at line 702 of file mpeg2fix.cpp.

Referenced by Start().

◆ InitAV()

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

Definition at line 806 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 ( QString  filename,
MPEG2frame f 
)
private

Definition at line 1066 of file mpeg2fix.cpp.

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

◆ WriteFrame() [2/2]

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

Definition at line 1086 of file mpeg2fix.cpp.

◆ WriteYUV()

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

Definition at line 1112 of file mpeg2fix.cpp.

Referenced by BuildFrame(), and WriteFrame().

◆ WriteData()

void MPEG2fixup::WriteData ( QString  filename,
uint8_t *  data,
int  size 
)
private

Definition at line 1151 of file mpeg2fix.cpp.

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

◆ BuildFrame()

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

Definition at line 1169 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ GetPoolFrame() [1/2]

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

Definition at line 1347 of file mpeg2fix.cpp.

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

◆ GetPoolFrame() [2/2]

MPEG2frame * MPEG2fixup::GetPoolFrame ( MPEG2frame f)
private

Definition at line 1370 of file mpeg2fix.cpp.

◆ GetFrame()

int MPEG2fixup::GetFrame ( AVPacket *  pkt)
private

Definition at line 1384 of file mpeg2fix.cpp.

Referenced by FindStart(), and Start().

◆ FindStart()

bool MPEG2fixup::FindStart ( )
private

Definition at line 1503 of file mpeg2fix.cpp.

Referenced by Start().

◆ SetRepeat() [1/2]

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

Definition at line 1634 of file mpeg2fix.cpp.

Referenced by BuildFrame(), and Start().

◆ SetRepeat() [2/2]

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

Definition at line 1641 of file mpeg2fix.cpp.

◆ FindFrameNum()

MPEG2frame * MPEG2fixup::FindFrameNum ( int  frameNum)
private

Definition at line 1671 of file mpeg2fix.cpp.

Referenced by DecodeToFrame().

◆ RenumberFrames()

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

Definition at line 1682 of file mpeg2fix.cpp.

Referenced by InsertFrame(), and Start().

◆ StoreSecondary()

void MPEG2fixup::StoreSecondary ( )
private

Definition at line 1694 of file mpeg2fix.cpp.

Referenced by Start().

◆ PlaybackSecondary()

int MPEG2fixup::PlaybackSecondary ( )
private

Definition at line 1710 of file mpeg2fix.cpp.

Referenced by ConvertToI().

◆ DecodeToFrame()

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

Definition at line 1724 of file mpeg2fix.cpp.

Referenced by ConvertToI(), and InsertFrame().

◆ ConvertToI()

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

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

Referenced by Start().

◆ AddSequence()

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

Definition at line 918 of file mpeg2fix.cpp.

Referenced by Start(), and WriteFrame().

◆ ReorderDTStoPTS()

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

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

Referenced by Start().

◆ SetFrameNum()

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

◆ 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)
private

Definition at line 2041 of file mpeg2fix.cpp.

Member Data Documentation

◆ rx

MPEG2replex MPEG2fixup::rx
protected

Definition at line 141 of file mpeg2fix.h.

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

◆ check_abort

int(* MPEG2fixup::check_abort) ()
private

Definition at line 213 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ update_status

void(* MPEG2fixup::update_status) (float percent_done)
private

Definition at line 214 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ vSecondary

FrameList MPEG2fixup::vSecondary
private

Definition at line 216 of file mpeg2fix.h.

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

◆ use_secondary

bool MPEG2fixup::use_secondary
private

Definition at line 217 of file mpeg2fix.h.

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

◆ vFrame

FrameList MPEG2fixup::vFrame
private

◆ aFrame

FrameMap MPEG2fixup::aFrame
private

Definition at line 220 of file mpeg2fix.h.

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

◆ framePool

FrameQueue MPEG2fixup::framePool
private

◆ unreadFrames

FrameQueue MPEG2fixup::unreadFrames
private

Definition at line 222 of file mpeg2fix.h.

Referenced by GetFrame(), and Start().

◆ displayFrame

int MPEG2fixup::displayFrame
private

Definition at line 223 of file mpeg2fix.h.

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

◆ header_decoder

mpeg2dec_t* MPEG2fixup::header_decoder
private

◆ img_decoder

mpeg2dec_t* MPEG2fixup::img_decoder
private

Definition at line 225 of file mpeg2fix.h.

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

◆ delMap

frm_dir_map_t MPEG2fixup::delMap
private

Definition at line 227 of file mpeg2fix.h.

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

◆ saveMap

frm_dir_map_t MPEG2fixup::saveMap
private

Definition at line 228 of file mpeg2fix.h.

Referenced by AddRangeList(), and Start().

◆ thread

pthread_t MPEG2fixup::thread
private

Definition at line 230 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ inputFC

AVFormatContext* MPEG2fixup::inputFC
private

◆ picture

AVFrame* MPEG2fixup::picture
private

Definition at line 233 of file mpeg2fix.h.

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

◆ vid_id

int MPEG2fixup::vid_id
private

Definition at line 235 of file mpeg2fix.h.

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

◆ ext_count

int MPEG2fixup::ext_count
private

Definition at line 236 of file mpeg2fix.h.

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

◆ aud_map

QMap<int, int> MPEG2fixup::aud_map
private

Definition at line 237 of file mpeg2fix.h.

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

◆ aud_stream_count

int MPEG2fixup::aud_stream_count
private

Definition at line 238 of file mpeg2fix.h.

◆ ptsIncrement

int64_t MPEG2fixup::ptsIncrement
private

Definition at line 239 of file mpeg2fix.h.

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

◆ ptsOffset

int64_t MPEG2fixup::ptsOffset
private

Definition at line 240 of file mpeg2fix.h.

◆ mkvfile

bool MPEG2fixup::mkvfile
private

Definition at line 241 of file mpeg2fix.h.

Referenced by BuildKeyframeIndex(), and InitAV().

◆ discard

int MPEG2fixup::discard
private

Definition at line 243 of file mpeg2fix.h.

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

◆ no_repeat

int MPEG2fixup::no_repeat
private

Definition at line 245 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ fix_PTS

int MPEG2fixup::fix_PTS
private

Definition at line 245 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ maxframes

int MPEG2fixup::maxframes
private

Definition at line 245 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ infile

QString MPEG2fixup::infile
private

Definition at line 246 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ format

const char* MPEG2fixup::format
private

Definition at line 247 of file mpeg2fix.h.

Referenced by MPEG2fixup(), and Start().

◆ allaudio

bool MPEG2fixup::allaudio
private

Definition at line 248 of file mpeg2fix.h.

Referenced by InitAV(), MPEG2fixup(), and SetAllAudio().

◆ file_end

bool MPEG2fixup::file_end
private

Definition at line 251 of file mpeg2fix.h.

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

◆ real_file_end

bool MPEG2fixup::real_file_end
private

Definition at line 252 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ statustime

QDateTime MPEG2fixup::statustime
private

Definition at line 255 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ showprogress

bool MPEG2fixup::showprogress
private

Definition at line 256 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ filesize

uint64_t MPEG2fixup::filesize
private

Definition at line 257 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ framenum

int MPEG2fixup::framenum
private

Definition at line 258 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ status_update_time

int MPEG2fixup::status_update_time
private

Definition at line 259 of file mpeg2fix.h.

Referenced by GetFrame(), and MPEG2fixup().

◆ last_written_pos

uint64_t MPEG2fixup::last_written_pos
private

Definition at line 260 of file mpeg2fix.h.

Referenced by AddFrame().

◆ inv_zigzag_direct16

uint16_t MPEG2fixup::inv_zigzag_direct16[64]
private

Definition at line 261 of file mpeg2fix.h.

Referenced by BuildFrame().

◆ zigzag_init

bool MPEG2fixup::zigzag_init
private

Definition at line 262 of file mpeg2fix.h.

Referenced by BuildFrame(), and MPEG2fixup().


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