9 #include "libmythbase/mythconfig.h"
10 #include "libavcodec/avcodec.h"
11 #include "libavformat/avformat.h"
12 #include "libavutil/crc.h"
13 #include "libavutil/bswap.h"
25 LOG(VB_RECORD, LOG_ERR,
26 "Error: We started a PES packet, without a payloadStart!");
31 LOG(VB_RECORD, LOG_ERR,
32 "Error: Must clone initially to use addPackets()");
37 const int ccExp = (
m_ccLast + 1) & 0xf;
60 LOG(VB_GENERAL, LOG_ERR, QString(
"PESPacket[%1] Invalid adaptation field size:%2 control:%3")
64 payloadStart += delta;
82 packet->
data() + payloadStart,
94 LOG(VB_RECORD, LOG_ERR,
95 QString(
"AddTSPacket[%1]: Out of sync!!! Need to wait for next payloadStart ").arg(cardid) +
96 QString(
"PID: 0x%1, continuity counter: %2 ").arg(packet->
PID(),0,16).arg(
cc) +
97 QString(
"(expected %1)").arg(ccExp));
129 LOG(VB_GENERAL, LOG_ERR,
"WriteAsTSPackets m_pesData == m_fullBuffer");
141 header.
data()[1] = 0x00;
142 header.
data()[2] = 0x00;
143 header.
data()[3] = 0x10;
165 return av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), UINT32_MAX,
174 LOG(VB_SIPARSER, LOG_INFO,
175 QString(
"PESPacket: Failed CRC check 0x%1 != 0x%2 "
176 "for StreamID = 0x%3")
177 .arg(
CRC(),8,16,QLatin1Char(
'0')).arg(
CalcCRC(),8,16,QLatin1Char(
'0')).arg(
StreamID(),0,16));
187 LOG(VB_RECORD, LOG_INFO,
188 QString(
"PESPacket[%1] pid(0x%2): ").arg(cardid).arg(pid,0,16) +
189 QString(
"Failed CRC check 0x%1 != 0x%2 for ID = 0x%3")
190 .arg(
CRC(),8,16,QLatin1Char(
'0')).arg(
CalcCRC(),8,16,QLatin1Char(
'0')).arg(
StreamID(),0,16));
198 0.0000F, 1.0000F, 0.6735F, 0.7031F,
199 0.7615F, 0.8055F, 0.8437F, 0.8935F,
200 0.9157F, 0.9815F, 1.0255F, 1.0695F,
201 1.0950F, 1.1575F, 1.2015F, 0.0000F,
208 0.0000F, 1.0000F, -3.0F/4.0F, -9.0F/16.0F,
209 -1.0F/2.21F, 0.0000F, 0.0000F, 0.0000F,
210 0.0000F, 0.0000F, 0.0000F, 0.0000F,
211 0.0000F, 0.0000F, 0.0000F, 0.0000F,
216 0.0F, 24000/1001.0F, 24.0F, 25.0F,
217 30000/1001.0F, 30.0F, 50.0F, 60000/1001.0F,
218 60.0F, 1.0F, 1.0F, 1.0F,
219 1.0F, 1.0F, 1.0F, 1.0F,
234 retval = (retval <= 0.0F) ?
width() * 1.0F /
height() : retval;
244 #ifndef USING_VALGRIND
245 static std::vector<unsigned char*>
mem188;
260 unsigned char* block_start =
mem188.back();
262 free188.push_back(i * 188_UZ + block_start);
265 unsigned char *ptr =
free188.back();
283 std::vector<unsigned char*>::iterator it;
289 LOG(VB_GENERAL, LOG_DEBUG,
"freeing all 188 blocks");
301 unsigned char* block_start =
mem4096.back();
303 free4096.push_back(i * 4096_UZ + block_start);
306 unsigned char *ptr =
free4096.back();
322 #if 0 // enable this to debug memory leaks
323 LOG(VB_GENERAL, LOG_DEBUG, QString(
"%1 4096 blocks remain")
325 map<unsigned char*, bool>::iterator it;
329 LGO(VB_GENERAL, LOG_DEBUG, QString(
"PES Packet: pid(0x%1)")
330 .arg(ts->
PID(),0,16));
331 if (ts->
PID() == 0x1ffb)
333 LOG(VB_GENERAL, LOG_DEBUG, QString(
" tid(0x%1) ext(0x%2)")
343 std::vector<unsigned char*>::iterator it;
349 LOG(VB_GENERAL, LOG_DEBUG,
"freeing all 4096 blocks");
360 #ifndef USING_VALGRIND
365 #endif // USING_VALGRIND
366 return (
unsigned char*) malloc(size);
372 #ifndef USING_VALGRIND
378 #endif // USING_VALGRIND