New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PVR] Cleanup: Reduce cores/VideoPlayer/Edl.cpp PVR dependencies. #16709
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ enum class Action | |
{ | ||
CUT = 0, | ||
MUTE = 1, | ||
// SCENE = 2, | ||
SCENE = 2, | ||
COMM_BREAK = 3 | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,7 @@ | |
#include "ServiceBroker.h" | ||
#include "cores/Cut.h" | ||
#include "filesystem/File.h" | ||
#include "pvr/PVRManager.h" | ||
#include "pvr/epg/EpgInfoTag.h" | ||
#include "pvr/recordings/PVRRecording.h" | ||
#include "pvr/PVREdl.h" | ||
#include "settings/AdvancedSettings.h" | ||
#include "settings/SettingsComponent.h" | ||
#include "utils/StringUtils.h" | ||
|
@@ -75,22 +73,8 @@ bool CEdl::ReadEditDecisionLists(const CFileItem& fileItem, const float fFramesP | |
if (!bFound) | ||
bFound = ReadBeyondTV(strMovie); | ||
} | ||
|
||
/* | ||
* PVR Recordings | ||
*/ | ||
else if (fileItem.IsPVRRecording()) | ||
else | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Checking for edit decision list (EDL) for PVR recording: %s", | ||
__FUNCTION__, CURL::GetRedacted(strMovie).c_str()); | ||
|
||
bFound = ReadPvr(fileItem); | ||
} | ||
else if (fileItem.IsEPG()) | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Checking for edit decision list (EDL) for EPG entry: %s", | ||
__FUNCTION__, CURL::GetRedacted(strMovie).c_str()); | ||
|
||
bFound = ReadPvr(fileItem); | ||
} | ||
|
||
|
@@ -542,79 +526,48 @@ bool CEdl::ReadBeyondTV(const std::string& strMovie) | |
|
||
bool CEdl::ReadPvr(const CFileItem &fileItem) | ||
{ | ||
const std::string strMovie = fileItem.GetDynPath(); | ||
if (!CServiceBroker::GetPVRManager().IsStarted()) | ||
{ | ||
CLog::Log(LOGERROR, "%s - PVR Manager not started, cannot read Edl for %s", __FUNCTION__, CURL::GetRedacted(strMovie).c_str()); | ||
return false; | ||
} | ||
|
||
std::vector<PVR_EDL_ENTRY> edl; | ||
|
||
if (fileItem.HasPVRRecordingInfoTag()) | ||
const std::vector<Cut> cutlist = PVR::CPVREdl::GetCuts(fileItem); | ||
for (const auto& cut : cutlist) | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Reading Edl for recording: %s", __FUNCTION__, fileItem.GetPVRRecordingInfoTag()->m_strTitle.c_str()); | ||
edl = fileItem.GetPVRRecordingInfoTag()->GetEdl(); | ||
} | ||
else if (fileItem.HasEPGInfoTag()) | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Reading Edl for EPG: %s", __FUNCTION__, fileItem.GetEPGInfoTag()->Title().c_str()); | ||
edl = fileItem.GetEPGInfoTag()->GetEdl(); | ||
} | ||
else | ||
{ | ||
CLog::Log(LOGERROR, "%s - Unknown file item type : %s", __FUNCTION__, CURL::GetRedacted(strMovie).c_str()); | ||
return false; | ||
} | ||
|
||
std::vector<PVR_EDL_ENTRY>::const_iterator it; | ||
for (it = edl.begin(); it != edl.end(); ++it) | ||
{ | ||
Cut cut; | ||
cut.start = it->start; | ||
cut.end = it->end; | ||
|
||
switch (it->type) | ||
switch (cut.action) | ||
{ | ||
case PVR_EDL_TYPE_CUT: | ||
cut.action = Action::CUT; | ||
break; | ||
case PVR_EDL_TYPE_MUTE: | ||
cut.action = Action::MUTE; | ||
break; | ||
case PVR_EDL_TYPE_SCENE: | ||
if (!AddSceneMarker(cut.end)) | ||
{ | ||
CLog::Log(LOGWARNING, "%s - Error adding scene marker for pvr recording", __FUNCTION__); | ||
} | ||
continue; | ||
case PVR_EDL_TYPE_COMBREAK: | ||
cut.action = Action::COMM_BREAK; | ||
break; | ||
default: | ||
CLog::Log(LOGINFO, "%s - Ignoring entry of unknown type: %d", __FUNCTION__, it->type); | ||
continue; | ||
} | ||
case Action::CUT: | ||
case Action::MUTE: | ||
case Action::COMM_BREAK: | ||
if (AddCut(cut)) | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Added break [%s - %s] found in PVR item for: %s.", | ||
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(), | ||
MillisecondsToTimeString(cut.end).c_str(), CURL::GetRedacted(fileItem.GetDynPath()).c_str()); | ||
} | ||
else | ||
{ | ||
CLog::Log(LOGERROR, "%s - Invalid break [%s - %s] found in PVR item for: %s. Continuing anyway.", | ||
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(), | ||
MillisecondsToTimeString(cut.end).c_str(), CURL::GetRedacted(fileItem.GetDynPath()).c_str()); | ||
} | ||
break; | ||
|
||
if (AddCut(cut)) | ||
{ | ||
CLog::Log(LOGDEBUG, "%s - Added break [%s - %s] found in PVRRecording for: %s.", | ||
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(), | ||
MillisecondsToTimeString(cut.end).c_str(), CURL::GetRedacted(strMovie).c_str()); | ||
} | ||
else | ||
{ | ||
CLog::Log(LOGERROR, "%s - Invalid break [%s - %s] found in PVRRecording for: %s. Continuing anyway.", | ||
__FUNCTION__, MillisecondsToTimeString(cut.start).c_str(), | ||
MillisecondsToTimeString(cut.end).c_str(), CURL::GetRedacted(strMovie).c_str()); | ||
case Action::SCENE: | ||
if (!AddSceneMarker(cut.end)) | ||
{ | ||
CLog::Log(LOGWARNING, "%s - Error adding scene marker for PVR item", __FUNCTION__); | ||
} | ||
break; | ||
|
||
default: | ||
CLog::Log(LOGINFO, "%s - Ignoring entry of unknown cut action: %d", __FUNCTION__, static_cast<int>(cut.action)); | ||
break; | ||
Comment on lines
+551
to
+560
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#32-indentation |
||
} | ||
} | ||
|
||
return !edl.empty(); | ||
return !cutlist.empty(); | ||
} | ||
|
||
bool CEdl::AddCut(Cut& cut) | ||
bool CEdl::AddCut(const Cut& newCut) | ||
{ | ||
Cut cut = newCut; | ||
|
||
if (cut.action != Action::CUT && cut.action != Action::MUTE && cut.action != Action::COMM_BREAK) | ||
{ | ||
CLog::Log(LOGERROR, "%s - Not an Action::CUT, Action::MUTE, or Action::COMM_BREAK! [%s - %s], %d", __FUNCTION__, | ||
|
@@ -793,6 +746,8 @@ std::string CEdl::GetInfo() const | |
case Action::COMM_BREAK: | ||
commBreakCount++; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
if (cutCount > 0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2012-2018 Team Kodi | ||
* This file is part of Kodi - https://kodi.tv | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* See LICENSES/README.md for more information. | ||
*/ | ||
|
||
#include "PVREdl.h" | ||
|
||
#include "FileItem.h" | ||
#include "URL.h" | ||
#include "addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h" | ||
#include "cores/Cut.h" | ||
#include "pvr/epg/EpgInfoTag.h" | ||
#include "pvr/recordings/PVRRecording.h" | ||
#include "utils/log.h" | ||
|
||
namespace PVR | ||
{ | ||
|
||
std::vector<EDL::Cut> CPVREdl::GetCuts(const CFileItem& item) | ||
{ | ||
std::vector<PVR_EDL_ENTRY> edl; | ||
|
||
if (item.HasPVRRecordingInfoTag()) | ||
{ | ||
CLog::LogFC(LOGDEBUG, LOGPVR, "Reading EDL for recording: %s", item.GetPVRRecordingInfoTag()->m_strTitle.c_str()); | ||
edl = item.GetPVRRecordingInfoTag()->GetEdl(); | ||
} | ||
else if (item.HasEPGInfoTag()) | ||
{ | ||
CLog::LogFC(LOGDEBUG, LOGPVR, "Reading EDL for EPG tag: %s", item.GetEPGInfoTag()->Title().c_str()); | ||
edl = item.GetEPGInfoTag()->GetEdl(); | ||
} | ||
else | ||
{ | ||
CLog::LogF(LOGERROR, "Unhandled file item: %s", CURL::GetRedacted(item.GetDynPath()).c_str()); | ||
return {}; | ||
} | ||
|
||
std::vector<EDL::Cut> cutlist; | ||
for (const auto& entry : edl) | ||
{ | ||
EDL::Cut cut; | ||
cut.start = entry.start; | ||
cut.end = entry.end; | ||
|
||
switch (entry.type) | ||
{ | ||
case PVR_EDL_TYPE_CUT: | ||
cut.action = EDL::Action::CUT; | ||
break; | ||
case PVR_EDL_TYPE_MUTE: | ||
cut.action = EDL::Action::MUTE; | ||
break; | ||
case PVR_EDL_TYPE_SCENE: | ||
cut.action = EDL::Action::SCENE; | ||
break; | ||
case PVR_EDL_TYPE_COMBREAK: | ||
cut.action = EDL::Action::COMM_BREAK; | ||
break; | ||
default: | ||
CLog::LogF(LOGWARNING, "Ignoring entry of unknown EDL type: %d", entry.type); | ||
continue; | ||
} | ||
|
||
cutlist.emplace_back(cut); | ||
} | ||
return cutlist; | ||
} | ||
|
||
} // namespace PVR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2012-2018 Team Kodi | ||
* This file is part of Kodi - https://kodi.tv | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* See LICENSES/README.md for more information. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
class CFileItem; | ||
|
||
namespace EDL | ||
{ | ||
struct Cut; | ||
} | ||
|
||
namespace PVR | ||
{ | ||
|
||
class CPVREdl | ||
{ | ||
public: | ||
/*! | ||
* @brief Get the cuts for the given item. | ||
* @param item The item. | ||
* @return The EDL cuts or enpty vector if no cuts exist. | ||
*/ | ||
static std::vector<EDL::Cut> GetCuts(const CFileItem& item); | ||
}; | ||
|
||
} // namespace PVR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#32-indentation