Loading include/media/stagefright/OMXCodec.h +5 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ struct OMXCodec : public MediaSource, public MediaBufferObserver { enum CreationFlags { kPreferSoftwareCodecs = 1, kIgnoreCodecSpecificData = 2 kIgnoreCodecSpecificData = 2, // The client wants to access the output buffer's video // data for example for thumbnail extraction. kClientNeedsFramebuffer = 4, }; static sp<MediaSource> Create( const sp<IOMX> &omx, Loading media/libstagefright/MPEG2TSWriter.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,14 @@ void MPEG2TSWriter::writeAccessUnit( size_t PES_packet_length = accessUnit->size() + 8; if (PES_packet_length >= 65536) { // This really should only happen for video. CHECK_EQ(stream_id, 0xe0u); // It's valid to set this to 0 for video according to the specs. PES_packet_length = 0; } uint8_t *ptr = buffer->data(); *ptr++ = 0x47; *ptr++ = 0x40 | (PID >> 8); Loading media/libstagefright/OMXCodec.cpp +45 −1 Original line number Diff line number Diff line Loading @@ -493,12 +493,29 @@ sp<MediaSource> OMXCodec::Create( LOGV("Attempting to allocate OMX node '%s'", componentName); uint32_t quirks = getComponentQuirks(componentName, createEncoder); if (!createEncoder && (quirks & kOutputBuffersAreUnreadable) && (flags & kClientNeedsFramebuffer)) { if (strncmp(componentName, "OMX.SEC.", 8)) { // For OMX.SEC.* decoders we can enable a special mode that // gives the client access to the framebuffer contents. LOGW("Component '%s' does not give the client access to " "the framebuffer contents. Skipping.", componentName); continue; } } status_t err = omx->allocateNode(componentName, observer, &node); if (err == OK) { LOGV("Successfully allocated OMX node '%s'", componentName); sp<OMXCodec> codec = new OMXCodec( omx, node, getComponentQuirks(componentName, createEncoder), omx, node, quirks, createEncoder, mime, componentName, source); Loading Loading @@ -681,6 +698,33 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta, uint32_t flags) { initOutputFormat(meta); if ((flags & kClientNeedsFramebuffer) && !strncmp(mComponentName, "OMX.SEC.", 8)) { OMX_INDEXTYPE index; status_t err = mOMX->getExtensionIndex( mNode, "OMX.SEC.index.ThumbnailMode", &index); if (err != OK) { return err; } OMX_BOOL enable = OMX_TRUE; err = mOMX->setConfig(mNode, index, &enable, sizeof(enable)); if (err != OK) { CODEC_LOGE("setConfig('OMX.SEC.index.ThumbnailMode') " "returned error 0x%08x", err); return err; } mQuirks &= ~kOutputBuffersAreUnreadable; } return OK; } Loading media/libstagefright/StagefrightMetadataRetriever.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags( sp<MediaSource> decoder = OMXCodec::Create( client->interface(), source->getFormat(), false, source, NULL, flags); NULL, flags | OMXCodec::kClientNeedsFramebuffer); if (decoder.get() == NULL) { LOGV("unable to instantiate video decoder."); Loading media/libstagefright/foundation/ALooperRoster.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ void ALooperRoster::unregisterHandler(ALooper::handler_id handlerID) { Mutex::Autolock autoLock(mLock); ssize_t index = mHandlers.indexOfKey(handlerID); CHECK_GE(index, 0); if (index < 0) { return; } const HandlerInfo &info = mHandlers.valueAt(index); Loading Loading @@ -84,7 +87,8 @@ void ALooperRoster::postMessage( if (looper == NULL) { LOGW("failed to post message. " "Target handler still registered, but object gone."); "Target handler %d still registered, but object gone.", msg->target()); mHandlers.removeItemsAt(index); return; Loading @@ -111,7 +115,8 @@ void ALooperRoster::deliverMessage(const sp<AMessage> &msg) { if (handler == NULL) { LOGW("failed to deliver message. " "Target handler registered, but object gone."); "Target handler %d registered, but object gone.", msg->target()); mHandlers.removeItemsAt(index); return; Loading Loading
include/media/stagefright/OMXCodec.h +5 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ struct OMXCodec : public MediaSource, public MediaBufferObserver { enum CreationFlags { kPreferSoftwareCodecs = 1, kIgnoreCodecSpecificData = 2 kIgnoreCodecSpecificData = 2, // The client wants to access the output buffer's video // data for example for thumbnail extraction. kClientNeedsFramebuffer = 4, }; static sp<MediaSource> Create( const sp<IOMX> &omx, Loading
media/libstagefright/MPEG2TSWriter.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -725,6 +725,14 @@ void MPEG2TSWriter::writeAccessUnit( size_t PES_packet_length = accessUnit->size() + 8; if (PES_packet_length >= 65536) { // This really should only happen for video. CHECK_EQ(stream_id, 0xe0u); // It's valid to set this to 0 for video according to the specs. PES_packet_length = 0; } uint8_t *ptr = buffer->data(); *ptr++ = 0x47; *ptr++ = 0x40 | (PID >> 8); Loading
media/libstagefright/OMXCodec.cpp +45 −1 Original line number Diff line number Diff line Loading @@ -493,12 +493,29 @@ sp<MediaSource> OMXCodec::Create( LOGV("Attempting to allocate OMX node '%s'", componentName); uint32_t quirks = getComponentQuirks(componentName, createEncoder); if (!createEncoder && (quirks & kOutputBuffersAreUnreadable) && (flags & kClientNeedsFramebuffer)) { if (strncmp(componentName, "OMX.SEC.", 8)) { // For OMX.SEC.* decoders we can enable a special mode that // gives the client access to the framebuffer contents. LOGW("Component '%s' does not give the client access to " "the framebuffer contents. Skipping.", componentName); continue; } } status_t err = omx->allocateNode(componentName, observer, &node); if (err == OK) { LOGV("Successfully allocated OMX node '%s'", componentName); sp<OMXCodec> codec = new OMXCodec( omx, node, getComponentQuirks(componentName, createEncoder), omx, node, quirks, createEncoder, mime, componentName, source); Loading Loading @@ -681,6 +698,33 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta, uint32_t flags) { initOutputFormat(meta); if ((flags & kClientNeedsFramebuffer) && !strncmp(mComponentName, "OMX.SEC.", 8)) { OMX_INDEXTYPE index; status_t err = mOMX->getExtensionIndex( mNode, "OMX.SEC.index.ThumbnailMode", &index); if (err != OK) { return err; } OMX_BOOL enable = OMX_TRUE; err = mOMX->setConfig(mNode, index, &enable, sizeof(enable)); if (err != OK) { CODEC_LOGE("setConfig('OMX.SEC.index.ThumbnailMode') " "returned error 0x%08x", err); return err; } mQuirks &= ~kOutputBuffersAreUnreadable; } return OK; } Loading
media/libstagefright/StagefrightMetadataRetriever.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags( sp<MediaSource> decoder = OMXCodec::Create( client->interface(), source->getFormat(), false, source, NULL, flags); NULL, flags | OMXCodec::kClientNeedsFramebuffer); if (decoder.get() == NULL) { LOGV("unable to instantiate video decoder."); Loading
media/libstagefright/foundation/ALooperRoster.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ void ALooperRoster::unregisterHandler(ALooper::handler_id handlerID) { Mutex::Autolock autoLock(mLock); ssize_t index = mHandlers.indexOfKey(handlerID); CHECK_GE(index, 0); if (index < 0) { return; } const HandlerInfo &info = mHandlers.valueAt(index); Loading Loading @@ -84,7 +87,8 @@ void ALooperRoster::postMessage( if (looper == NULL) { LOGW("failed to post message. " "Target handler still registered, but object gone."); "Target handler %d still registered, but object gone.", msg->target()); mHandlers.removeItemsAt(index); return; Loading @@ -111,7 +115,8 @@ void ALooperRoster::deliverMessage(const sp<AMessage> &msg) { if (handler == NULL) { LOGW("failed to deliver message. " "Target handler registered, but object gone."); "Target handler %d registered, but object gone.", msg->target()); mHandlers.removeItemsAt(index); return; Loading