I'm trying to stream from an Axis ip camera which uses RTSP over HTTP. I can get the normal RTSP stream to work, but I can't find any information or documentation on how to actually set the tunneling mode for the stream. It is supported in the source code by setting the control_transport to RTSP_MODE_TUNNEL . My question is simple how do I do this with the following code?
int ret = avformat_open_input(&pFormatCtx, [@"rtsp://ip/axis-media/media.amp" UTF8String], NULL, NULL);
I tried the following:
pFormatCtx = avformat_alloc_context(); pFormatCtx->priv_data = malloc(sizeof(RTSPState)); RTSPState *rt = pFormatCtx->priv_data; rt->control_transport = RTSP_MODE_TUNNEL; int ret = avformat_open_input(&pFormatCtx, [@"rtsp://ip/axis-media/media.amp" UTF8String], NULL, NULL);
But it simply ignores it for me (It still keeps using RTP). I tried this aswell
int ret = avformat_open_input(&pFormatCtx, [@"rtsp://ip/axis-media/media.amp" UTF8String], NULL, NULL); RTSPState *rt = pFormatCtx->priv_data; rt->control_transport = RTSP_MODE_TUNNEL;
How would I solve this? I'm thinking it's something really simple since the ENUM is there.
Working solution is
AVDictionary *opts = 0; int ret = av_dict_set(&opts, "rtsp_transport", "http", 0); ret = avformat_open_input(&pFormatCtx, [@"rtsp://ip:80/axis-media/media.amp" UTF8String], NULL, &opts); av_dict_free(&opts);