Skip to content
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 3 commits into from Oct 5, 2019

Conversation

ksooo
Copy link
Member

@ksooo ksooo commented Oct 4, 2019

Another small refactoring to reduce compile time references to PVR component.

Runtime-tested on macOS, latest master.

@ksooo ksooo added Type: Cleanup non-breaking change which removes non-working or unmaintained functionality Component: PVR v19 Matrix labels Oct 4, 2019
@ksooo ksooo added this to the Matrix 19.0-alpha 1 milestone Oct 4, 2019
@ksooo ksooo requested a review from phunkyfish October 4, 2019 09:24
Copy link
Contributor

@phunkyfish phunkyfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than one minor thing it looks good.

xbmc/cores/VideoPlayer/Edl.cpp Outdated Show resolved Hide resolved
Comment on lines +534 to +549
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception: Do not increase indentation after a switch statements.

https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#32-indentation

Comment on lines +551 to +560
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception: Do not increase indentation after a switch statements.

https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#32-indentation

@@ -564,8 +564,10 @@ bool CEdl::ReadPvr(const CFileItem &fileItem)
return !cutlist.empty();
}

bool CEdl::AddCut(Cut& cut)
bool CEdl::AddCut(const Cut& NewCut)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better pass by value instead of making a copy at the begin of the function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this would be better. Separate interface from implementation...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this relate to separate interface from implementation?
I'm more with rechi here, passing by value makes it obvious to the caller that it will be copied, without needing to even read into the implementation.
But just stating my opinion, decision is yours ofc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it more like this: Normal way of doing things is to pass "large" objects by reference. If I pass by value there must be good reason for this. The fact that the current implementation wants to manipulate the parameter's value is 100% implementation detail, has nothing to do with the interface and this does not justify to break the rule to pass by value only in exceptional cases.

Let's assume I change the implementation not to manipulate the parameter's value anymore. I bet, I easily forget to change the parameter to "const &", which I should do for best interface design, because by-value is no longer needed, then. Ooops. Implementation detail controls the interface? Really? Should not be.

Copy link
Contributor

@phunkyfish phunkyfish Oct 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's like the difference between ModifyAndAddCut(Cut& newCut) and AddCut(const Cut& newCut).

Copy link
Contributor

@phunkyfish phunkyfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should consider emplace_back in AddCut function also right?

xbmc/cores/VideoPlayer/Edl.cpp Outdated Show resolved Hide resolved
@ksooo
Copy link
Member Author

ksooo commented Oct 4, 2019

Should consider emplace_back in AddCut function also right?

Yes, and this is for another PR.

…modified value is not used by callers, making it possible to achieve more constness in calling code.
Copy link
Contributor

@phunkyfish phunkyfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once Jenkins is happy ;)

@ksooo ksooo merged commit 9fbe2e1 into xbmc:master Oct 5, 2019
@ksooo ksooo deleted the pvr-refactor-edl branch October 5, 2019 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: PVR Type: Cleanup non-breaking change which removes non-working or unmaintained functionality v19 Matrix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants