VideoEditorVideoDecoder_internal.h revision b5c7784c96a606890eb8a8b560153ef4a5d1a0d9
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
39#include <utils/RefBase.h>
40#include <OMX_Video.h>
41#include <media/stagefright/MediaErrors.h>
42#include <media/stagefright/OMXCodec.h>
43#include <media/stagefright/OMXClient.h>
44#include <media/stagefright/MediaSource.h>
45#include <media/stagefright/MediaBuffer.h>
46#include <media/stagefright/MediaBufferGroup.h>
47#include <media/stagefright/MediaDefs.h>
48
49#define VIDEOEDITOR_VIDEC_SHELL_VER_MAJOR     0
50#define VIDEOEDITOR_VIDEC_SHELL_VER_MINOR     0
51#define VIDEOEDITOR_VIDEC_SHELL_VER_REVISION  1
52
53/* ERRORS */
54#define M4ERR_SF_DECODER_RSRC_FAIL M4OSA_ERR_CREATE(M4_ERR, 0xFF, 0x0001)
55
56namespace android {
57
58typedef enum {
59    VIDEOEDITOR_kMpeg4VideoDec,
60    VIDEOEDITOR_kH263VideoDec,
61    VIDEOEDITOR_kH264VideoDec
62} VIDEOEDITOR_CodecType;
63
64
65/*typedef struct{
66    M4OSA_UInt32 stream_byte;
67    M4OSA_UInt32 stream_index;
68    M4OSA_MemAddr8 in;
69
70} VIDEOEDITOR_VIDEO_Bitstream_ctxt;*/
71
72typedef M4VS_Bitstream_ctxt VIDEOEDITOR_VIDEO_Bitstream_ctxt;
73
74typedef struct {
75
76    /** Stagefrigth params */
77    OMXClient               mClient; /**< OMX Client session instance. */
78    sp<MediaSource>         mVideoDecoder; /**< Stagefright decoder instance */
79    sp<MediaSource>         mReaderSource; /**< Reader access > */
80
81    /* READER */
82    M4READER_DataInterface  *m_pReader;
83    M4_AccessUnit           *m_pNextAccessUnitToDecode;
84
85    /* STREAM PARAMS */
86    M4_VideoStreamHandler*  m_pVideoStreamhandler;
87
88    /* User filter params. */
89    M4VIFI_PlanConverterFunctionType *m_pFilter;
90    M4OSA_Void              *m_pFilterUserData;
91
92    M4_MediaTime            m_lastDecodedCTS;
93    M4_MediaTime            m_lastRenderCts;
94    M4OSA_Bool              mReachedEOS;
95    VIDEOEDITOR_CodecType   mDecoderType;
96    M4DECODER_VideoSize     m_VideoSize;
97    M4DECODER_MPEG4_DecoderConfigInfo m_Dci; /**< Decoder Config info */
98    VIDEOEDITOR_BUFFER_Pool *m_pDecBufferPool; /**< Decoded buffer pool */
99    OMX_COLOR_FORMATTYPE    decOuputColorFormat;
100
101    M4OSA_UInt32            mNbInputFrames;
102    M4OSA_Double            mFirstInputCts;
103    M4OSA_Double            mLastInputCts;
104    M4OSA_UInt32            mNbRenderedFrames;
105    M4OSA_Double            mFirstRenderedCts;
106    M4OSA_Double            mLastRenderedCts;
107    M4OSA_UInt32            mNbOutputFrames;
108    M4OSA_Double            mFirstOutputCts;
109    M4OSA_Double            mLastOutputCts;
110    M4OSA_Int32             mGivenWidth, mGivenHeight; //Used in case of
111                                                       //INFO_FORMAT_CHANGED
112
113} VideoEditorVideoDecoder_Context;
114
115} //namespace android
116