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

#include <libmythtv/deletemap.h>

Collaboration diagram for DeleteMap:
[legend]

Public Member Functions

 DeleteMap ()=default
 
void SetPlayerContext (PlayerContext *ctx)
 
bool HandleAction (const 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...
 
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...
 
std::chrono::milliseconds TranslatePositionFrameToMs (uint64_t position, float fallback_framerate, bool use_cutlist) const
 
uint64_t TranslatePositionMsToFrame (std::chrono::milliseconds 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) const
 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
 

Static Public Member Functions

static void UpdateOSD (std::chrono::milliseconds timecode, OSD *osd)
 

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 26 of file deletemap.h.

Constructor & Destructor Documentation

◆ DeleteMap()

DeleteMap::DeleteMap ( )
default

Member Function Documentation

◆ SetPlayerContext()

void DeleteMap::SetPlayerContext ( PlayerContext ctx)
inline

Definition at line 32 of file deletemap.h.

Referenced by MythPlayer::MythPlayer(), and Cutter::SetCutList().

◆ HandleAction()

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

Definition at line 87 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::HandleProgramEditorActions().

◆ GetSeekAmount()

float DeleteMap::GetSeekAmount ( void  ) const
inline

◆ UpdateSeekAmount()

void DeleteMap::UpdateSeekAmount ( int  change)

Definition at line 140 of file deletemap.cpp.

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

◆ SetSeekAmount()

void DeleteMap::SetSeekAmount ( float  amount)
inline

Definition at line 36 of file deletemap.h.

Referenced by MythPlayerEditorUI::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 177 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::EnableEdit(), MythPlayerUI::EventLoop(), MythPlayerEditorUI::HandleProgramEditorActions(), MythPlayerUI::RefreshPauseFrame(), and MythPlayerVideoUI::ReinitOSD().

◆ UpdateOSD() [2/2]

void DeleteMap::UpdateOSD ( std::chrono::milliseconds  timecode,
OSD osd 
)
static

Definition at line 220 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 226 of file deletemap.cpp.

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

◆ SetFileEditing()

void DeleteMap::SetFileEditing ( bool  edit)

Update the editing status in the file's ProgramInfo.

Definition at line 234 of file deletemap.cpp.

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

◆ IsFileEditing()

bool DeleteMap::IsFileEditing ( void  )

Determines whether the file is currently in edit mode.

Definition at line 246 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::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 879 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::RefreshEditorState().

◆ IsChanged()

bool DeleteMap::IsChanged ( void  ) const
inline

Definition at line 47 of file deletemap.h.

Referenced by MythPlayerVideoUI::ReinitOSD().

◆ SetChanged()

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

Definition at line 48 of file deletemap.h.

Referenced by MythPlayerVideoUI::ReinitOSD().

◆ SetMap()

void DeleteMap::SetMap ( const frm_dir_map_t map)

Use the given map.

Definition at line 720 of file deletemap.cpp.

Referenced by MythTranscodePlayer::SetCutList(), and Cutter::SetCutList().

◆ LoadCommBreakMap()

void DeleteMap::LoadCommBreakMap ( frm_dir_map_t map)

Loads the given commercial break map into the deleteMap.

Definition at line 731 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::HandleProgramEditorActions().

◆ SaveMap()

void DeleteMap::SaveMap ( bool  isAutoSave = false)

Saves the delete map to the database.

Definition at line 778 of file deletemap.cpp.

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

◆ LoadMap()

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

◆ LoadAutoSaveMap()

bool DeleteMap::LoadAutoSaveMap ( void  )

Returns true if an auto-save map was loaded.

Does nothing and returns false if not.

Definition at line 758 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::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 664 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 265 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 274 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 397 of file deletemap.cpp.

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

◆ Delete() [1/2]

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

Remove the mark at the given frame.

Definition at line 364 of file deletemap.cpp.

Referenced by AddMark(), CleanMap(), HandleAction(), MythPlayerEditorUI::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 503 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 538 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 575 of file deletemap.cpp.

Referenced by MythPlayer::IsInDelete(), NewCut(), MythPlayerEditorUI::RefreshEditorState(), 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 615 of file deletemap.cpp.

Referenced by Delete(), MythPlayerEditorUI::HandleArbSeek(), MoveRelative(), NewCut(), MythPlayerEditorUI::RefreshEditorState(), 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 600 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::RefreshEditorState().

◆ HasTemporaryMark()

bool DeleteMap::HasTemporaryMark ( void  ) const

Returns true if a temporary placeholder mark is defined.

Definition at line 647 of file deletemap.cpp.

Referenced by MythPlayerEditorUI::RefreshEditorState().

◆ 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 862 of file deletemap.cpp.

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

◆ TranslatePositionFrameToMs()

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

Definition at line 902 of file deletemap.cpp.

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

◆ TranslatePositionMsToFrame()

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

Definition at line 911 of file deletemap.cpp.

◆ TranslatePositionAbsToRel()

uint64_t DeleteMap::TranslatePositionAbsToRel ( uint64_t  position) const

Definition at line 921 of file deletemap.cpp.

◆ TranslatePositionRelToAbs()

uint64_t DeleteMap::TranslatePositionRelToAbs ( uint64_t  position) const

Definition at line 926 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 811 of file deletemap.cpp.

Referenced by Cutter::Activate(), MythPlayer::ClearAfterSeek(), MythPlayerEditorUI::DisableEdit(), Cutter::NewFrame(), MythPlayer::OpenFile(), and MythTranscodePlayer::TranscodeGetNextFrame().

◆ TrackerWantsToJump()

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

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 847 of file deletemap.cpp.

Referenced by MythPlayerUI::EventLoop(), Cutter::NewFrame(), MythPlayer::OpenFile(), and MythTranscodePlayer::TranscodeGetNextFrame().

◆ Undo()

bool DeleteMap::Undo ( void  )

Definition at line 49 of file deletemap.cpp.

Referenced by HandleAction().

◆ Redo()

bool DeleteMap::Redo ( void  )

Definition at line 62 of file deletemap.cpp.

Referenced by HandleAction().

◆ HasUndo()

bool DeleteMap::HasUndo ( void  ) const
inline

Definition at line 87 of file deletemap.h.

Referenced by GetUndoMessage(), MythPlayerEditorUI::RefreshEditorState(), and Undo().

◆ HasRedo()

bool DeleteMap::HasRedo ( void  ) const
inline

Definition at line 88 of file deletemap.h.

Referenced by GetRedoMessage(), Redo(), and MythPlayerEditorUI::RefreshEditorState().

◆ GetUndoMessage()

QString DeleteMap::GetUndoMessage ( void  ) const

◆ GetRedoMessage()

QString DeleteMap::GetRedoMessage ( void  ) const

◆ 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 554 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 561 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 37 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 162 of file deletemap.cpp.

Referenced by UpdateOSD().

Member Data Documentation

◆ m_editing

bool DeleteMap::m_editing {false}
private

Definition at line 105 of file deletemap.h.

Referenced by SetEditing().

◆ m_nextCutStartIsValid

bool DeleteMap::m_nextCutStartIsValid {false}
private

Definition at line 106 of file deletemap.h.

Referenced by TrackerReset(), and TrackerWantsToJump().

◆ m_nextCutStart

uint64_t DeleteMap::m_nextCutStart {0}
private

Definition at line 107 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 109 of file deletemap.h.

Referenced by UpdateOSD(), and UpdateSeekAmount().

◆ m_changed

bool DeleteMap::m_changed {true}
private

Definition at line 110 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 111 of file deletemap.h.

Referenced by UpdateSeekAmount().

◆ m_seekamount

float DeleteMap::m_seekamount {1.0F}
private

Definition at line 112 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 114 of file deletemap.h.

Referenced by UpdateOSD().

◆ m_undoStack

QVector<DeleteMapUndoEntry> DeleteMap::m_undoStack
private

Definition at line 116 of file deletemap.h.

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

◆ m_undoStackPointer

int DeleteMap::m_undoStackPointer {0}
private

Definition at line 117 of file deletemap.h.

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


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