4

RTSP over HTTP を使用する Axis IP カメラからストリーミングしようとしています。通常の RTSP ストリームを動作させることはできますが、ストリームのトンネリング モードを実際に設定する方法に関する情報やドキュメントが見つかりません。control_transport を RTSP_MODE_TUNNEL に設定することにより、ソース コードでサポートされます。私の質問は簡単です。次のコードでこれを行うにはどうすればよいですか?

 int ret = avformat_open_input(&pFormatCtx, [@"rtsp://ip/axis-media/media.amp" UTF8String], NULL, NULL);

私は次のことを試しました:

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);

しかし、それは単にそれを無視します (まだ RTP を使用し続けます)。これもやってみた

 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;

どうすればこれを解決できますか? ENUM があるので、それは本当に単純なことだと思います。

作業ソリューションは

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);
4

1 に答える 1

10

これを試しましたか

AVDictionary *opts = 0;
    if (usesTcp) {
        int ret = av_dict_set(&opts, "rtsp_transport", "tcp", 0);
    }


    err = avformat_open_input(&avfContext, filename, NULL, &opts);
    av_dict_free(&opts);
于 2013-01-22T16:42:15.243 に答える