|
Packit |
1244b8 |
/*
|
|
Packit |
1244b8 |
* Copyright (C) 2013 Intel Corporation. All rights reserved.
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1244b8 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1244b8 |
* You may obtain a copy of the License at
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1244b8 |
*
|
|
Packit |
1244b8 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1244b8 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1244b8 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1244b8 |
* See the License for the specific language governing permissions and
|
|
Packit |
1244b8 |
* limitations under the License.
|
|
Packit |
1244b8 |
*/
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#ifndef VIDEO_DECODER_DEFS_H_
|
|
Packit |
1244b8 |
#define VIDEO_DECODER_DEFS_H_
|
|
Packit |
1244b8 |
// config.h should NOT be included in header file, especially for the header file used by external
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#include <va/va.h>
|
|
Packit |
1244b8 |
#include <stdint.h>
|
|
Packit |
1244b8 |
#include <VideoCommonDefs.h>
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#ifdef __cplusplus
|
|
Packit |
1244b8 |
extern "C" {
|
|
Packit |
1244b8 |
#endif
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
// flags for VideoDecodeBuffer, VideoConfigBuffer and VideoRenderBuffer
|
|
Packit |
1244b8 |
typedef enum {
|
|
Packit |
1244b8 |
// indicate whether surfaceNumber field in the VideoConfigBuffer is valid
|
|
Packit |
1244b8 |
HAS_SURFACE_NUMBER = 0x04,
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
// indicate whether profile field in the VideoConfigBuffer is valid
|
|
Packit |
1244b8 |
HAS_VA_PROFILE = 0x08,
|
|
Packit |
1244b8 |
} VIDEO_BUFFER_FLAG;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
typedef enum {
|
|
Packit |
1244b8 |
//this will tell decoder, we have the whole frame.
|
|
Packit |
1244b8 |
//so the decoder can do decode immediately
|
|
Packit |
1244b8 |
//else they may need to wait for next frame boundary
|
|
Packit |
1244b8 |
VIDEO_DECODE_BUFFER_FLAG_FRAME_END = 0x1,
|
|
Packit |
1244b8 |
} VIDEO_DECODE_BUFFER_FLAG;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
typedef struct {
|
|
Packit |
1244b8 |
uint8_t *data;
|
|
Packit |
1244b8 |
size_t size;
|
|
Packit |
1244b8 |
int64_t timeStamp;
|
|
Packit |
1244b8 |
uint32_t flag;
|
|
Packit |
1244b8 |
}VideoDecodeBuffer;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
typedef struct {
|
|
Packit |
1244b8 |
uint8_t *data;
|
|
Packit |
1244b8 |
int32_t size;
|
|
Packit |
1244b8 |
/// it is the actual frame size, height is 1080 for h264 1080p stream
|
|
Packit |
1244b8 |
uint32_t width;
|
|
Packit |
1244b8 |
uint32_t height;
|
|
Packit |
1244b8 |
/// surfaceWidth and surfaceHeight are the resolution to config output buffer (dirver surface size or client buffer like in sw decode mode)
|
|
Packit |
1244b8 |
/// take h264 1080p as example, it is enlarged to 1088
|
|
Packit |
1244b8 |
int32_t surfaceWidth;
|
|
Packit |
1244b8 |
int32_t surfaceHeight;
|
|
Packit |
1244b8 |
int32_t frameRate;
|
|
Packit |
1244b8 |
int32_t surfaceNumber;
|
|
Packit |
1244b8 |
VAProfile profile;
|
|
Packit |
1244b8 |
uint32_t flag;
|
|
Packit |
1244b8 |
uint32_t fourcc;
|
|
Packit |
1244b8 |
//xxxLayer - how many layers to decode; if 0, decode all layers.
|
|
Packit |
1244b8 |
uint32_t temporalLayer;
|
|
Packit |
1244b8 |
uint32_t spacialLayer;
|
|
Packit |
1244b8 |
uint32_t qualityLayer;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
//if set this flag to true, AVC decoder will output the ready frames ASAP.
|
|
Packit |
1244b8 |
bool enableLowLatency;
|
|
Packit |
1244b8 |
}VideoConfigBuffer;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
typedef struct {
|
|
Packit |
1244b8 |
bool valid; // indicates whether format info is valid. MimeType is always valid.
|
|
Packit |
1244b8 |
char *mimeType;
|
|
Packit |
1244b8 |
//width, height, this equals to same value in VideoFrame.crop
|
|
Packit |
1244b8 |
//if your video is 1920x1080, width will be 1920,and height will be 1080
|
|
Packit |
1244b8 |
uint32_t width;
|
|
Packit |
1244b8 |
uint32_t height;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
/* Same thing as SurfaceAllocParams.width and SurfaceAllocParams.height
|
|
Packit |
1244b8 |
* You only need pay attention surfaceXXXX only when you are:
|
|
Packit |
1244b8 |
* 1. using IVideoDecoder.setAllocator.
|
|
Packit |
1244b8 |
* and
|
|
Packit |
1244b8 |
* 2. you want pre-allocate surface before we call SurfaceAllocator.alloc
|
|
Packit |
1244b8 |
* This size is depends on codec type or decoder hardware requirements
|
|
Packit |
1244b8 |
* For h264 1920x1080 it is usually 1920x1088 since h264 need 16 aligned surface
|
|
Packit |
1244b8 |
* Other *important* thing is, we may only call SurfaceAllocator.alloc when surface resolution increased
|
|
Packit |
1244b8 |
* For example, when resolution increase from 640x480 to 1920x1080, we will call
|
|
Packit |
1244b8 |
* SurfaceAllocator.alloc for 1920x1080, but when video change from 1920x1080 to 640x480, we
|
|
Packit |
1244b8 |
* may not call SurfaceAllocator.alloc, since we have enough surface resolution for decoding.
|
|
Packit |
1244b8 |
*/
|
|
Packit |
1244b8 |
uint32_t surfaceWidth;
|
|
Packit |
1244b8 |
uint32_t surfaceHeight;
|
|
Packit |
1244b8 |
//same thing as SurfaceAllocParams.size
|
|
Packit |
1244b8 |
uint32_t surfaceNumber;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
//unused thing yet, may remove in near future
|
|
Packit |
1244b8 |
int32_t aspectX;
|
|
Packit |
1244b8 |
int32_t aspectY;
|
|
Packit |
1244b8 |
int32_t cropLeft;
|
|
Packit |
1244b8 |
int32_t cropRight;
|
|
Packit |
1244b8 |
int32_t cropTop;
|
|
Packit |
1244b8 |
int32_t cropBottom;
|
|
Packit |
1244b8 |
int32_t colorMatrix;
|
|
Packit |
1244b8 |
int32_t videoRange;
|
|
Packit |
1244b8 |
int32_t bitrate;
|
|
Packit |
1244b8 |
int32_t framerateNom;
|
|
Packit |
1244b8 |
int32_t framerateDenom;
|
|
Packit |
1244b8 |
//unused end
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
uint32_t fourcc;
|
|
Packit |
1244b8 |
}VideoFormatInfo;
|
|
Packit |
1244b8 |
|
|
Packit |
1244b8 |
#ifdef __cplusplus
|
|
Packit |
1244b8 |
}
|
|
Packit |
1244b8 |
#endif
|
|
Packit |
1244b8 |
#endif // VIDEO_DECODER_DEFS_H_
|