@@ -27,6 +27,8 @@ extern "C" {
2727#include " libavutil/time.h"
2828}
2929
30+ #include < string>
31+
3032/*
3133 AVCodecID codec_id;
3234 char *codec_codec;
@@ -140,16 +142,16 @@ bool VideoStore::open() {
140142 ret = av_dict_set (&pmetadata, " title" , " Zoneminder Security Recording" , 0 );
141143 if (ret < 0 ) Warning (" %s:%d: title set failed" , __FILE__, __LINE__);
142144
143- AVDictionary *opts = 0 ;
145+ AVDictionary *opts = nullptr ;
144146 std::string options = monitor->GetEncoderOptions ();
145147 ret = av_dict_parse_string (&opts, options.c_str (), " =" , " ,#\n " , 0 );
146148 if (ret < 0 ) {
147149 Warning (" Could not parse ffmpeg encoder options list '%s'" , options.c_str ());
148150 } else {
149151 const AVDictionaryEntry *entry = av_dict_get (opts, " reorder_queue_size" , nullptr , AV_DICT_MATCH_CASE);
150152 if (entry) {
151- reorder_queue_size = atoi (entry->value );
152- Debug (1 , " reorder_queue_size set to %d " , reorder_queue_size);
153+ reorder_queue_size = std::stoul (entry->value );
154+ Debug (1 , " reorder_queue_size set to %zu " , reorder_queue_size);
153155 // remove it to prevent complaining later.
154156 av_dict_set (&opts, " reorder_queue_size" , nullptr , AV_DICT_MATCH_CASE);
155157 }
@@ -323,7 +325,11 @@ bool VideoStore::open() {
323325 while ((e = av_dict_get (opts, " " , e, AV_DICT_IGNORE_SUFFIX)) != nullptr ) {
324326 Warning (" Encoder Option %s not recognized by ffmpeg codec" , e->key );
325327 }
326- av_dict_free (&opts);
328+ av_dict_parse_string (&opts, options.c_str (), " =" , " ,#\n " , 0 );
329+ if (reorder_queue_size) {
330+ // remove it to prevent complaining later.
331+ av_dict_set (&opts, " reorder_queue_size" , nullptr , AV_DICT_MATCH_CASE);
332+ }
327333
328334 if (video_out_codec) break ;
329335#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
0 commit comments