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

#include <deletemap.h>

Collaboration diagram for DeleteMap:
Collaboration graph
[legend]

Public Member Functions

 DeleteMap ()=default
 
void SetPlayerContext (PlayerContext *ctx)
 
bool HandleAction (QString &action, uint64_t frame)
 
float GetSeekAmount (void) const
 
void UpdateSeekAmount (int change)
 
void SetSeekAmount (float amount)
 
void UpdateOSD (uint64_t frame, double frame_rate, OSD *osd)
 Show and update the edit mode On Screen Display. More...
 
void UpdateOSD (int64_t timecode, OSD *osd)
 
bool IsEditing (void) const
 
void SetEditing (bool edit, OSD *osd=nullptr)
 Set the edit mode and optionally hide the edit mode OSD. More...
 
void SetFileEditing (bool edit)
 Update the editing status in the file's ProgramInfo. More...
 
bool IsFileEditing (void)
 Determines whether the file is currently in edit mode. More...
 
bool IsEmpty (void) const
 
bool IsSaved (void) const
 Compares the current cut list with the saved cut list. More...
 
bool IsChanged (void) const
 
void SetChanged (bool changed=true)
 
void SetMap (const frm_dir_map_t &map)
 Use the given map. More...
 
void LoadCommBreakMap (frm_dir_map_t &map)
 Loads the given commercial break map into the deleteMap. More...
 
void SaveMap (bool isAutoSave=false)
 Saves the delete map to the database. More...
 
void LoadMap (const QString &undoMessage="")
 Loads the delete map from the database. More...
 
bool LoadAutoSaveMap (void)
 Returns true if an auto-save map was loaded. More...
 
void CleanMap (void)
 Removes redundant marks and ensures the markup sequence is valid. More...
 
void Clear (const QString &undoMessage="")
 Clears the deleteMap. More...
 
void ReverseAll (void)
 Reverses the direction of each mark in the map. More...
 
void NewCut (uint64_t frame)
 Add a new cut marker (to start or end a cut region) More...
 
void Delete (uint64_t frame, const QString &undoMessage)
 Remove the mark at the given frame. More...
 
void MoveRelative (uint64_t frame, bool right)
 Move the previous (!right) or next (right) cut to frame. More...
 
void Move (uint64_t frame, uint64_t to)
 Move an existing mark to a new frame. More...
 
bool IsInDelete (uint64_t frame) const
 Returns true if the given frame is deemed to be within a region that should be cut. More...
 
uint64_t GetNearestMark (uint64_t frame, bool right, bool *hasMark=nullptr) const
 Returns the next or previous mark. More...
 
bool IsTemporaryMark (uint64_t frame) const
 Returns true if the given frame is a temporary/placeholder mark. More...
 
bool HasTemporaryMark (void) const
 Returns true if a temporary placeholder mark is defined. More...
 
uint64_t GetLastFrame (void) const
 Returns the number of the last frame in the video that is not in a cut sequence. More...
 
uint64_t TranslatePositionFrameToMs (uint64_t position, float fallback_framerate, bool use_cutlist) const
 
uint64_t TranslatePositionMsToFrame (uint64_t dur_ms, float fallback_framerate, bool use_cutlist) const
 
uint64_t TranslatePositionAbsToRel (uint64_t position) const
 
uint64_t TranslatePositionRelToAbs (uint64_t position) const
 
void TrackerReset (uint64_t frame)
 Resets the internal state tracker. More...
 
bool TrackerWantsToJump (uint64_t frame, uint64_t &to)
 Returns true if the given frame has passed the last cut point start and provides the frame number of the next jump. More...
 
bool Undo (void)
 
bool Redo (void)
 
bool HasUndo (void) const
 
bool HasRedo (void) const
 
QString GetUndoMessage (void) const
 
QString GetRedoMessage (void) const
 

Private Member Functions

void AddMark (uint64_t frame, MarkTypes type)
 Add a new mark of the given type. More...
 
void Add (uint64_t frame, MarkTypes type)
 Private addition to the deleteMap. More...
 
