AVCodec* m_pCodec;
AVCodecContext* m_pCodecCtx;
...
// v4l2m2m 디코더 찾기
m_pCodec = (AVCodec*)avcodec_find_decoder_by_name("h264_v4l2m2m");
// 코덱 컨텍스트 할당
m_pCodecCtx = avcodec_alloc_context3(m_pCodec);
// 픽셀포멧, width, height 지정
m_pCodecCtx->pix_fmt = AV_PIX_FMT_NV12;
m_pCodecCtx->width = 1920;
m_pCodecCtx->height = 1080;
// 코덱 열기
avcodec_open2(m_pCodecCtx, m_pCodec, NULL);
// 디코딩
retLen = avcodec_send_packet(m_pCodecCtx, &m_avPacket);
if (retLen == 0) retLen = avcodec_receive_frame(m_pCodecCtx, frame);
* 디코더 찾기, 픽셀포멧/width/height 지정 외 일반 디코딩 방법과 동일