2013-12-09 13:51:09 +01:00
|
|
|
/*!
|
|
|
|
* \copy
|
|
|
|
* Copyright (c) 2013, Cisco Systems
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WELS_VIDEO_CODEC_SVC_API_H__
|
|
|
|
#define WELS_VIDEO_CODEC_SVC_API_H__
|
|
|
|
|
2014-02-08 13:37:26 +01:00
|
|
|
#ifndef __cplusplus
|
2014-02-12 21:17:41 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
typedef unsigned char bool;
|
|
|
|
#else
|
2014-02-08 13:37:26 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
2014-02-12 21:17:41 +01:00
|
|
|
#endif
|
2014-02-08 13:37:26 +01:00
|
|
|
|
2013-12-09 13:51:09 +01:00
|
|
|
#include "codec_app_def.h"
|
|
|
|
#include "codec_def.h"
|
|
|
|
|
2014-01-21 15:12:57 +01:00
|
|
|
#if defined(_WIN32) || defined(__cdecl)
|
|
|
|
#define EXTAPI __cdecl
|
|
|
|
#else
|
|
|
|
#define EXTAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2013-12-12 23:21:12 +01:00
|
|
|
class ISVCEncoder {
|
|
|
|
public:
|
|
|
|
/*
|
|
|
|
* return: CM_RETURN: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-02-18 11:29:43 +01:00
|
|
|
virtual int EXTAPI Initialize (const SEncParamBase* pParam) = 0;
|
|
|
|
virtual int EXTAPI InitializeExt (const SEncParamExt* pParam) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
2014-02-26 21:08:41 +01:00
|
|
|
virtual int EXTAPI GetDefaultParams (SEncParamExt* pParam) = 0;
|
|
|
|
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI Uninitialize() = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*
|
2014-03-17 03:46:38 +01:00
|
|
|
* return: 0 - success; otherwise -failed;
|
2013-12-12 23:21:12 +01:00
|
|
|
*/
|
2014-02-20 03:33:07 +01:00
|
|
|
virtual int EXTAPI EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) = 0;
|
2014-01-10 19:46:05 +01:00
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI EncodeParameterSets (SFrameBSInfo* pBsInfo) = 0;
|
2014-01-10 19:46:05 +01:00
|
|
|
|
2013-12-12 23:21:12 +01:00
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-05-06 04:30:21 +02:00
|
|
|
virtual int EXTAPI PauseFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI ForceIntraFrame (bool bIDR) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
|
|
|
|
************************************************************************/
|
|
|
|
/*
|
|
|
|
* return: CM_RETURN: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI SetOption (ENCODER_OPTION eOptionId, void* pOption) = 0;
|
|
|
|
virtual int EXTAPI GetOption (ENCODER_OPTION eOptionId, void* pOption) = 0;
|
2014-04-22 02:51:47 +02:00
|
|
|
virtual ~ISVCEncoder() {}
|
2013-12-09 13:51:09 +01:00
|
|
|
};
|
|
|
|
|
2013-12-12 23:21:12 +01:00
|
|
|
class ISVCDecoder {
|
|
|
|
public:
|
2014-02-18 11:59:14 +01:00
|
|
|
virtual long EXTAPI Initialize (const SDecodingParam* pParam) = 0;
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual long EXTAPI Uninitialize() = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* pSrc,
|
2014-05-06 04:30:21 +02:00
|
|
|
const int iSrcLen,
|
|
|
|
unsigned char** ppDst,
|
|
|
|
int* pStride,
|
|
|
|
int& iWidth,
|
|
|
|
int& iHeight) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
/*
|
2014-04-11 04:44:28 +02:00
|
|
|
* return: 0 - success; otherwise -failed;
|
2013-12-12 23:21:12 +01:00
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* pSrc,
|
2014-05-06 04:30:21 +02:00
|
|
|
const int iSrcLen,
|
2014-05-22 02:54:17 +02:00
|
|
|
unsigned char** ppDst,
|
2014-05-06 04:30:21 +02:00
|
|
|
SBufferInfo* pDstInfo) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*
|
2014-01-06 06:28:55 +01:00
|
|
|
* this API does not work for now!! This is for future use to support non-I420 color format output.
|
2013-12-12 23:21:12 +01:00
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* pSrc,
|
2014-05-06 04:30:21 +02:00
|
|
|
const int iSrcLen,
|
|
|
|
unsigned char* pDst,
|
|
|
|
int iDstStride,
|
|
|
|
int& iDstLen,
|
|
|
|
int& iWidth,
|
|
|
|
int& iHeight,
|
|
|
|
int& iColorFormat) = 0;
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*************************************************************************
|
2014-04-11 04:44:28 +02:00
|
|
|
* OutDataFormat, Eos Flag, EC method, ...
|
2013-12-12 23:21:12 +01:00
|
|
|
*************************************************************************/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual long EXTAPI SetOption (DECODER_OPTION eOptionId, void* pOption) = 0;
|
|
|
|
virtual long EXTAPI GetOption (DECODER_OPTION eOptionId, void* pOption) = 0;
|
2014-04-22 02:51:47 +02:00
|
|
|
virtual ~ISVCDecoder() {}
|
2013-12-09 13:51:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-12-12 23:21:12 +01:00
|
|
|
extern "C"
|
2013-12-09 13:51:09 +01:00
|
|
|
{
|
2014-01-21 15:12:57 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
typedef struct ISVCEncoderVtbl ISVCEncoderVtbl;
|
|
|
|
typedef const ISVCEncoderVtbl* ISVCEncoder;
|
|
|
|
struct ISVCEncoderVtbl {
|
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*Initialize) (ISVCEncoder*, const SEncParamBase* pParam);
|
|
|
|
int (*InitializeExt) (ISVCEncoder*, const SEncParamExt* pParam);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*GetDefaultParams) (ISVCEncoder*, SEncParamExt* pParam);
|
2014-02-26 21:08:41 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*Uninitialize) (ISVCEncoder*);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*EncodeFrame) (ISVCEncoder*, const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo);
|
|
|
|
int (*EncodeParameterSets) (ISVCEncoder*, SFrameBSInfo* pBsInfo);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*PauseFrame) (ISVCEncoder*, const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*ForceIntraFrame) (ISVCEncoder*, bool bIDR);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int (*SetOption) (ISVCEncoder*, ENCODER_OPTION eOptionId, void* pOption);
|
|
|
|
int (*GetOption) (ISVCEncoder*, ENCODER_OPTION eOptionId, void* pOption);
|
2014-01-21 15:12:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ISVCDecoderVtbl ISVCDecoderVtbl;
|
|
|
|
typedef const ISVCDecoderVtbl* ISVCDecoder;
|
|
|
|
struct ISVCDecoderVtbl {
|
2014-05-06 04:30:21 +02:00
|
|
|
long (*Initialize) (ISVCDecoder*, const SDecodingParam* pParam);
|
|
|
|
long (*Uninitialize) (ISVCDecoder*);
|
|
|
|
|
|
|
|
DECODING_STATE (*DecodeFrame) (ISVCDecoder*, const unsigned char* pSrc,
|
|
|
|
const int iSrcLen,
|
|
|
|
unsigned char** ppDst,
|
|
|
|
int* pStride,
|
|
|
|
int* iWidth,
|
|
|
|
int* iHeight);
|
|
|
|
|
|
|
|
DECODING_STATE (*DecodeFrame2) (ISVCDecoder*, const unsigned char* pSrc,
|
|
|
|
const int iSrcLen,
|
2014-05-22 02:54:17 +02:00
|
|
|
unsigned char** ppDst,
|
2014-05-06 04:30:21 +02:00
|
|
|
SBufferInfo* pDstInfo);
|
|
|
|
|
|
|
|
DECODING_STATE (*DecodeFrameEx) (ISVCDecoder*, const unsigned char* pSrc,
|
2014-01-21 15:12:57 +01:00
|
|
|
const int iSrcLen,
|
2014-05-06 04:30:21 +02:00
|
|
|
unsigned char* pDst,
|
|
|
|
int iDstStride,
|
|
|
|
int* iDstLen,
|
2014-01-21 15:12:57 +01:00
|
|
|
int* iWidth,
|
2014-05-06 04:30:21 +02:00
|
|
|
int* iHeight,
|
|
|
|
int* iColorFormat);
|
|
|
|
|
|
|
|
long (*SetOption) (ISVCDecoder*, DECODER_OPTION eOptionId, void* pOption);
|
|
|
|
long (*GetOption) (ISVCDecoder*, DECODER_OPTION eOptionId, void* pOption);
|
2014-01-21 15:12:57 +01:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
int WelsCreateSVCEncoder (ISVCEncoder** ppEncoder);
|
|
|
|
void WelsDestroySVCEncoder (ISVCEncoder* pEncoder);
|
2013-12-09 13:51:09 +01:00
|
|
|
|
2014-05-06 04:30:21 +02:00
|
|
|
long WelsCreateDecoder (ISVCDecoder** ppDecoder);
|
|
|
|
void WelsDestroyDecoder (ISVCDecoder* pDecoder);
|
2014-01-21 15:12:57 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2013-12-09 13:51:09 +01:00
|
|
|
}
|
2014-01-21 15:12:57 +01:00
|
|
|
#endif
|
2013-12-09 13:51:09 +01:00
|
|
|
|
|
|
|
#endif//WELS_VIDEO_CODEC_SVC_API_H__
|