kodi
Edl.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "cores/EdlEdit.h"
12 
13 #include <string>
14 #include <vector>
15 
16 class CFileItem;
17 
18 class CEdl
19 {
20 public:
21  CEdl();
22 
23  // FIXME: remove const modifier for fFramesPerSecond as it makes no sense as it means nothing
24  // for the reader of the interface, but limits the implementation
25  // to not modify the parameter on stack
26  bool ReadEditDecisionLists(const CFileItem& fileItem, const float fFramesPerSecond);
27  void Clear();
28 
33  bool HasEdits() const;
34 
39  bool HasCuts() const;
40 
41  bool HasSceneMarker() const;
42 
48  int GetTotalCutTime() const;
49 
58  int GetTimeWithoutCuts(int seek) const;
59 
69  double GetTimeAfterRestoringCuts(double seek) const;
70 
76  const std::vector<EDL::Edit>& GetRawEditList() const { return m_vecEdits; }
77 
84  const std::vector<EDL::Edit> GetEditList() const;
85 
93  const std::vector<int64_t> GetCutMarkers() const;
94 
102  const std::vector<int64_t> GetSceneMarkers() const;
103 
113  bool InEdit(int iSeek, EDL::Edit* pEdit = nullptr);
114 
120  int GetLastEditTime() const;
121 
127  void SetLastEditTime(int editTime);
128 
132  void ResetLastEditTime();
133 
138  void SetLastEditActionType(EDL::Action action);
139 
145  EDL::Action GetLastEditActionType() const;
146 
147  // FIXME: remove const modifier for iClock as it makes no sense as it means nothing
148  // for the reader of the interface, but limits the implementation
149  // to not modify the parameter on stack
150  bool GetNextSceneMarker(bool bPlus, const int iClock, int *iSceneMarker);
151 
152  // FIXME: remove const modifier as it makes no sense as it means nothing
153  // for the reader of the interface, but limits the implementation
154  // to not modify the parameter on stack
155  static std::string MillisecondsToTimeString(const int iMilliseconds);
156 
157 private:
158  // total cut time (edl cuts) in ms
159  int m_totalCutTime;
160  std::vector<EDL::Edit> m_vecEdits;
161  std::vector<int> m_vecSceneMarkers;
162 
166  int m_lastEditTime;
167 
171  EDL::Action m_lastEditActionType{EDL::EDL_ACTION_NONE};
172 
173  // FIXME: remove const modifier for fFramesPerSecond as it makes no sense as it means nothing
174  // for the reader of the interface, but limits the implementation
175  // to not modify the parameter on stack
176  bool ReadEdl(const std::string& strMovie, const float fFramesPerSecond);
177  // FIXME: remove const modifier for fFramesPerSecond as it makes no sense as it means nothing
178  // for the reader of the interface, but limits the implementation
179  // to not modify the parameter on stack
180  bool ReadComskip(const std::string& strMovie, const float fFramesPerSecond);
181  // FIXME: remove const modifier for strMovie as it makes no sense as it means nothing
182  // for the reader of the interface, but limits the implementation
183  // to not modify the parameter on stack
184  bool ReadVideoReDo(const std::string& strMovie);
185  // FIXME: remove const modifier for strMovie as it makes no sense as it means nothing
186  // for the reader of the interface, but limits the implementation
187  // to not modify the parameter on stack
188  bool ReadBeyondTV(const std::string& strMovie);
189  bool ReadPvr(const CFileItem& fileItem);
190 
196  bool AddEdit(const EDL::Edit& newEdit);
197 
198  // FIXME: remove const modifier for strMovie as it makes no sense as it means nothing
199  // for the reader of the interface, but limits the implementation
200  // to not modify the parameter on stack
201  bool AddSceneMarker(const int sceneMarker);
202 
203  void MergeShortCommBreaks();
204 
209  void AddSceneMarkersAtStartAndEndOfEdits();
210 };
bool HasCuts() const
Check if the edit list has EDL cuts (edits with action CUT)
Definition: Edl.cpp:729
Definition: EdlEdit.h:24
double GetTimeAfterRestoringCuts(double seek) const
Provided a given seek time, return the time after correction with the addition of the already surpass...
Definition: Edl.cpp:820
int GetTotalCutTime() const
Get the total cut time removed from the original item because of EDL cuts.
Definition: Edl.cpp:734
int GetLastEditTime() const
Get the last processed edit time (set during playback when a given edit is surpassed) ...
Definition: Edl.cpp:860
bool InEdit(int iSeek, EDL::Edit *pEdit=nullptr)
Check if for the provided seek time is contained within an EDL edit and fill pEdit with the respectiv...
Definition: Edl.cpp:842
const std::vector< int64_t > GetCutMarkers() const
Get the list of EDL cut markers.
Definition: Edl.cpp:768
void SetLastEditActionType(EDL::Action action)
Set the last processed edit action type.
Definition: Edl.cpp:875
const std::vector< int64_t > GetSceneMarkers() const
Get the list of EDL scene markers.
Definition: Edl.cpp:783
const std::vector< EDL::Edit > & GetRawEditList() const
Get the raw EDL edit list.
Definition: Edl.h:76
EDL::Action GetLastEditActionType() const
Get the last processed edit action type (set during playback when a given edit is surpassed) ...
Definition: Edl.cpp:880
bool HasEdits() const
Check if there are any parsed edits in EDL for the current item.
Definition: Edl.cpp:724
void SetLastEditTime(int editTime)
Set the last processed edit time (set during playback when a given edit is surpassed) ...
Definition: Edl.cpp:865
Definition: Edl.h:18
void ResetLastEditTime()
Reset the last recorded edit time (-1)
Definition: Edl.cpp:870
int GetTimeWithoutCuts(int seek) const
Providing a given seek time, return the actual time without considering cut ranges removed from the f...
Definition: Edl.cpp:794
const std::vector< EDL::Edit > GetEditList() const
Get the EDL edit list.
Definition: Edl.cpp:739
Represents a file on a share.
Definition: FileItem.h:102