2 * Copyright 2012 Michael Chen <omxcodec@gmail.com>
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef SOFT_FFMPEGVIDEO_H_
19 #define SOFT_FFMPEGVIDEO_H_
21 #include "SimpleSoftOMXComponent.h"
29 #include <limits.h> /* INT_MAX */
32 #include "libavutil/avstring.h"
33 #include "libavutil/colorspace.h"
34 #include "libavutil/mathematics.h"
35 #include "libavutil/pixdesc.h"
36 #include "libavutil/imgutils.h"
37 #include "libavutil/dict.h"
38 #include "libavutil/parseutils.h"
39 #include "libavutil/samplefmt.h"
40 #include "libavutil/avassert.h"
41 #include "libavutil/intreadwrite.h"
42 #include "libavformat/avformat.h"
43 #include "libavdevice/avdevice.h"
44 #include "libswscale/swscale.h"
45 #include "libavutil/opt.h"
46 #include "libavutil/internal.h"
47 #include "libavcodec/avfft.h"
48 #include "libswresample/swresample.h"
56 struct SoftFFmpegVideo : public SimpleSoftOMXComponent {
57 SoftFFmpegVideo(const char *name,
58 const OMX_CALLBACKTYPE *callbacks,
60 OMX_COMPONENTTYPE **component);
63 virtual ~SoftFFmpegVideo();
65 virtual OMX_ERRORTYPE internalGetParameter(
66 OMX_INDEXTYPE index, OMX_PTR params);
68 virtual OMX_ERRORTYPE internalSetParameter(
69 OMX_INDEXTYPE index, const OMX_PTR params);
71 virtual void onQueueFilled(OMX_U32 portIndex);
72 virtual void onPortFlushCompleted(OMX_U32 portIndex);
73 virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
78 kNumOutputBuffers = 2,
101 AVCodecContext *mCtx;
102 struct SwsContext *mImgConvertCtx;
104 bool mExtradataReady;
105 bool mIgnoreExtradata;
106 bool mSignalledError;
108 int32_t mWidth, mHeight, mStride;
114 } mOutputPortSettingsChange;
116 void setAVCtxToDefault(AVCodecContext *avctx, const AVCodec *codec);
117 void preProcessVideoFrame(AVPicture *picture, void **bufp);
120 status_t initDecoder();
121 void deInitDecoder();
123 void updatePortDefinitions();
125 DISALLOW_EVIL_CONSTRUCTORS(SoftFFmpegVideo);
128 } // namespace android
130 #endif // SOFT_FFMPEGVIDEO_H_