Loading media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp +54 −0 Original line number Diff line number Diff line Loading @@ -460,6 +460,47 @@ void SoftMPEG2::onReset() { resetPlugin(); } bool SoftMPEG2::getSeqInfo() { IV_API_CALL_STATUS_T status; impeg2d_ctl_get_seq_info_ip_t s_ctl_get_seq_info_ip; impeg2d_ctl_get_seq_info_op_t s_ctl_get_seq_info_op; s_ctl_get_seq_info_ip.e_cmd = IVD_CMD_VIDEO_CTL; s_ctl_get_seq_info_ip.e_sub_cmd = (IVD_CONTROL_API_COMMAND_TYPE_T)IMPEG2D_CMD_CTL_GET_SEQ_INFO; s_ctl_get_seq_info_ip.u4_size = sizeof(impeg2d_ctl_get_seq_info_ip_t); s_ctl_get_seq_info_op.u4_size = sizeof(impeg2d_ctl_get_seq_info_op_t); status = ivdec_api_function( (iv_obj_t *)mCodecCtx, (void *)&s_ctl_get_seq_info_ip, (void *)&s_ctl_get_seq_info_op); if (status != IV_SUCCESS) { ALOGW("Error in getting Sequence info: 0x%x", s_ctl_get_seq_info_op.u4_error_code); return false; } int32_t primaries = s_ctl_get_seq_info_op.u1_colour_primaries; int32_t transfer = s_ctl_get_seq_info_op.u1_transfer_characteristics; int32_t coeffs = s_ctl_get_seq_info_op.u1_matrix_coefficients; bool fullRange = false; // mpeg2 video has limited range. ColorAspects colorAspects; ColorUtils::convertIsoColorAspectsToCodecAspects( primaries, transfer, coeffs, fullRange, colorAspects); // Update color aspects if necessary. if (colorAspectsDiffer(colorAspects, mBitstreamColorAspects)) { mBitstreamColorAspects = colorAspects; status_t err = handleColorAspectsChange(); CHECK(err == OK); } return true; } OMX_ERRORTYPE SoftMPEG2::internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params) { const uint32_t oldWidth = mWidth; const uint32_t oldHeight = mHeight; Loading Loading @@ -650,6 +691,8 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool unsupportedDimensions = (IMPEG2D_UNSUPPORTED_DIMENSIONS == s_dec_op.u4_error_code); bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF)); getSeqInfo(); GETTIME(&mTimeEnd, NULL); /* Compute time taken for decode() */ TIME_DIFF(mTimeStart, mTimeEnd, timeTaken); Loading Loading @@ -705,6 +748,8 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { continue; } // Combine the resolution change and coloraspects change in one PortSettingChange event // if necessary. if ((0 < s_dec_op.u4_pic_wd) && (0 < s_dec_op.u4_pic_ht)) { uint32_t width = s_dec_op.u4_pic_wd; uint32_t height = s_dec_op.u4_pic_ht; Loading @@ -715,6 +760,11 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { resetDecoder(); return; } } else if (mUpdateColorAspects) { notify(OMX_EventPortSettingsChanged, kOutputPortIndex, kDescribeColorAspectsIndex, NULL); mUpdateColorAspects = false; return; } if (s_dec_op.u4_output_present) { Loading Loading @@ -783,6 +833,10 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { } } int SoftMPEG2::getColorAspectPreference() { return kPreferBitstream; } } // namespace android android::SoftOMXComponent *createSoftOMXComponent( Loading media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h +3 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ protected: virtual void onQueueFilled(OMX_U32 portIndex); virtual void onPortFlushCompleted(OMX_U32 portIndex); virtual void onReset(); virtual int getColorAspectPreference(); virtual OMX_ERRORTYPE internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params); private: // Number of input and output buffers Loading Loading @@ -125,6 +126,8 @@ private: OMX_BUFFERHEADERTYPE *outHeader, size_t timeStampIx); bool getSeqInfo(); DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG2); }; Loading Loading
media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp +54 −0 Original line number Diff line number Diff line Loading @@ -460,6 +460,47 @@ void SoftMPEG2::onReset() { resetPlugin(); } bool SoftMPEG2::getSeqInfo() { IV_API_CALL_STATUS_T status; impeg2d_ctl_get_seq_info_ip_t s_ctl_get_seq_info_ip; impeg2d_ctl_get_seq_info_op_t s_ctl_get_seq_info_op; s_ctl_get_seq_info_ip.e_cmd = IVD_CMD_VIDEO_CTL; s_ctl_get_seq_info_ip.e_sub_cmd = (IVD_CONTROL_API_COMMAND_TYPE_T)IMPEG2D_CMD_CTL_GET_SEQ_INFO; s_ctl_get_seq_info_ip.u4_size = sizeof(impeg2d_ctl_get_seq_info_ip_t); s_ctl_get_seq_info_op.u4_size = sizeof(impeg2d_ctl_get_seq_info_op_t); status = ivdec_api_function( (iv_obj_t *)mCodecCtx, (void *)&s_ctl_get_seq_info_ip, (void *)&s_ctl_get_seq_info_op); if (status != IV_SUCCESS) { ALOGW("Error in getting Sequence info: 0x%x", s_ctl_get_seq_info_op.u4_error_code); return false; } int32_t primaries = s_ctl_get_seq_info_op.u1_colour_primaries; int32_t transfer = s_ctl_get_seq_info_op.u1_transfer_characteristics; int32_t coeffs = s_ctl_get_seq_info_op.u1_matrix_coefficients; bool fullRange = false; // mpeg2 video has limited range. ColorAspects colorAspects; ColorUtils::convertIsoColorAspectsToCodecAspects( primaries, transfer, coeffs, fullRange, colorAspects); // Update color aspects if necessary. if (colorAspectsDiffer(colorAspects, mBitstreamColorAspects)) { mBitstreamColorAspects = colorAspects; status_t err = handleColorAspectsChange(); CHECK(err == OK); } return true; } OMX_ERRORTYPE SoftMPEG2::internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params) { const uint32_t oldWidth = mWidth; const uint32_t oldHeight = mHeight; Loading Loading @@ -650,6 +691,8 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool unsupportedDimensions = (IMPEG2D_UNSUPPORTED_DIMENSIONS == s_dec_op.u4_error_code); bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF)); getSeqInfo(); GETTIME(&mTimeEnd, NULL); /* Compute time taken for decode() */ TIME_DIFF(mTimeStart, mTimeEnd, timeTaken); Loading Loading @@ -705,6 +748,8 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { continue; } // Combine the resolution change and coloraspects change in one PortSettingChange event // if necessary. if ((0 < s_dec_op.u4_pic_wd) && (0 < s_dec_op.u4_pic_ht)) { uint32_t width = s_dec_op.u4_pic_wd; uint32_t height = s_dec_op.u4_pic_ht; Loading @@ -715,6 +760,11 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { resetDecoder(); return; } } else if (mUpdateColorAspects) { notify(OMX_EventPortSettingsChanged, kOutputPortIndex, kDescribeColorAspectsIndex, NULL); mUpdateColorAspects = false; return; } if (s_dec_op.u4_output_present) { Loading Loading @@ -783,6 +833,10 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { } } int SoftMPEG2::getColorAspectPreference() { return kPreferBitstream; } } // namespace android android::SoftOMXComponent *createSoftOMXComponent( Loading
media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h +3 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ protected: virtual void onQueueFilled(OMX_U32 portIndex); virtual void onPortFlushCompleted(OMX_U32 portIndex); virtual void onReset(); virtual int getColorAspectPreference(); virtual OMX_ERRORTYPE internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params); private: // Number of input and output buffers Loading Loading @@ -125,6 +126,8 @@ private: OMX_BUFFERHEADERTYPE *outHeader, size_t timeStampIx); bool getSeqInfo(); DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG2); }; Loading