Hi,
I am having troubles when I use libav* libs built from the latest SVN. With
the old libs I use ( from around 6 months ago ) I have no problem to decode
ogg vorbis media. But with the new one I expirience crash when calling
avcodec_decode_audio2. I have narrowed down the problem to issues with
getting the packets because the first packet which av_read_frame returns has
correct fields ( pts, dts ). The second and all others have arbitrary values
as pts, dts and when I put the data from them in the audio decode function
it crashes. At the same time ffmpeg.exe has no problem to decode the ogg
vorbis so either something has changed in the way we should set up ffmpeg
for reading or there is some issue with Visual Studio.
I am using ffmpeg on windows and Visual Studio. Bellow is simple code
example:
//------------------------------
av_register_all();
AVFormatContext *pFormatCtx = NULL;
AVCodecContext *pAudioCodecCtx = NULL;
do
{
if(0 != av_open_input_file(&pFormatCtx,
T2A(L"E:\\TestMedia\\bin\\vorbis.dat"), NULL, 0, NULL))
break;
if(av_find_stream_info(pFormatCtx) < 0)
break;
AVStream *pAudioStream = NULL;
INT nAudioStream = -1;
for(int i=0; i<pFormatCtx->nb_streams; i++)
{
if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_AUDIO)
{
pAudioStream = pFormatCtx->streams[i];
nAudioStream = i;
break;
}
}
pAudioCodecCtx = pFormatCtx->streams[nAudioStream]->codec;
AVCodec *pAudioCodec = avcodec_find_decoder(pAudioCodecCtx->codec_id);
if(pAudioCodec)
{
pAudioCodecCtx->request_channels = 2;
if(avcodec_open(pAudioCodecCtx, pAudioCodec)<0)
{
pAudioCodec = NULL;
break;
}
}
AVPacket packet;
while(av_read_frame(pFormatCtx, &packet)>=0)
{
av_free_packet(&packet);
}
}
while(FALSE);
avcodec_close(pAudioCodecCtx);
av_close_input_file(pFormatCtx);
//---------------------------------------------------
Does someone know what the issue may be. The above code works just fine with
the old ffmpeg libs and fails with the new one.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user