summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2010-10-02 08:44:33 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2010-10-02 08:44:33 +0000
commita5c33faaccec6787419fe373a9e7ae0932b15ee1 (patch)
tree9b0f45a55539b3260f1db09053eb450435dfce7d /cmdutils.c
parent05931ab763c873198947142fc84dfe6c8c285fd6 (diff)
Add init and uninit functions to cmdutils, reduces code duplication
between ffmpeg and ffplay and avoids a valgrind error by freeing avformat_opts->key. Originally committed as revision 25309 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c
index ff399299b6..313b37deb1 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -57,6 +57,25 @@ struct SwsContext *sws_opts;
const int this_year = 2010;
+void init_opts(void)
+{
+ int i;
+ for (i = 0; i < AVMEDIA_TYPE_NB; i++)
+ avcodec_opts[i] = avcodec_alloc_context2(i);
+ avformat_opts = avformat_alloc_context();
+ sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL);
+}
+
+void uninit_opts(void)
+{
+ int i;
+ for (i = 0; i < AVMEDIA_TYPE_NB; i++)
+ av_freep(&avcodec_opts[i]);
+ av_freep(&avformat_opts->key);
+ av_freep(&avformat_opts);
+ av_freep(&sws_opts);
+}
+
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
{
vfprintf(stdout, fmt, vl);