From 840667883fd09d44015716d79bc3ac4d60edc0f0 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 16 Aug 2011 09:34:26 -0700 Subject: experimental support for fragmented mp4 playback in nuplayer cherry picked from change 170999 Change-Id: I407775f0290154ad4961134839a15c9f296424c0 --- media/libstagefright/foundation/AMessage.cpp | 16 ++++++++++++++-- media/libstagefright/foundation/hexdump.cpp | 21 +++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'media/libstagefright/foundation') diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp index 8b01ac6..dc42f91 100644 --- a/media/libstagefright/foundation/AMessage.cpp +++ b/media/libstagefright/foundation/AMessage.cpp @@ -25,6 +25,7 @@ #include "AString.h" #include +#include namespace android { @@ -399,9 +400,20 @@ AString AMessage::debugString(int32_t indent) const { "RefBase *%s = %p", item.mName, item.u.refValue); break; case kTypeBuffer: - tmp = StringPrintf( - "ABuffer *%s = %p", item.mName, item.u.refValue); + { + sp buffer = static_cast(item.u.refValue); + + if (buffer != NULL && buffer->size() <= 64) { + tmp = StringPrintf("Buffer %s = {\n", item.mName); + hexdump(buffer->data(), buffer->size(), indent + 4, &tmp); + appendIndent(&tmp, indent + 2); + tmp.append("}"); + } else { + tmp = StringPrintf( + "Buffer *%s = %p", item.mName, buffer.get()); + } break; + } case kTypeMessage: tmp = StringPrintf( "AMessage %s = %s", diff --git a/media/libstagefright/foundation/hexdump.cpp b/media/libstagefright/foundation/hexdump.cpp index 16c1ca5..a44d832 100644 --- a/media/libstagefright/foundation/hexdump.cpp +++ b/media/libstagefright/foundation/hexdump.cpp @@ -29,13 +29,25 @@ namespace android { -void hexdump(const void *_data, size_t size) { +static void appendIndent(AString *s, int32_t indent) { + static const char kWhitespace[] = + " " + " "; + + CHECK_LT((size_t)indent, sizeof(kWhitespace)); + + s->append(kWhitespace, indent); +} + +void hexdump(const void *_data, size_t size, size_t indent, AString *appendTo) { const uint8_t *data = (const uint8_t *)_data; size_t offset = 0; while (offset < size) { AString line; + appendIndent(&line, indent); + char tmp[32]; sprintf(tmp, "%08lx: ", (unsigned long)offset); @@ -67,7 +79,12 @@ void hexdump(const void *_data, size_t size) { } } - ALOGI("%s", line.c_str()); + if (appendTo != NULL) { + appendTo->append(line); + appendTo->append("\n"); + } else { + ALOGI("%s", line.c_str()); + } offset += 16; } -- cgit v1.1