}
/* remember, this gets called from another thread. */
-void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)
+void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size, int blocksize)
{
- const int blocksize = 188;
unsigned int max = align(1024*1024*1024, blocksize);
current_offset = align(current_offset, blocksize);
int m_skipmode_m, m_skipmode_n, m_skipmode_frames, m_skipmode_frames_remainder;
std::list<std::pair<off_t, off_t> > m_source_span;
- void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size);
+ void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size, int blocksize);
void flushPVR(iDVBDemux *decoding_demux=0);
eSingleLock m_cuesheet_lock;
eDVBTSTools::eDVBTSTools():
m_pid(-1),
+ m_packet_size(188),
m_begin_valid (0),
m_end_valid(0),
m_samples_taken(0),
void eDVBTSTools::closeSource()
{
m_source = NULL;
+ m_packet_size = 188;
}
eDVBTSTools::~eDVBTSTools()
m_streaminfo.load(stream_info_filename);
}
m_samples_taken = 0;
+ m_packet_size = m_source ? m_source->getPacketSize() : 188;
}
/* getPTS extracts a pts value from any PID at a given offset. */
if (!m_source || !m_source->valid())
return -1;
- offset -= offset % 188;
+ offset -= offset % m_packet_size;
int left = m_maxrange;
int resync_failed_counter = 64;
- while (left >= 188)
+ while (left >= m_packet_size)
{
- unsigned char packet[188];
- if (m_source->read(offset, packet, 188) != 188)
+ unsigned char buffer[m_packet_size];
+ unsigned char *packet = &buffer[m_packet_size - 188];
+ if (m_source->read(offset, buffer, m_packet_size) != m_packet_size)
{
eDebug("[eDVBTSTools] getPTS read error");
return -1;
}
- left -= 188;
- offset += 188;
+ left -= m_packet_size;
+ offset += m_packet_size;
if (packet[0] != 0x47)
{
offset = l->second;
offset += ((pts - l->first) * (pts_t)bitrate) / 8ULL / 90000ULL;
- offset -= offset % 188;
+ offset -= offset % m_packet_size;
if (offset > m_offset_end)
{
/*
int bitrate = calcBitrate();
offset = pts * (pts_t)bitrate / 8ULL / 90000ULL;
eDebug("[eDVBTSTools] getOffset fallback, bitrate=%d, results in %016llx", bitrate, offset);
- offset -= offset % 188;
+ offset -= offset % m_packet_size;
return 0;
}
}
if (bytes_per_sample < 40*1024*1024)
bytes_per_sample = 40*1024*1024;
- bytes_per_sample -= bytes_per_sample % 188;
+ bytes_per_sample -= bytes_per_sample % m_packet_size;
eDebug("[eDVBTSTools] takeSamples step %lld, pts begin %llu, pts end %llu, offs begin %lld, offs end %lld:",
bytes_per_sample, m_pts_begin, m_pts_end, m_offset_begin, m_offset_end);
off_t position=0;
m_pmtready = false;
- for (int attempts_left = (5*1024*1024)/188; attempts_left != 0; --attempts_left)
+ for (int attempts_left = (5*1024*1024)/m_packet_size; attempts_left != 0; --attempts_left)
{
- unsigned char packet[188];
- int ret = m_source->read(position, packet, 188);
- if (ret != 188)
+ unsigned char buffer[m_packet_size];
+ unsigned char *packet = &buffer[m_packet_size - 188];
+ int ret = m_source->read(position, buffer, m_packet_size);
+ if (ret != m_packet_size)
{
eDebug("[eDVBTSTools] findPMT read error");
break;
}
- position += 188;
+ position += m_packet_size;
if (packet[0] != 0x47)
{