Revision 2cecea08 src/tuner.cpp

View differences:

src/tuner.cpp
69 69
  unsubscribeAll();
70 70

  
71 71
  // Destroy all the Demuxes
72
  for (DemuxerMap::iterator i = demuxerMap.begin(); i != demuxerMap.end(); i++) {
73
    PIDMap &pidmap = i->second;
74
    for (PIDMap::iterator j = pidmap.begin(); j != pidmap.end(); j++)
75
      delete j->second;
72
  for (int h = 0; h < 2; h++) {
73
    DemuxerMap &dm = demuxerMap[h];
74
    for (DemuxerMap::iterator i = dm.begin(); i != dm.end(); i++) {
75
      PIDMap &pidmap = i->second;
76
      for (PIDMap::iterator j = pidmap.begin(); j != pidmap.end(); j++)
77
	delete j->second;
78
    }
76 79
  }
77 80
}
78 81

  
......
98 101
  return s.readyToRead(dvrFD);
99 102
}
100 103

  
101
Demuxer *Tuner::makeNewDemuxer(int pid, Demuxer::PESType pesType) const
104
Demuxer *Tuner::makeNewDemuxer(int pid, bool convertToPS, Demuxer::PESType pesType) const
102 105
{
103
  return new Demuxer(const_cast<Tuner *>(this), pid, pesType);
106
  return new Demuxer(const_cast<Tuner *>(this), pid, convertToPS, pesType);
104 107
}
105 108

  
106 109
// Keep a list of all the demuxers ever created
107
Demuxer *Tuner::getDemuxer(int pid, Demuxer::PESType pesType) const
110
Demuxer *Tuner::getDemuxer(int pid, bool convertToPS, Demuxer::PESType pesType) const
108 111
{
109 112
  // Strictly speaking getDemuxer() is not a const
110 113
  // method, however, it does have minimal side
......
116 119

  
117 120
  assert(tuneParams != NULL);
118 121

  
119
  PIDMap &pidMap = demuxerMap[tuneParams];
122
  DemuxerMap &dm = demuxerMap[ convertToPS ? 1 : 0 ];
123
  PIDMap &pidMap = dm[tuneParams];
120 124
  Demuxer *&demuxer = pidMap[pid];
121 125

  
122 126
  if (demuxer == NULL)
123
    demuxer = makeNewDemuxer(pid, pesType);
127
    demuxer = makeNewDemuxer(pid, convertToPS, pesType);
124 128

  
125 129
  return demuxer;
126 130
}

Also available in: Unified diff