OSDN Git Service

stagefright-plugins: remove global dictionaries
authorScott Mertz <scott@cyngn.com>
Wed, 23 Dec 2015 00:19:59 +0000 (16:19 -0800)
committerScott Mertz <scott@cyngn.com>
Wed, 23 Dec 2015 00:19:59 +0000 (16:19 -0800)
The global dictionaries are only accessed from the ffmpeg extractor.
There is no use for them to be declared in one shared library and
accessed in another.

This has the benefit of fixing an issue where format_opts is not
initialized to NULL in some cases.

Change-Id: I57b39c82e29aa48fc852a9fbe8a2434885d407e6

extractor/FFmpegExtractor.cpp
utils/ffmpeg_cmdutils.c
utils/ffmpeg_cmdutils.h

index f966b4d..6eab2f1 100644 (file)
@@ -900,6 +900,7 @@ int FFmpegExtractor::initStreams()
     st_index[AVMEDIA_TYPE_VIDEO]  = -1;
     wanted_stream[AVMEDIA_TYPE_AUDIO]  = -1;
     wanted_stream[AVMEDIA_TYPE_VIDEO]  = -1;
+    AVDictionary *format_opts = NULL, *codec_opts = NULL;
     const char *mime = NULL;
 
     setFFmpegDefaultOpts();
@@ -932,9 +933,12 @@ int FFmpegExtractor::initStreams()
         ALOGE("Option %s not found.\n", t->key);
         //ret = AVERROR_OPTION_NOT_FOUND;
         ret = -1;
+        av_dict_free(&format_opts);
         goto fail;
     }
 
+    av_dict_free(&format_opts);
+
     if (mGenPTS)
         mFormatCtx->flags |= AVFMT_FLAG_GENPTS;
 
@@ -1884,6 +1888,7 @@ static const char *SniffFFMPEGCommon(const char *url, float *confidence, bool fa
     size_t nb_streams = 0;
     const char *container = NULL;
     AVFormatContext *ic = NULL;
+    AVDictionary *codec_opts = NULL;
     AVDictionary **opts = NULL;
 
     status_t status = initFFmpeg();
index 291574b..cdd0121 100644 (file)
@@ -4,8 +4,6 @@
 #include "libavutil/opt.h"
 #include "libavformat/avformat.h"
 
-AVDictionary *format_opts, *codec_opts;
-
 /*
 void print_error(const char *filename, int err)
 {
index f56b6eb..1fd2f23 100644 (file)
@@ -22,8 +22,6 @@ extern "C" {
 struct AVDictionary;
 struct AVFormatContext;
 
-extern AVDictionary *format_opts, *codec_opts;
-
 AVDictionary **setup_find_stream_info_opts(AVFormatContext *, AVDictionary *);
 
 #ifdef __cplusplus