Home | History | Annotate | Download | only in inc
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /**
     18 *************************************************************************
     19 * @file   VideoEditorVideoDecoder_Internal.h
     20 * @brief  StageFright shell video decoder internal header file*
     21 *************************************************************************
     22 */
     23 
     24 #include "M4OSA_Types.h"
     25 #include "M4OSA_Debug.h"
     26 #include "M4OSA_Memory.h"
     27 #include "M4_Common.h"
     28 #include "M4OSA_CoreID.h"
     29 
     30 #include "M4DA_Types.h"
     31 #include "M4READER_Common.h"
     32 #include "M4VIFI_FiltersAPI.h"
     33 #include "M4TOOL_VersionInfo.h"
     34 #include "M4DECODER_Common.h"
     35 #include "M4OSA_Semaphore.h"
     36 #include "VideoEditorBuffer.h"
     37 #include "M4VD_Tools.h"
     38 #include "I420ColorConverter.h"
     39 
     40 #include <utils/RefBase.h>
     41 #include <android/rect.h>
     42 #include <OMX_Video.h>
     43 #include <media/stagefright/MediaErrors.h>
     44 #include <media/stagefright/OMXCodec.h>
     45 #include <media/stagefright/OMXClient.h>
     46 #include <media/stagefright/MediaSource.h>
     47 #include <media/stagefright/MediaBuffer.h>
     48 #include <media/stagefright/MediaBufferGroup.h>
     49 #include <media/stagefright/MediaDefs.h>
     50 
     51 #define VIDEOEDITOR_VIDEC_SHELL_VER_MAJOR     0
     52 #define VIDEOEDITOR_VIDEC_SHELL_VER_MINOR     0
     53 #define VIDEOEDITOR_VIDEC_SHELL_VER_REVISION  1
     54 
     55 /* ERRORS */
     56 #define M4ERR_SF_DECODER_RSRC_FAIL M4OSA_ERR_CREATE(M4_ERR, 0xFF, 0x0001)
     57 
     58 namespace android {
     59 
     60 typedef enum {
     61     VIDEOEDITOR_kMpeg4VideoDec,
     62     VIDEOEDITOR_kH263VideoDec,
     63     VIDEOEDITOR_kH264VideoDec
     64 } VIDEOEDITOR_CodecType;
     65 
     66 
     67 /*typedef struct{
     68     M4OSA_UInt32 stream_byte;
     69     M4OSA_UInt32 stream_index;
     70     M4OSA_MemAddr8 in;
     71 
     72 } VIDEOEDITOR_VIDEO_Bitstream_ctxt;*/
     73 
     74 typedef M4VS_Bitstream_ctxt VIDEOEDITOR_VIDEO_Bitstream_ctxt;
     75 
     76 typedef struct {
     77 
     78     /** Stagefrigth params */
     79     OMXClient               mClient; /**< OMX Client session instance. */
     80     sp<MediaSource>         mVideoDecoder; /**< Stagefright decoder instance */
     81     sp<MediaSource>         mReaderSource; /**< Reader access > */
     82 
     83     /* READER */
     84     M4READER_GlobalInterface *m_pReaderGlobal;
     85     M4READER_DataInterface  *m_pReader;
     86     M4_AccessUnit           *m_pNextAccessUnitToDecode;
     87 
     88     /* STREAM PARAMS */
     89     M4_VideoStreamHandler*  m_pVideoStreamhandler;
     90 
     91     /* User filter params. */
     92     M4VIFI_PlanConverterFunctionType *m_pFilter;
     93     M4OSA_Void              *m_pFilterUserData;
     94 
     95     M4_MediaTime            m_lastDecodedCTS;
     96     M4_MediaTime            m_lastRenderCts;
     97     M4OSA_Bool              mReachedEOS;
     98     VIDEOEDITOR_CodecType   mDecoderType;
     99     M4DECODER_VideoSize     m_VideoSize;
    100     M4DECODER_MPEG4_DecoderConfigInfo m_Dci; /**< Decoder Config info */
    101     VIDEOEDITOR_BUFFER_Pool *m_pDecBufferPool; /**< Decoded buffer pool */
    102     OMX_COLOR_FORMATTYPE    decOuputColorFormat;
    103 
    104     M4OSA_UInt32            mNbInputFrames;
    105     M4OSA_Double            mFirstInputCts;
    106     M4OSA_Double            mLastInputCts;
    107     M4OSA_UInt32            mNbRenderedFrames;
    108     M4OSA_Double            mFirstRenderedCts;
    109     M4OSA_Double            mLastRenderedCts;
    110     M4OSA_UInt32            mNbOutputFrames;
    111     M4OSA_Double            mFirstOutputCts;
    112     M4OSA_Double            mLastOutputCts;
    113     M4OSA_Int32             mGivenWidth, mGivenHeight; //Used in case of
    114                                                        //INFO_FORMAT_CHANGED
    115     ARect                   mCropRect;  // These are obtained from kKeyCropRect.
    116     I420ColorConverter*     mI420ColorConverter;
    117 
    118     // Time interval between two consequtive/neighboring video frames.
    119     M4_MediaTime            mFrameIntervalMs;
    120 
    121 } VideoEditorVideoDecoder_Context;
    122 
    123 } //namespace android
    124