コード例 #1
0
ファイル: ffdecode.cpp プロジェクト: xuchuansheng/GenXSource
// size pDataOut for YUV (width*height*3)/2
int CFFDecode::DecodePic(unsigned char* pData, long lsize, long pts, AVFrame **ppFrame, bool *pInterlaced)
{
	if (ppFrame == NULL) return E_POINTER;
	if (m_c->pix_fmt != PIX_FMT_YUV420P) return E_FAIL;
	*ppFrame = NULL;

	//{
	//	int size = m_c->width * m_c->height;
	//	/*DbgOutInt("size:",size);

	//	m_picture->data[0] = pData;
	//	m_picture->data[1] = pData+size;
	//	m_picture->data[2] = pData+size+(m_c->width/2)*(m_c->height/2);*/

	//	m_picture->data[0] = pDataOut;
	//	m_picture->data[1] = m_picture->data[0] + size;
	//	m_picture->data[2] = m_picture->data[1] + size / 4;
	//	m_picture->linesize[0] = m_c->width;
	//	m_picture->linesize[1] = m_c->width / 2;
	//	m_picture->linesize[2] = m_c->width / 2;
	//}

	int got_picture = 0;
	int ret = 0;

	try {
		ret = avcodec_decode_video(m_c, &m_picture, &got_picture, pData, lsize);
		DbgOutInt("ret decode:",ret);
		DbgOutInt("lsize decode:",lsize);
	} catch (...) {
		ret = 0;
		got_picture = 0;
	}

	if (got_picture == 0) return S_FALSE;

	m_picture.quality = 1;
	*ppFrame = &m_picture;
	if (pInterlaced != NULL) 
		*pInterlaced = (bool) m_picture.interlaced_frame;

	if (!tmp_picture){ // one time jpg conversion
		img_convert_ctx = sws_getContext(m_c->width, m_c->height, PIX_FMT_YUV420P,320, 240,PIX_FMT_RGB32, SWS_FAST_BILINEAR,NULL,NULL,NULL);
		if (img_convert_ctx){
			tmp_picture = alloc_picture(PIX_FMT_RGB32, 320, 240);
			//fill_yuv_image(tmp_picture, 0, m_c->width, m_c->height);
			int ires=sws_scale(img_convert_ctx, m_picture.data,  m_picture.linesize,0, m_c->height, tmp_picture->data, tmp_picture->linesize);
			SaveFrame(tmp_picture, 320, 240);
		}
	}
	

	return S_OK;
}
コード例 #2
0
ファイル: pointers.cpp プロジェクト: MapleStoryGameHack/MSC
VOID UpdateDebug()
{
	while(TRUE)
	{
		DbgOutInt("map= ", mapID);
		DbgOutInt("charX= ", characterx);
		DbgOutInt("charY= ", charactery);
		DbgOutInt("hp= ", health);
		DbgOutInt("mp= ", mana);

		Sleep(100);
	}
}
コード例 #3
0
ファイル: LuaManager.cpp プロジェクト: carlixyz/engin3d
int cLuaManager::FuncPanic(lua_State *lpContext)
{
  assert(lpContext);
	
	#ifdef _WIN32
	  DbgOutInt("\n Error: \n",lua_tostring( lpContext, -1 )  );
  #else	
		printf( "\n Error: %s\n", lua_tostring( lpContext, -1 ) );
	#endif
  
  //Sacamos el mensaje del top de la pila 
  lua_pop( lpContext, 1 );

  return 1;
}
コード例 #4
0
ファイル: LuaManager.cpp プロジェクト: carlixyz/engin3d
bool cLuaManager::CheckError( int liError )
{
	// If liError it´s diferent of zero there is an error
	if ( liError != 0 )
	{
		assert( mpLuaContext );
		// Showing the error message (could be by outputdebug string)
	
		#ifdef _WIN32
		DbgOutInt("\n Error: \n",lua_tostring( mpLuaContext, -1 )  );
		#else	
		printf( "\n Error: %s\n", lua_tostring( mpLuaContext, -1 ) );
		#endif

		// taking the message from the top of the stack
		lua_pop( mpLuaContext, 1 );
		return false;
	}
	return true;
}