MCPcopy Create free account
hub / github.com/apache/brpc / EncodePATPMT

Method EncodePATPMT

src/brpc/ts.cpp:1338–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1336}
1337
1338butil::Status
1339TsWriter::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
1368butil::Status TsWriter::Encode(TsMessage* msg, TsStream stream, TsPid pid) {
1369 if (stream == TS_STREAM_RESERVED) {

Callers

nothing calls this directly

Calls 6

CreateAsPATMethod · 0.80
CreateAsPMTMethod · 0.80
StatusEnum · 0.70
ByteSizeMethod · 0.45
EncodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected