Hey Guys
I am having some issues with a segfault whenever I try to decode a video
frame.
-----------------------------------------------------------------------
AVCodecContext *codec_info = pFormatCtx -> streams[video_stream] -> codec;
if (codec_info == NULL) {
perror("couldn't get codec info");
return -1; //couldn't get the codec info
}
AVFrame *this_frame = avcodec_alloc_frame();
int got_frame = -1;
AVPacket this_packet;
AVPacket *p_this_packet = &this_packet;
int num_frames = 0;
while (av_read_frame(pFormatCtx, &this_packet) >= 0) {
if ((this_packet.stream_index == video_stream)) {
avcodec_decode_video2(codec_info, this_frame, &got_frame,
p_this_packet);
num_frames = num_frames + 1;
}
av_free_packet(&this_packet);
}
-------------------------------------------------------------------------
When I run it through GDB, I get a segfault at:
-------------------------------------
... avcodec_decode_video2 (avctx=0x92b82a0, picture=0x934cdd0,
got_picture_ptr=0xbff383c4, avpkt=0xbff38380) at libavcodec/utils.c:563
563 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
-------------------------------------
I can print out random info from the AVCodecContext, like gop_size and such,
so I don't think I'm just allocating something stupidly.
If anyone has any idea what could be going on, I'd appreciate the help.
Thanks,
Sam
--
View this message in context:
http://www.nabble.com/segfault-in-avcodec_decode_video2-tp23508470p23508470.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user