int StreamingManager::DecodeFrame(AVFrame *frame, AVPacket* avpkt, StreamConfig* decConfig) { int len = 0; int got_frame = 1; while (avpkt->size > 0) { /* TODO handle multi frame packets */ len = DecodeMedia(frame, avpkt, decConfig, &got_frame); if (len < 0) { printf("Error while decoding frame %s", len); return -1; } if (got_frame) { OnVideoFrameDecoded((const uint8_t **)frame->data, decConfig, frame); decConfig->frameCnt++; } av_free_packet(avpkt); } return 0; }
HRESULT CG729Codec::Transform(IMediaSample *pIn, IMediaSample *pOut) { HRESULT hr = Copy( pIn, pOut ); if ( FAILED(hr) ) return hr; CMediaType* pMediaType = &m_pInput->CurrentMediaType(); WAVEFORMATEX *pwfx = (WAVEFORMATEX *) pMediaType->pbFormat; if ( pMediaType->subtype == MEDIASUBTYPE_G729AAudio ) //if ( pwfx->wFormatTag == WAVE_FORMAT_G729A) { DecodeMedia( pIn, pOut ); } else // MEDIASUBTYPE_PCM { EncodeMedia( pIn, pOut ); } return S_OK; }