gpt4 book ai didi

c++ - avformat_open_input 导致 RTP 流打开异常

转载 作者:行者123 更新时间:2023-12-04 23:31:39 51 4
gpt4 key购买 nike

我正在尝试对 RTP 流的视频播放器进行编程。我正在使用 Visual Studio 2010。执行 avformat_open_input 命令时会生成异常(ntdll.dll!774b70f4())。它适用于来自磁盘(test.avi)的普通文件。

#include "stdafx.h"
#include <stdio.h>

//zeranoe headers and libraries(DLLs also from zeranoe)
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}

#pragma comment(lib, "avcodec.lib")
#pragma comment(lib, "avformat.lib")

int _tmain(int argc, _TCHAR* argv[])
{
AVFormatContext *pFormatCtx=NULL;
//char* Filename="c:\\test.avi"; //if I use this there is no crash
char* Filename="rtp://239.255.42.42:5004";//if I use rtp I receive exception
int videoStream,i;
AVCodec *pCodec=NULL;
AVCodecContext *pCodecCtx=NULL;

avcodec_register_all();
av_register_all();
avformat_network_init();

unsigned int _expTime = 5000;
static const AVIOInterruptCB int_cb = {interrupt_cb, &_expTime};


// Open video file
if(avformat_open_input(&pFormatCtx, Filename , NULL,NULL)!=0)//ntdll.dll exception when I try to open rtp stream
return -1; // Couldn't open file

有人能帮助我吗?

最佳答案

在 avformat_open_input 之前试试这个

pFormatCtx = avformat_alloc_context();

关于c++ - avformat_open_input 导致 RTP 流打开异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21629798/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com