OSError: exception: access violation writing and reading
OSError: exception: access violation writing 0x0000000000000000
原因:pFormatCtx 么有分配内存
//pFormatCtx = NULL;
//pFormatCtx = avformat_alloc_context();
aviobuffer = (unsigned char *)av_malloc(1512);
//AVIOContext *avio2 = avio_alloc_context(aviobuffer, 1512, 0, &deviceInfo, read_buffer, NULL, NULL);
//pFormatCtx->pb = avio2;
if (avformat_open_input(&pFormatCtx, NULL, NULL, NULL) != 0) {
printf("2Couldn't open input stream %d\n", cam_no);
//return -1;
}
正确做法:
pFormatCtx = NULL;
pFormatCtx = avformat_alloc_context();
//aviobuffer = (unsigned char *)av_malloc(1512);
AVIOContext *avio2 = avio_alloc_context(aviobuffer, 1512, 0, &deviceInfo, read_buffer, NULL, NULL);
pFormatCtx->pb = avio2;
if (avformat_open_input(&pFormatCtx, NULL, NULL, NULL) != 0) {
printf("2Couldn't open input stream %d\n", cam_no);
//return -1;
}
OSError: exception: access violation reading 0x0000000000000028
原因:avformat_open_input没有调用:
if (avformat_open_input(&pFormatCtx, NULL, NULL, NULL) != 0) {
printf("2Couldn't open input stream %d\n", cam_no);
//return -1;
}
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/80140748
- 点赞
- 收藏
- 关注作者
评论(0)