MarkTypes Delete (uint64_t frame)
 Private removal from the deleteMap. More...
 
void Push (const QString &undoMessage)
 
void PushDeferred (const frm_dir_map_t &savedMap, const QString &undoMessage)
 
QString CreateTimeString (uint64_t frame, bool use_cutlist, double frame_rate, bool full_resolution) const
 

Private Attributes

bool m_editing {false}
 
bool m_nextCutStartIsValid {false}
 
uint64_t m_nextCutStart {0}
 
frm_dir_map_t m_deleteMap
 
QString m_seekText
 
bool m_changed {true}
 
int m_seekamountpos {4}
 
float m_seekamount {1.0F}
 
PlayerContextm_ctx {nullptr}
 
uint64_t m_cachedTotalForOSD {0}
 
QVector< DeleteMapUndoEntrym_undoStack
 
int m_undoStackPointer {0}
 

Detailed Description

Definition at line 22 of file deletemap.h.

Constructor & Destructor Documentation

◆ DeleteMap()

DeleteMap::DeleteMap ( )
default

Member Function Documentation

◆ SetPlayerContext()

void DeleteMap::SetPlayerContext ( PlayerContext ctx)
inline

Definition at line 28 of file deletemap.h.

Referenced by MythPlayer::SetPlayerInfo().

◆ HandleAction()

bool DeleteMap::HandleAction ( QString &  action,
uint64_t  frame 
)

Definition at line 85 of file deletemap.cpp.

Referenced by MythPlayer::HandleProgramEditorActions().

◆ GetSeekAmount()

float DeleteMap::GetSeekAmount ( void  ) const
inline

◆ UpdateSeekAmount()

void DeleteMap::UpdateSeekAmount ( int  change)

Definition at line 128 of file deletemap.cpp.

Referenced by MythPlayer::EnableEdit(), and HandleAction().

◆ SetSeekAmount()

void DeleteMap::SetSeekAmount ( float  amount)
inline

Definition at line 32 of file deletemap.h.

Referenced by MythPlayer::HandleProgramEditorActions().

◆ UpdateOSD() [1/2]

void DeleteMap::UpdateOSD ( uint64_t  frame,
double  frame_rate,
OSD osd 
)

Show and update the edit mode On Screen Display.

The cut regions are only refreshed if the deleteMap has been updated.

Definition at line 176 of file deletemap.cpp.

Referenced by MythPlayer::EnableEdit(), MythPlayer::EventLoop(), MythPlayer::HandleProgramEditorActions(), MythPlayer::RefreshPauseFrame(), and MythPlayer::ReinitOSD().

◆ UpdateOSD() [2/2]

void DeleteMap::UpdateOSD ( int64_t  timecode,
OSD osd 
)

Definition at line 219 of file deletemap.cpp.

◆ IsEditing()

bool DeleteMap::IsEditing ( void  ) const
inline

◆ SetEditing()

void DeleteMap::SetEditing ( bool  edit,
OSD osd = nullptr 
)

Set the edit mode and optionally hide the edit mode OSD.

Definition at line 225 of file deletemap.cpp.

Referenced by MythPlayer::DisableEdit(), and MythPlayer::EnableEdit().

◆ SetFileEditing()

void DeleteMap::SetFileEditing ( bool  edit)

Update the editing status in the file's ProgramInfo.

Definition at line 233 of file deletemap.cpp.

Referenced by MythPlayer::DisableEdit(), and MythPlayer::EnableEdit().

◆ IsFileEditing()

bool DeleteMap::IsFileEditing ( void  )

Determines whether the file is currently in edit mode.

Definition at line 245 of file deletemap.cpp.

Referenced by MythPlayer::EnableEdit().

◆ IsEmpty()

bool DeleteMap::IsEmpty ( void  ) const

◆ IsSaved()

bool DeleteMap::IsSaved ( void  ) const

Compares the current cut list with the saved cut list.

Definition at line 876 of file deletemap.cpp.

◆ IsChanged()

bool DeleteMap::IsChanged ( void  ) const
inline

Definition at line 43 of file deletemap.h.

