From fb2012def2df436a886f0fdcc99857dba31caf16 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 6 Oct 2014 07:56:30 +0000 Subject: [PATCH] TCP instead of UDP --- modules/highgui/src/cap_ffmpeg_impl.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/highgui/src/cap_ffmpeg_impl.hpp b/modules/highgui/src/cap_ffmpeg_impl.hpp index 5f0207c165..aeee8c053d 100644 --- a/modules/highgui/src/cap_ffmpeg_impl.hpp +++ b/modules/highgui/src/cap_ffmpeg_impl.hpp @@ -260,6 +260,10 @@ struct CvCapture_FFMPEG and so the filename is needed to reopen the file on backward seeking. */ char * filename; + +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + AVDictionary *dict; +#endif }; void CvCapture_FFMPEG::init() @@ -280,6 +284,10 @@ void CvCapture_FFMPEG::init() avcodec = 0; frame_number = 0; eps_zero = 0.000025; + +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + dict = NULL; +#endif } @@ -329,6 +337,11 @@ void CvCapture_FFMPEG::close() packet.data = NULL; } +#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) + if (dict != NULL) + av_dict_free(&dict); +#endif + init(); } @@ -536,7 +549,8 @@ bool CvCapture_FFMPEG::open( const char* _filename ) close(); #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0) - int err = avformat_open_input(&ic, _filename, NULL, NULL); + av_dict_set(&dict, "rtsp_transport", "tcp", 0); + int err = avformat_open_input(&ic, _filename, NULL, &dict); #else int err = av_open_input_file(&ic, _filename, NULL, 0, NULL); #endif