| 1336 | } |
| 1337 | |
| 1338 | butil::Status |
| 1339 | TsWriter::EncodePATPMT(TsStream vs, TsPid vpid, TsStream as, TsPid apid) { |
| 1340 | char buf[TS_PACKET_SIZE]; |
| 1341 | |
| 1342 | TsPacket pat(&_tschan_group); |
| 1343 | pat.CreateAsPAT(TS_PMT_NUMBER, TS_PID_PMT); |
| 1344 | // set the left bytes with 0xFF. |
| 1345 | const size_t size1 = pat.ByteSize(); |
| 1346 | CHECK_LT(size1, TS_PACKET_SIZE); |
| 1347 | memset(buf, 0xFF, TS_PACKET_SIZE); |
| 1348 | if (pat.Encode(buf) != 0) { |
| 1349 | return butil::Status(EINVAL, "Fail to encode PAT"); |
| 1350 | } |
| 1351 | _outbuf->append(buf, TS_PACKET_SIZE); |
| 1352 | |
| 1353 | TsPacket pmt(&_tschan_group); |
| 1354 | if (pmt.CreateAsPMT(TS_PMT_NUMBER, TS_PID_PMT, vpid, vs, apid, as) != 0) { |
| 1355 | return butil::Status(EINVAL, "Fail to CreateAsPMT"); |
| 1356 | } |
| 1357 | // set the left bytes with 0xFF. |
| 1358 | const size_t size2 = pmt.ByteSize(); |
| 1359 | CHECK_LT(size2, TS_PACKET_SIZE); |
| 1360 | memset(buf, 0xFF, TS_PACKET_SIZE); |
| 1361 | if (pmt.Encode(buf) != 0) { |
| 1362 | return butil::Status(EINVAL, "Fail to encode PMT"); |
| 1363 | } |
| 1364 | _outbuf->append(buf, TS_PACKET_SIZE); |
| 1365 | return butil::Status::OK(); |
| 1366 | } |
| 1367 | |
| 1368 | butil::Status TsWriter::Encode(TsMessage* msg, TsStream stream, TsPid pid) { |
| 1369 | if (stream == TS_STREAM_RESERVED) { |
nothing calls this directly
no test coverage detected