Referenced by MythPlayer::ReinitOSD().

◆ SetChanged()

void DeleteMap::SetChanged ( bool  changed = true)
inline

Definition at line 44 of file deletemap.h.

Referenced by MythPlayer::ReinitOSD().

◆ SetMap()

void DeleteMap::SetMap ( const frm_dir_map_t map)

Use the given map.

Definition at line 718 of file deletemap.cpp.

Referenced by MythPlayer::SetCutList().

◆ LoadCommBreakMap()

void DeleteMap::LoadCommBreakMap ( frm_dir_map_t map)

Loads the given commercial break map into the deleteMap.

Definition at line 729 of file deletemap.cpp.

Referenced by MythPlayer::HandleProgramEditorActions().

◆ SaveMap()

void DeleteMap::SaveMap ( bool  isAutoSave = false)

Saves the delete map to the database.

Definition at line 777 of file deletemap.cpp.

Referenced by MythPlayer::DisableEdit(), MythPlayer::HandleProgramEditorActions(), Push(), PushDeferred(), Redo(), and Undo().

◆ LoadMap()

void DeleteMap::LoadMap ( const QString &  undoMessage = "")

Loads the delete map from the database.

Definition at line 741 of file deletemap.cpp.

Referenced by MythPlayer::DisableEdit(), MythPlayer::HandleProgramEditorActions(), MythPlayer::OpenFile(), and MythPlayer::SeekForScreenGrab().

◆ LoadAutoSaveMap()

bool DeleteMap::LoadAutoSaveMap ( void  )

Returns true if an auto-save map was loaded.

Does nothing and returns false if not.

Definition at line 757 of file deletemap.cpp.

Referenced by MythPlayer::EnableEdit().

◆ CleanMap()

void DeleteMap::CleanMap ( void  )

Removes redundant marks and ensures the markup sequence is valid.

A valid sequence is 1 or more marks of alternating values and does not include the first or last frames.

Definition at line 660 of file deletemap.cpp.

Referenced by AddMark(), Delete(), LoadAutoSaveMap(), LoadCommBreakMap(), LoadMap(), NewCut(), ReverseAll(), SaveMap(), and UpdateOSD().

◆ Clear()

void DeleteMap::Clear ( const QString &  undoMessage = "")

Clears the deleteMap.

Definition at line 264 of file deletemap.cpp.

Referenced by HandleAction(), LoadAutoSaveMap(), LoadCommBreakMap(), LoadMap(), and SetMap().

◆ ReverseAll()

void DeleteMap::ReverseAll ( void  )

Reverses the direction of each mark in the map.

Definition at line 273 of file deletemap.cpp.

Referenced by HandleAction().

◆ NewCut()

void DeleteMap::NewCut ( uint64_t  frame)

Add a new cut marker (to start or end a cut region)

Definition at line 394 of file deletemap.cpp.

Referenced by HandleAction(), and MythPlayer::HandleProgramEditorActions().

◆ Delete() [1/2]

void DeleteMap::Delete ( uint64_t  frame,
const QString &  undoMessage 
)

Remove the mark at the given frame.

Definition at line 361 of file deletemap.cpp.

Referenced by AddMark(), CleanMap(), HandleAction(), MythPlayer::HandleProgramEditorActions(), Move(), MoveRelative(), and NewCut().

◆ MoveRelative()

void DeleteMap::MoveRelative ( uint64_t  frame,
bool  right 
)

Move the previous (!right) or next (right) cut to frame.

Definition at line 498 of file deletemap.cpp.

Referenced by HandleAction().

◆ Move()

void DeleteMap::Move ( uint64_t  frame,
uint64_t  to 
)

Move an existing mark to a new frame.

Definition at line 533 of file deletemap.cpp.

Referenced by MoveRelative().

◆ IsInDelete()

bool DeleteMap::IsInDelete ( uint64_t  frame) const

Returns true if the given frame is deemed to be within a region that should be cut.

Definition at line 570 of file deletemap.cpp.

Referenced by MythPlayer::IsInDelete(), NewCut(), TrackerReset(), and UpdateOSD().

