Skip to content

Commit

Permalink
remove DecoderBase::InsertTrack()
Browse files Browse the repository at this point in the history
It does not make semantic sense to modify m_tracks from outside DecoderBase or
its subclasses.

DecoderBase::InsertTrack() is only used by cc708reader.cpp for kTrackTypeCC708

The call graph eventually goes back to AvFormatDecoder::DecodeCCx08() which will
call AvFormatDecoder::UpdateCaptionTracksFromStreams() afterwards, which calls
AvFormatDecoder::UpdateATSCCaptionTracks() which will clear
m_tracks[kTrackTypeCC608] and m_tracks[kTrackTypeCC708].  Therefore, the
inserted track is immediately deleted before it is used.

However, the emitted signal may do something, although I don’t know why it sends
a signal to itself instead of being able to call it directly.

The signal would be emitted if a track for that service_num was not in
AvFormatDecoder::m_tracks.  However, this does not make sense since the selected
track has not changed and this track did not exist, so it was not in use to
change.  If there were no kTrackTypeCC708 tracks, the signal will still be
emitted when AvFormatDecoder::GetFrame() next calls
DecoderBase::AutoSelectTracks().
  • Loading branch information
ulmus-scott authored and bennettpeter committed Jan 6, 2025
1 parent f07b5df commit 97b14e3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
5 changes: 0 additions & 5 deletions mythtv/libs/libmythtv/captions/cc708reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ void CC708Reader::DefineWindow(
int row_lock, int column_lock,
int pen_style, int window_style)
{
if (m_parent && m_parent->GetDecoder())
{
StreamInfo si {-1, static_cast<int>(service_num)};
m_parent->GetDecoder()->InsertTrack(kTrackTypeCC708, si);
}

CHECKENABLED;

Expand Down
18 changes: 0 additions & 18 deletions mythtv/libs/libmythtv/decoders/decoderbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,24 +1013,6 @@ int DecoderBase::NextTrack(uint Type)
return next_track;
}

bool DecoderBase::InsertTrack(uint Type, const StreamInfo &Info)
{
QMutexLocker locker(&m_trackLock);

if (std::any_of(m_tracks[Type].cbegin(), m_tracks[Type].cend(),
[&](const StreamInfo& Si) { return Si.m_stream_id == Info.m_stream_id; } ))
{
return false;
}

m_tracks[Type].push_back(Info);

if (m_parent)
emit m_parent->SignalTracksChanged(Type);

return true;
}

/** \fn DecoderBase::BestTrack(uint, bool)
* \brief Determine the best track according to weights
*
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/decoders/decoderbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ class DecoderBase
int GetTrack(uint Type);
StreamInfo GetTrackInfo(uint Type, uint TrackNo);
int ChangeTrack(uint Type, int Dir);
virtual bool InsertTrack(uint Type, const StreamInfo &Info);
int NextTrack(uint Type);

virtual int GetTeletextDecoderType(void) const { return -1; }
Expand Down

0 comments on commit 97b14e3

Please sign in to comment.