本文整理汇总了C++中sp::findSize方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::findSize方法的具体用法?C++ sp::findSize怎么用?C++ sp::findSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::findSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDecoderNotify
void DirectRenderer::onDecoderNotify(const sp<AMessage> &msg) {
size_t trackIndex;
CHECK(msg->findSize("trackIndex", &trackIndex));
int32_t what;
CHECK(msg->findInt32("what", &what));
switch (what) {
case DecoderContext::kWhatOutputBufferReady:
{
size_t index;
CHECK(msg->findSize("index", &index));
int64_t timeUs;
CHECK(msg->findInt64("timeUs", &timeUs));
sp<ABuffer> buffer;
CHECK(msg->findBuffer("buffer", &buffer));
queueOutputBuffer(trackIndex, index, timeUs, buffer);
break;
}
default:
TRESPASS();
}
}
示例2: autoLock
void NuCachedSource2::onRead(const sp<AMessage> &msg) {
ALOGV("onRead");
int64_t offset;
CHECK(msg->findInt64("offset", &offset));
void *data;
CHECK(msg->findPointer("data", &data));
size_t size;
CHECK(msg->findSize("size", &size));
ssize_t result = readInternal(offset, data, size);
if (result == -EAGAIN) {
msg->post(50000);
return;
}
Mutex::Autolock autoLock(mLock);
if (mDisconnecting) {
mCondition.signal();
return;
}
CHECK(mAsyncResult == NULL);
mAsyncResult = new AMessage;
mAsyncResult->setInt32("result", result);
mCondition.signal();
}
示例3: onSetFormat
void DirectRenderer::onSetFormat(const sp<AMessage> &msg) {
size_t trackIndex;
CHECK(msg->findSize("trackIndex", &trackIndex));
sp<AMessage> format;
CHECK(msg->findMessage("format", &format));
internalSetFormat(trackIndex, format);
}
示例4: onQueueAccessUnit
void DirectRenderer::onQueueAccessUnit(const sp<AMessage> &msg) {
size_t trackIndex;
CHECK(msg->findSize("trackIndex", &trackIndex));
sp<ABuffer> accessUnit;
CHECK(msg->findBuffer("accessUnit", &accessUnit));
CHECK_LT(trackIndex, 2u);
CHECK(mDecoderContext[trackIndex] != NULL);
mDecoderContext[trackIndex]->queueInputBuffer(accessUnit);
}
示例5: onMessageReceived
void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
switch (msg->what()) {
case kWhatSetDataSource:
{
ALOGV("kWhatSetDataSource");
CHECK(mSource == NULL);
sp<RefBase> obj;
CHECK(msg->findObject("source", &obj));
mSource = static_cast<Source *>(obj.get());
looper()->registerHandler(mSource);
CHECK(mDriver != NULL);
sp<NuPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
driver->notifySetDataSourceCompleted(OK);
}
break;
}
case kWhatPrepare:
{
mSource->prepareAsync();
break;
}
case kWhatGetTrackInfo:
{
uint32_t replyID;
CHECK(msg->senderAwaitsResponse(&replyID));
status_t err = INVALID_OPERATION;
if (mSource != NULL) {
Parcel* reply;
CHECK(msg->findPointer("reply", (void**)&reply));
err = mSource->getTrackInfo(reply);
}
sp<AMessage> response = new AMessage;
response->setInt32("err", err);
response->postReply(replyID);
break;
}
case kWhatSelectTrack:
{
uint32_t replyID;
CHECK(msg->senderAwaitsResponse(&replyID));
status_t err = INVALID_OPERATION;
if (mSource != NULL) {
size_t trackIndex;
int32_t select;
CHECK(msg->findSize("trackIndex", &trackIndex));
CHECK(msg->findInt32("select", &select));
err = mSource->selectTrack(trackIndex, select);
}
sp<AMessage> response = new AMessage;
response->setInt32("err", err);
response->postReply(replyID);
break;
}
case kWhatPollDuration:
{
int32_t generation;
CHECK(msg->findInt32("generation", &generation));
if (generation != mPollDurationGeneration) {
// stale
break;
}
int64_t durationUs;
if (mDriver != NULL && mSource->getDuration(&durationUs) == OK) {
sp<NuPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
driver->notifyDuration(durationUs);
}
}
msg->post(1000000ll); // poll again in a second.
break;
}
case kWhatSetVideoNativeWindow:
{
ALOGV("kWhatSetVideoNativeWindow");
mDeferredActions.push_back(
new ShutdownDecoderAction(
false /* audio */, true /* video */));
sp<RefBase> obj;
//.........这里部分代码省略.........
示例6: onMessageReceived
void RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
if (msg->what() == kWhatDisconnect) {
uint32_t replyID;
CHECK(msg->senderAwaitsResponse(&replyID));
mDisconnectReplyID = replyID;
finishDisconnectIfPossible();
return;
} else if (msg->what() == kWhatPerformSeek) {
int32_t generation;
CHECK(msg->findInt32("generation", &generation));
if (generation != mSeekGeneration) {
// obsolete.
return;
}
int64_t seekTimeUs;
CHECK(msg->findInt64("timeUs", &seekTimeUs));
performSeek(seekTimeUs);
return;
} else if (msg->what() == kWhatPerformPlay) {
int64_t playTimeUs;
CHECK(msg->findInt64("timeUs", &playTimeUs));
performPlay(playTimeUs);
return;
} else if (msg->what() == kWhatPerformPause) {
performPause();
return;
} else if (msg->what() == kWhatPerformResume) {
performResume();
return;
} else if (msg->what() == kWhatPerformSuspend) {
performSuspend();
return;
}
CHECK_EQ(msg->what(), (uint32_t)kWhatNotify);
int32_t what;
int32_t isSeekable = 0;
CHECK(msg->findInt32("what", &what));
switch (what) {
case RtspConnectionHandler::kWhatConnected:
CHECK(msg->findInt32("isSeekable", &isSeekable));
onConnected((isSeekable ? true:false));
break;
case RtspConnectionHandler::kWhatDisconnected:
onDisconnected(msg);
break;
case RtspConnectionHandler::kWhatSeekDone:
{
mState = PLAYING;
// Even if we have reset mLatestPausedUnit in performSeek(),
// it's still possible that kWhatPausedDone event may arrive
// because of previous performPause() command.
for (size_t i = 0; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = 0;
}
mLatestPausedUnit = 0;
break;
}
case RtspConnectionHandler::kWhatPausedDone:
{
for (size_t i = 0; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = info->mLatestReceivedUnit;
}
// The timestamp after a 'Pause' is done is the earliest
// timestamp among all of the latest received units.
TrackInfo *info = &mTracks.editItemAt(0);
mLatestPausedUnit = info->mLatestReceivedUnit;
for (size_t i = 1; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
if (mLatestPausedUnit > info->mLatestReceivedUnit) {
mLatestPausedUnit = info->mLatestReceivedUnit;
}
}
break;
}
case RtspConnectionHandler::kWhatAccessUnit:
{
size_t trackIndex;
CHECK(msg->findSize("trackIndex", &trackIndex));
CHECK_LT(trackIndex, mTracks.size());
sp<RefBase> obj;
CHECK(msg->findObject("accessUnit", &obj));
sp<ABuffer> accessUnit = static_cast<ABuffer *>(obj.get());
int32_t damaged;
//.........这里部分代码省略.........
示例7: onMessageReceived
void ARTPSession::onMessageReceived(const sp<AMessage> &msg) {
switch (msg->what()) {
case kWhatAccessUnitComplete:
{
int32_t firstRTCP;
if (msg->findInt32("first-rtcp", &firstRTCP)) {
// There won't be an access unit here, it's just a notification
// that the data communication worked since we got the first
// rtcp packet.
break;
}
size_t trackIndex;
CHECK(msg->findSize("track-index", &trackIndex));
int32_t eos;
if (msg->findInt32("eos", &eos) && eos) {
TrackInfo *info = &mTracks.editItemAt(trackIndex);
info->mPacketSource->signalEOS(ERROR_END_OF_STREAM);
break;
}
sp<RefBase> obj;
CHECK(msg->findObject("access-unit", &obj));
sp<ABuffer> accessUnit = static_cast<ABuffer *>(obj.get());
uint64_t ntpTime;
CHECK(accessUnit->meta()->findInt64(
"ntp-time", (int64_t *)&ntpTime));
#if 0
#if 0
printf("access unit complete size=%d\tntp-time=0x%016llx\n",
accessUnit->size(), ntpTime);
#else
LOGI("access unit complete, size=%d, ntp-time=%llu",
accessUnit->size(), ntpTime);
hexdump(accessUnit->data(), accessUnit->size());
#endif
#endif
#if 0
CHECK_GE(accessUnit->size(), 5u);
CHECK(!memcmp("\x00\x00\x00\x01", accessUnit->data(), 4));
unsigned x = accessUnit->data()[4];
LOGI("access unit complete: nalType=0x%02x, nalRefIdc=0x%02x",
x & 0x1f, (x & 0x60) >> 5);
#endif
accessUnit->meta()->setInt64("ntp-time", ntpTime);
accessUnit->meta()->setInt64("timeUs", 0);
#if 0
int32_t damaged;
if (accessUnit->meta()->findInt32("damaged", &damaged)
&& damaged != 0) {
LOGI("ignoring damaged AU");
} else
#endif
{
TrackInfo *info = &mTracks.editItemAt(trackIndex);
info->mPacketSource->queueAccessUnit(accessUnit);
}
break;
}
default:
TRESPASS();
break;
}
}
示例8: CHECK
//.........这里部分代码省略.........
}
case MyHandler::kWhatSeekPaused:
{
sp<AnotherPacketSource> source = getSource(true /* audio */);
if (source != NULL) {
source->queueDiscontinuity(ATSParser::DISCONTINUITY_NONE,
/* extra */ NULL,
/* discard */ true);
}
source = getSource(false /* video */);
if (source != NULL) {
source->queueDiscontinuity(ATSParser::DISCONTINUITY_NONE,
/* extra */ NULL,
/* discard */ true);
};
status_t err = OK;
msg->findInt32("err", &err);
if (err == OK) {
int64_t timeUs;
CHECK(msg->findInt64("time", &timeUs));
mHandler->continueSeekAfterPause(timeUs);
} else {
finishSeek(err);
}
break;
}
case MyHandler::kWhatAccessUnit:
{
size_t trackIndex;
CHECK(msg->findSize("trackIndex", &trackIndex));
if (mTSParser == NULL) {
CHECK_LT(trackIndex, mTracks.size());
} else {
CHECK_EQ(trackIndex, 0u);
}
sp<ABuffer> accessUnit;
CHECK(msg->findBuffer("accessUnit", &accessUnit));
int32_t damaged;
if (accessUnit->meta()->findInt32("damaged", &damaged)
&& damaged) {
ALOGI("dropping damaged access unit.");
break;
}
if (mTSParser != NULL) {
size_t offset = 0;
status_t err = OK;
while (offset + 188 <= accessUnit->size()) {
err = mTSParser->feedTSPacket(
accessUnit->data() + offset, 188);
if (err != OK) {
break;
}
offset += 188;
}
if (offset < accessUnit->size()) {
err = ERROR_MALFORMED;