◆ GetNearestMark()

uint64_t DeleteMap::GetNearestMark ( uint64_t  frame,
bool  right,
bool hasMark = nullptr 
) const

Returns the next or previous mark.

If these do not exist, returns either zero (the first frame) or total (the last frame). If hasMark is not nullptr, it is set to true if the next/previous mark exists, and false otherwise.

Definition at line 610 of file deletemap.cpp.

Referenced by Delete(), MythPlayer::GetNearestMark(), MythPlayer::HandleArbSeek(), MoveRelative(), NewCut(), TrackerReset(), and TrackerWantsToJump().

◆ IsTemporaryMark()

bool DeleteMap::IsTemporaryMark ( uint64_t  frame) const

Returns true if the given frame is a temporary/placeholder mark.

Definition at line 595 of file deletemap.cpp.

Referenced by MythPlayer::IsTemporaryMark().

◆ HasTemporaryMark()

bool DeleteMap::HasTemporaryMark ( void  ) const

Returns true if a temporary placeholder mark is defined.

Definition at line 642 of file deletemap.cpp.

Referenced by MythPlayer::HasTemporaryMark().

◆ GetLastFrame()

uint64_t DeleteMap::GetLastFrame ( void  ) const

Returns the number of the last frame in the video that is not in a cut sequence.

Definition at line 859 of file deletemap.cpp.

Referenced by MythPlayer::CalcMaxFFTime(), MythPlayer::DoFastForward(), MythPlayer::HasReachedEof(), and MythPlayer::IsNearEnd().

◆ TranslatePositionFrameToMs()

uint64_t DeleteMap::TranslatePositionFrameToMs ( uint64_t  position,
float  fallback_framerate,
bool  use_cutlist 
) const

Definition at line 899 of file deletemap.cpp.

Referenced by CreateTimeString(), and MythPlayer::TranslatePositionFrameToMs().

◆ TranslatePositionMsToFrame()

uint64_t DeleteMap::TranslatePositionMsToFrame ( uint64_t  dur_ms,
float  fallback_framerate,
bool  use_cutlist 
) const

Definition at line 908 of file deletemap.cpp.

◆ TranslatePositionAbsToRel()

uint64_t DeleteMap::TranslatePositionAbsToRel ( uint64_t  position) const

Definition at line 918 of file deletemap.cpp.

◆ TranslatePositionRelToAbs()

uint64_t DeleteMap::TranslatePositionRelToAbs ( uint64_t  position) const

Definition at line 923 of file deletemap.cpp.

◆ TrackerReset()

void DeleteMap::TrackerReset ( uint64_t  frame)

Resets the internal state tracker.

The tracker records the frame at which the next cut sequence begins. This is used by the player to avoid iterating over the entire map many times per second.

Definition at line 810 of file deletemap.cpp.

Referenced by MythPlayer::ClearAfterSeek(), MythPlayer::DisableEdit(), MythPlayer::OpenFile(), and MythPlayer::TranscodeGetNextFrame().

◆ TrackerWantsToJump()

bool DeleteMap::TrackerWantsToJump ( uint64_t  frame,
uint64_t &  to 
)

Returns true if the given frame has passed the last cut point start and provides the frame number of the next jump.

Definition at line 844 of file deletemap.cpp.

Referenced by MythPlayer::EventLoop(), MythPlayer::OpenFile(), and MythPlayer::TranscodeGetNextFrame().

◆ Undo()

bool DeleteMap::Undo ( void  )

Definition at line 47 of file deletemap.cpp.

Referenced by HandleAction().

◆ Redo()

bool DeleteMap::Redo ( void  )

Definition at line 60 of file deletemap.cpp.

Referenced by HandleAction().

◆ HasUndo()

bool DeleteMap::HasUndo ( void  ) const
inline

Definition at line 83 of file deletemap.h.

Referenced by GetUndoMessage(), and Undo().

◆ HasRedo()

bool DeleteMap::HasRedo ( void  ) const
inline

Definition at line 84 of file deletemap.h.

Referenced by GetRedoMessage(), and Redo().

◆ GetUndoMessage()

