summaryrefslogtreecommitdiffstats
path: root/cmds/stagefright
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/stagefright')
-rw-r--r--cmds/stagefright/SineSource.cpp4
-rw-r--r--cmds/stagefright/stagefright.cpp33
2 files changed, 21 insertions, 16 deletions
diff --git a/cmds/stagefright/SineSource.cpp b/cmds/stagefright/SineSource.cpp
index e5a6ccb..e272a65 100644
--- a/cmds/stagefright/SineSource.cpp
+++ b/cmds/stagefright/SineSource.cpp
@@ -86,8 +86,8 @@ status_t SineSource::read(
x += k;
}
- buffer->meta_data()->setInt32(kKeyTimeUnits, mPhase);
- buffer->meta_data()->setInt32(kKeyTimeScale, mSampleRate);
+ buffer->meta_data()->setInt64(
+ kKeyTime, ((int64_t)mPhase * 1000000) / mSampleRate);
mPhase += numFramesPerBuffer;
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index f8bb3c8..3b7cece 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -52,12 +52,8 @@ static int64_t getNowUs() {
static void playSource(OMXClient *client, const sp<MediaSource> &source) {
sp<MetaData> meta = source->getFormat();
- int32_t durationUnits;
- int32_t timeScale;
- CHECK(meta->findInt32(kKeyDuration, &durationUnits));
- CHECK(meta->findInt32(kKeyTimeScale, &timeScale));
-
- int64_t durationUs = ((int64_t)durationUnits * 1000000) / timeScale;
+ int64_t durationUs;
+ CHECK(meta->findInt64(kKeyDuration, &durationUs));
sp<OMXCodec> decoder = OMXCodec::Create(
client->interface(), meta, false /* createEncoder */, source);
@@ -78,20 +74,24 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
options.clearSeekTo();
bool shouldSeek = false;
- if (err != OK) {
+ if (err == INFO_FORMAT_CHANGED) {
+ CHECK_EQ(buffer, NULL);
+
+ printf("format changed.\n");
+ continue;
+ } else if (err != OK) {
printf("reached EOF.\n");
shouldSeek = true;
} else {
- int32_t timestampUnits;
- CHECK(buffer->meta_data()->findInt32(kKeyTimeUnits, &timestampUnits));
-
- int64_t timestampUs = ((int64_t)timestampUnits * 1000000) / timeScale;
+ int64_t timestampUs;
+ CHECK(buffer->meta_data()->findInt64(kKeyTime, &timestampUs));
bool failed = false;
if (seekTimeUs >= 0) {
int64_t diff = timestampUs - seekTimeUs;
+
if (diff < 0) {
diff = -diff;
}
@@ -157,6 +157,11 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
if (err != OK) {
CHECK_EQ(buffer, NULL);
+ if (err == INFO_FORMAT_CHANGED) {
+ printf("format changed.\n");
+ continue;
+ }
+
break;
}
@@ -283,7 +288,7 @@ int main(int argc, char **argv) {
CHECK(service.get() != NULL);
- sp<IOMX> omx = service->createOMX();
+ sp<IOMX> omx = service->getOMX();
CHECK(omx.get() != NULL);
const char *kMimeTypes[] = {
@@ -329,11 +334,11 @@ int main(int argc, char **argv) {
CHECK(service.get() != NULL);
- sp<IOMX> omx = service->createOMX();
+ sp<IOMX> omx = service->getOMX();
CHECK(omx.get() != NULL);
List<String8> list;
- omx->list_nodes(&list);
+ omx->listNodes(&list);
for (List<String8>::iterator it = list.begin();
it != list.end(); ++it) {