4GB 이상의 파일의 파일포인터를 지정할때는 SetFilePointerEx를씀
int64_t llFileSeek (HANDLE hf, __int64 distance, DWORD MoveMethod)
{
LARGE_INTEGER li;
li.QuadPart = distance;
SetFilePointerEx(hf, li, &li, MoveMethod);
if (GetLastError() != NO_ERROR)
{
li.QuadPart = -1;
}
return li.QuadPart;
}
SetFilePointer를 쓸대는 QuadPart를 음수로 변환해서
난 잘 안되던데 왜인지.... 댓글좀
int64_t llFileSeek (HANDLE hf, __int64 distance, DWORD MoveMethod)
{
LARGE_INTEGER li;
li.QuadPart = -distance;
SetFilePointerEx(hf, li, &li, MoveMethod);
if (GetLastError() != NO_ERROR)
{
li.QuadPart = -1;
}
return li.QuadPart;
}
2017년 1월 11일 수요일
2016년 12월 5일 월요일
2015년 3월 12일 목요일
FFMPEG Video Decode
기본예제 http://ffmpeg.org/doxygen/trunk/decoding_encoding_8c-example.html#a83
AVCodec *pDecodeCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
AVCodecContext *pDecodeCodecCtx = avcodec_alloc_context3(pDecodeCodec);
int nRet = avcodec_open2(pDecodeCodecCtx, pDecodeCodec, NULL);
if(nRet<0)
fprintf("err\n");
AVPcket avpkt;
av_init_packet(&avpkt);
avpkt.data = (uint8_t*) stream; //영상데이터의 포인터
avpkt.size = sizeOfStream; //영상데이터의 크기
AVFrame *pFrame;
pFrame = avcodec_alloc_frame();
int got_picture = 0;
nRet = avcodec_decode_video2(pDecodeCodecCtx, pFrame, &got_picture, avpkt);
if(nRet < 0)
fprintf("err\n");
if(got_picture)
Docode 결과는 pFrame에 저장
이렇게 하면 디코딩이 된돠~
!!!주의 alloc한것들은 모두 free해줄 것.
다음에는 MFC에서 디코드된 결과를 화면에 뿌려주는것 정리해야지
- Decode(H264 Codec)
avcodec_register_all();
AVCodec *pDecodeCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
AVCodecContext *pDecodeCodecCtx = avcodec_alloc_context3(pDecodeCodec);
int nRet = avcodec_open2(pDecodeCodecCtx, pDecodeCodec, NULL);
if(nRet<0)
fprintf("err\n");
AVPcket avpkt;
av_init_packet(&avpkt);
avpkt.data = (uint8_t*) stream; //영상데이터의 포인터
avpkt.size = sizeOfStream; //영상데이터의 크기
AVFrame *pFrame;
pFrame = avcodec_alloc_frame();
int got_picture = 0;
nRet = avcodec_decode_video2(pDecodeCodecCtx, pFrame, &got_picture, avpkt);
if(nRet < 0)
fprintf("err\n");
if(got_picture)
Docode 결과는 pFrame에 저장
이렇게 하면 디코딩이 된돠~
!!!주의 alloc한것들은 모두 free해줄 것.
다음에는 MFC에서 디코드된 결과를 화면에 뿌려주는것 정리해야지
2015년 2월 9일 월요일
피드 구독하기:
글 (Atom)