1 /*****************************************************************************
2 * avinit.h: common code for libav* initialization
3 *****************************************************************************
4 * Copyright (C) 2012 the VideoLAN team
7 * Authors: Rafaël Carré <funman@videolanorg>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
28 #include <vlc_avcodec.h>
29 #include <vlc_configuration.h>
30 #include <vlc_variables.h>
32 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
33 # include <libavformat/avformat.h>
34 static inline void vlc_init_avformat(void)
44 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
45 # include <libavcodec/avcodec.h>
46 static inline void vlc_init_avcodec(void)
50 #if LIBAVCODEC_VERSION_MAJOR < 54
53 avcodec_register_all();
59 #ifdef HAVE_LIBAVUTIL_AVUTIL_H
60 # include <libavutil/avutil.h>
61 # if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 51, 7, 0 )
62 # include <libavutil/dict.h>
64 #define AV_OPTIONS_TEXT "FFmpeg advanced options."
65 #define AV_OPTIONS_LONGTEXT "FFmpeg advanced options, in the form {opt=val,opt2=val2} ."
67 static inline AVDictionary *vlc_av_get_options(const char *psz_opts)
69 AVDictionary *options = NULL;
71 config_ChainParseOptions(&cfg, psz_opts);
73 config_chain_t *next = cfg->p_next;
74 av_dict_set(&options, cfg->psz_name, cfg->psz_value,
75 AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);