QString DeleteMap::GetUndoMessage ( void  ) const

Definition at line 73 of file deletemap.cpp.

Referenced by MythPlayer::HandleProgramEditorActions().

◆ GetRedoMessage()

QString DeleteMap::GetRedoMessage ( void  ) const

Definition at line 79 of file deletemap.cpp.

Referenced by MythPlayer::HandleProgramEditorActions().

◆ AddMark()

void DeleteMap::AddMark ( uint64_t  frame,
MarkTypes  type 
)
private

Add a new mark of the given type.

Before the new mark is added, any existing redundant mark of that type is removed. This simplifies the cleanup code.

Definition at line 289 of file deletemap.cpp.

Referenced by HandleAction(), and Move().

◆ Add()

void DeleteMap::Add ( uint64_t  frame,
MarkTypes  type 
)
private

Private addition to the deleteMap.

Definition at line 549 of file deletemap.cpp.

Referenced by AddMark(), LoadCommBreakMap(), NewCut(), and ReverseAll().

◆ Delete() [2/2]

MarkTypes DeleteMap::Delete ( uint64_t  frame)
private

Private removal from the deleteMap.

Definition at line 556 of file deletemap.cpp.

◆ Push()

void DeleteMap::Push ( const QString &  undoMessage)
private

◆ PushDeferred()

void DeleteMap::PushDeferred ( const frm_dir_map_t savedMap,
const QString &  undoMessage 
)
private

Definition at line 35 of file deletemap.cpp.

Referenced by LoadAutoSaveMap(), and NewCut().

◆ CreateTimeString()

QString DeleteMap::CreateTimeString ( uint64_t  frame,
bool  use_cutlist,
double  frame_rate,
bool  full_resolution 
) const
private

Definition at line 153 of file deletemap.cpp.

Referenced by UpdateOSD().

Member Data Documentation

◆ m_editing

bool DeleteMap::m_editing {false}
private

Definition at line 101 of file deletemap.h.

Referenced by SetEditing().

◆ m_nextCutStartIsValid

bool DeleteMap::m_nextCutStartIsValid {false}
private

Definition at line 102 of file deletemap.h.

Referenced by TrackerReset(), and TrackerWantsToJump().

◆ m_nextCutStart

uint64_t DeleteMap::m_nextCutStart {0}
private

Definition at line 103 of file deletemap.h.

Referenced by TrackerReset(), and TrackerWantsToJump().

◆ m_deleteMap

frm_dir_map_t DeleteMap::m_deleteMap
private

◆ m_seekText

QString DeleteMap::m_seekText
private

Definition at line 105 of file deletemap.h.

Referenced by UpdateOSD(), and UpdateSeekAmount().

◆ m_changed

bool DeleteMap::m_changed {true}
private

Definition at line 106 of file deletemap.h.

Referenced by Add(), Clear(), Delete(), NewCut(), Redo(), SaveMap(), Undo(), and UpdateOSD().

◆ m_seekamountpos

int DeleteMap::m_seekamountpos {4}
private

Definition at line 107 of file deletemap.h.

Referenced by UpdateSeekAmount().

◆ m_seekamount

float DeleteMap::m_seekamount {1.0F}
private

Definition at line 108 of file deletemap.h.

Referenced by UpdateSeekAmount().

◆ m_ctx

PlayerContext* DeleteMap::m_ctx {nullptr}
private

◆ m_cachedTotalForOSD

uint64_t DeleteMap::m_cachedTotalForOSD {0}
private

Definition at line 110 of file deletemap.h.

Referenced by UpdateOSD().

◆ m_undoStack

QVector<DeleteMapUndoEntry> DeleteMap::m_undoStack
private

Definition at line 112 of file deletemap.h.

Referenced by GetRedoMessage(), GetUndoMessage(), Push(), Redo(), and Undo().

◆ m_undoStackPointer

int DeleteMap::m_undoStackPointer {0}
private

Definition at line 113 of file deletemap.h.

Referenced by GetRedoMessage(), GetUndoMessage(), Push(), Redo(), and Undo().


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