Loading media/libmedia/MediaCodecInfo.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -105,11 +105,17 @@ void MediaCodecInfo::CapabilitiesBuilder::addProfileLevel(uint32_t profile, uint ProfileLevel profileLevel; profileLevel.mProfile = profile; profileLevel.mLevel = level; if (mProfileLevelsSorted.indexOf(profileLevel) < 0) { mProfileLevels.push_back(profileLevel); mProfileLevelsSorted.add(profileLevel); } } void MediaCodecInfo::CapabilitiesBuilder::addColorFormat(uint32_t format) { if (mColorFormatsSorted.indexOf(format) < 0) { mColorFormats.push(format); mColorFormatsSorted.add(format); } } void MediaCodecInfo::CapabilitiesBuilder::addFlags(uint32_t flags) { Loading media/libmedia/include/media/IOMX.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <media/openmax/OMX_Core.h> #include <media/openmax/OMX_Video.h> #include <media/openmax/OMX_VideoExt.h> namespace android { Loading media/libmedia/include/media/MediaCodecInfo.h +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ struct MediaCodecInfo : public RefBase { struct ProfileLevel { uint32_t mProfile; uint32_t mLevel; bool operator <(const ProfileLevel &o) const { return mProfile < o.mProfile || (mProfile == o.mProfile && mLevel < o.mLevel); } }; struct Capabilities : public RefBase { Loading @@ -61,7 +64,9 @@ struct MediaCodecInfo : public RefBase { protected: Vector<ProfileLevel> mProfileLevels; SortedVector<ProfileLevel> mProfileLevelsSorted; Vector<uint32_t> mColorFormats; SortedVector<uint32_t> mColorFormatsSorted; uint32_t mFlags; sp<AMessage> mDetails; Loading media/libstagefright/ACodec.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -4173,11 +4173,12 @@ status_t ACodec::setupH263EncoderParameters(const sp<AMessage> &msg) { // static int /* OMX_VIDEO_AVCLEVELTYPE */ ACodec::getAVCLevelFor( int width, int height, int rate, int bitrate, OMX_VIDEO_AVCPROFILETYPE profile) { OMX_VIDEO_AVCPROFILEEXTTYPE profile) { // convert bitrate to main/baseline profile kbps equivalent switch (profile) { switch ((uint32_t)profile) { case OMX_VIDEO_AVCProfileHigh10: bitrate = divUp(bitrate, 3000); break; case OMX_VIDEO_AVCProfileConstrainedHigh: case OMX_VIDEO_AVCProfileHigh: bitrate = divUp(bitrate, 1250); break; default: Loading Loading @@ -8262,6 +8263,17 @@ status_t ACodec::queryCapabilities( } builder->addProfileLevel(param.eProfile, param.eLevel); // AVC components may not list the constrained profiles explicitly, but // decoders that support a profile also support its constrained version. // Encoders must explicitly support constrained profiles. if (!isEncoder && mime.equalsIgnoreCase(MEDIA_MIMETYPE_VIDEO_AVC)) { if (param.eProfile == OMX_VIDEO_AVCProfileHigh) { builder->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedHigh, param.eLevel); } else if (param.eProfile == OMX_VIDEO_AVCProfileBaseline) { builder->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedBaseline, param.eLevel); } } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", name.c_str(), index, Loading @@ -8275,7 +8287,6 @@ status_t ACodec::queryCapabilities( OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; InitOMXParams(&portFormat); portFormat.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; Vector<uint32_t> supportedColors; // shadow copy to check for duplicates for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { portFormat.nIndex = index; status_t err = omxNode->getParameter( Loading @@ -8289,19 +8300,8 @@ status_t ACodec::queryCapabilities( if (IsFlexibleColorFormat( omxNode, portFormat.eColorFormat, false /* usingNativeWindow */, &flexibleEquivalent)) { bool marked = false; for (size_t i = 0; i < supportedColors.size(); ++i) { if (supportedColors[i] == flexibleEquivalent) { marked = true; break; } } if (!marked) { supportedColors.push(flexibleEquivalent); builder->addColorFormat(flexibleEquivalent); } } supportedColors.push(portFormat.eColorFormat); builder->addColorFormat(portFormat.eColorFormat); if (index == kMaxIndicesToCheck) { Loading media/libstagefright/include/media/stagefright/ACodec.h +2 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,8 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase { // some OMX components as auto level, and by others as invalid level. static int /* OMX_VIDEO_AVCLEVELTYPE */ getAVCLevelFor( int width, int height, int rate, int bitrate, OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline); OMX_VIDEO_AVCPROFILEEXTTYPE profile = (OMX_VIDEO_AVCPROFILEEXTTYPE)OMX_VIDEO_AVCProfileBaseline); // Quirk still supported, even though deprecated enum Quirks { Loading Loading
media/libmedia/MediaCodecInfo.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -105,11 +105,17 @@ void MediaCodecInfo::CapabilitiesBuilder::addProfileLevel(uint32_t profile, uint ProfileLevel profileLevel; profileLevel.mProfile = profile; profileLevel.mLevel = level; if (mProfileLevelsSorted.indexOf(profileLevel) < 0) { mProfileLevels.push_back(profileLevel); mProfileLevelsSorted.add(profileLevel); } } void MediaCodecInfo::CapabilitiesBuilder::addColorFormat(uint32_t format) { if (mColorFormatsSorted.indexOf(format) < 0) { mColorFormats.push(format); mColorFormatsSorted.add(format); } } void MediaCodecInfo::CapabilitiesBuilder::addFlags(uint32_t flags) { Loading
media/libmedia/include/media/IOMX.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <media/openmax/OMX_Core.h> #include <media/openmax/OMX_Video.h> #include <media/openmax/OMX_VideoExt.h> namespace android { Loading
media/libmedia/include/media/MediaCodecInfo.h +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ struct MediaCodecInfo : public RefBase { struct ProfileLevel { uint32_t mProfile; uint32_t mLevel; bool operator <(const ProfileLevel &o) const { return mProfile < o.mProfile || (mProfile == o.mProfile && mLevel < o.mLevel); } }; struct Capabilities : public RefBase { Loading @@ -61,7 +64,9 @@ struct MediaCodecInfo : public RefBase { protected: Vector<ProfileLevel> mProfileLevels; SortedVector<ProfileLevel> mProfileLevelsSorted; Vector<uint32_t> mColorFormats; SortedVector<uint32_t> mColorFormatsSorted; uint32_t mFlags; sp<AMessage> mDetails; Loading
media/libstagefright/ACodec.cpp +15 −15 Original line number Diff line number Diff line Loading @@ -4173,11 +4173,12 @@ status_t ACodec::setupH263EncoderParameters(const sp<AMessage> &msg) { // static int /* OMX_VIDEO_AVCLEVELTYPE */ ACodec::getAVCLevelFor( int width, int height, int rate, int bitrate, OMX_VIDEO_AVCPROFILETYPE profile) { OMX_VIDEO_AVCPROFILEEXTTYPE profile) { // convert bitrate to main/baseline profile kbps equivalent switch (profile) { switch ((uint32_t)profile) { case OMX_VIDEO_AVCProfileHigh10: bitrate = divUp(bitrate, 3000); break; case OMX_VIDEO_AVCProfileConstrainedHigh: case OMX_VIDEO_AVCProfileHigh: bitrate = divUp(bitrate, 1250); break; default: Loading Loading @@ -8262,6 +8263,17 @@ status_t ACodec::queryCapabilities( } builder->addProfileLevel(param.eProfile, param.eLevel); // AVC components may not list the constrained profiles explicitly, but // decoders that support a profile also support its constrained version. // Encoders must explicitly support constrained profiles. if (!isEncoder && mime.equalsIgnoreCase(MEDIA_MIMETYPE_VIDEO_AVC)) { if (param.eProfile == OMX_VIDEO_AVCProfileHigh) { builder->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedHigh, param.eLevel); } else if (param.eProfile == OMX_VIDEO_AVCProfileBaseline) { builder->addProfileLevel(OMX_VIDEO_AVCProfileConstrainedBaseline, param.eLevel); } } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", name.c_str(), index, Loading @@ -8275,7 +8287,6 @@ status_t ACodec::queryCapabilities( OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; InitOMXParams(&portFormat); portFormat.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; Vector<uint32_t> supportedColors; // shadow copy to check for duplicates for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { portFormat.nIndex = index; status_t err = omxNode->getParameter( Loading @@ -8289,19 +8300,8 @@ status_t ACodec::queryCapabilities( if (IsFlexibleColorFormat( omxNode, portFormat.eColorFormat, false /* usingNativeWindow */, &flexibleEquivalent)) { bool marked = false; for (size_t i = 0; i < supportedColors.size(); ++i) { if (supportedColors[i] == flexibleEquivalent) { marked = true; break; } } if (!marked) { supportedColors.push(flexibleEquivalent); builder->addColorFormat(flexibleEquivalent); } } supportedColors.push(portFormat.eColorFormat); builder->addColorFormat(portFormat.eColorFormat); if (index == kMaxIndicesToCheck) { Loading
media/libstagefright/include/media/stagefright/ACodec.h +2 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,8 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase { // some OMX components as auto level, and by others as invalid level. static int /* OMX_VIDEO_AVCLEVELTYPE */ getAVCLevelFor( int width, int height, int rate, int bitrate, OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline); OMX_VIDEO_AVCPROFILEEXTTYPE profile = (OMX_VIDEO_AVCPROFILEEXTTYPE)OMX_VIDEO_AVCProfileBaseline); // Quirk still supported, even though deprecated enum Quirks { Loading