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