Home | History | Annotate | Download | only in videodecoder
      1 /*
      2 * Copyright (c) 2009-2011 Intel Corporation.  All rights reserved.
      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 #ifndef VIDEO_DECODER_MPEG4_H_
     18 #define VIDEO_DECODER_MPEG4_H_
     19 
     20 #include "VideoDecoderBase.h"
     21 
     22 
     23 class VideoDecoderMPEG4 : public VideoDecoderBase {
     24 public:
     25     VideoDecoderMPEG4(const char *mimeType);
     26     virtual ~VideoDecoderMPEG4();
     27 
     28     virtual Decode_Status start(VideoConfigBuffer *buffer);
     29     virtual void stop(void);
     30     virtual void flush(void);
     31     virtual Decode_Status decode(VideoDecodeBuffer *buffer);
     32 
     33 protected:
     34     virtual Decode_Status checkHardwareCapability();
     35 
     36 private:
     37     Decode_Status decodeFrame(VideoDecodeBuffer *buffer, vbp_data_mp42 *data);
     38     Decode_Status beginDecodingFrame(vbp_data_mp42 *data);
     39     Decode_Status continueDecodingFrame(vbp_data_mp42 *data);
     40     Decode_Status decodeSlice(vbp_data_mp42 *data, vbp_picture_data_mp42 *picData);
     41     Decode_Status setReference(VAPictureParameterBufferMPEG4 *picParam);
     42     Decode_Status startVA(vbp_data_mp42 *data);
     43     void updateFormatInfo(vbp_data_mp42 *data);
     44 
     45 private:
     46     // Value of VOP type defined here follows MP4 spec
     47     enum {
     48         MP4_VOP_TYPE_I = 0,
     49         MP4_VOP_TYPE_P = 1,
     50         MP4_VOP_TYPE_B = 2,
     51         MP4_VOP_TYPE_S = 3,
     52     };
     53 
     54     enum {
     55         MP4_SURFACE_NUMBER = 10,
     56     };
     57 
     58     uint64_t mLastVOPTimeIncrement;
     59     bool mExpectingNVOP; // indicate if future n-vop is a placeholder of a packed frame
     60     bool mSendIQMatrixBuf; // indicate if iq_matrix_buffer is sent to driver
     61     int32_t mLastVOPCodingType;
     62     bool mIsSyncFrame; // indicate if it is SyncFrame in container
     63     bool mIsShortHeader; // indicate if it is short header format
     64     VideoExtensionBuffer mExtensionBuffer;
     65     PackedFrameData mPackedFrame;
     66 };
     67 
     68 
     69 
     70 #endif /* VIDEO_DECODER_MPEG4_H_ */
     71