#include "mfxvideo.h" #include "mfxdefs.h" #include "mfxmvc.h" #include #include #include int main(int argc, char* argv[]) { printf("Hello..\n"); mfxSession session; mfxStatus sts; mfxIMPL impl=MFX_IMPL_HARDWARE_ANY; mfxVersion version; version.Major=1; version.Minor=0; sts = MFXInit(impl, &version, &session); if (MFX_ERR_NONE != sts) { printf("Error in Init :( \n"); exit(0); } else { printf("Init Succeess :) \n"); printf("Version: %d.%d\n", version.Major, version.Minor); } mfxVideoParam Params_in, Params_out; int size=sizeof(Params_in); memset(&Params_in,0,sizeof(Params_in)); Params_in.IOPattern=MFX_IOPATTERN_IN_SYSTEM_MEMORY; Params_in.mfx.CodecId=MFX_CODEC_AVC; Params_in.mfx.TargetKbps = 10; Params_in.mfx.EncodedOrder = 0; Params_in.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; Params_in.mfx.FrameInfo.Width = 1280; Params_in.mfx.FrameInfo.Height = 720; Params_in.mfx.FrameInfo.CropX = 0; Params_in.mfx.FrameInfo.CropY = 0; Params_in.mfx.FrameInfo.CropW = 1280; Params_in.mfx.FrameInfo.CropH = 720; Params_in.mfx.FrameInfo.FrameRateExtN = 60000; Params_in.mfx.FrameInfo.FrameRateExtD = 2002; Params_in.mfx.FrameInfo.AspectRatioW = 1; Params_in.mfx.FrameInfo.AspectRatioH = 1; Params_in.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; Params_in.mfx.FrameInfo.PicStruct = 1; Params_in.mfx.CodecProfile = MFX_PROFILE_AVC_STEREO_HIGH; Params_in.mfx.CodecLevel = 31; Params_in.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED; Params_in.AsyncDepth = 1; Params_in.mfx.LowPower = MFX_CODINGOPTION_ON; Params_in.mfx.BRCParamMultiplier = 0; Params_in.mfx.GopRefDist = 0; Params_in.mfx.GopPicSize = 1; Params_in.mfx.RateControlMethod = 0; Params_in.mfx.NumSlice = 0; memset(&Params_out,0,sizeof(Params_out)); sts = MFXQueryIMPL(session,&impl); if (MFX_ERR_NONE != sts) { printf("Error in QueryIMPL :( \n"); exit(0); } else { printf(" QUERYIMPL Succeess %x :) \n", impl); } sts = MFXQueryVersion((mfxSession)session, &version); if (MFX_ERR_NONE != sts) { printf("version Error :( \n"); exit(0); } else { printf("Using Version: %d.%d\n", version.Major, version.Minor); } sts = MFXVideoENCODE_Query(session, &Params_in, &Params_out); if (MFX_ERR_NONE != sts) { printf("Error in Query %d:( \n", sts); //exit(0); } else { printf("Success Encode Query\n"); } sts = MFXVideoENCODE_Init(session, &Params_in); if (MFX_ERR_NONE != sts) { printf("Error in EncodeInit %d:( \n", sts); //exit(0); } else { printf("Success Encode Query\n"); } //DE Init code sts = MFXClose(session); if (MFX_ERR_NONE != sts) { printf("Error in Closing :( \n"); } else { printf("DeInit Succeess :) \n"); } }