Commit f8d33b35 authored by Rafaël Carré's avatar Rafaël Carré

avio: specify libav private options

Usage: --avio-options={foo=bar,few=baz}
parent 50fe8e11
......@@ -148,7 +148,17 @@ int OpenAvio(vlc_object_t *object)
.callback = UrlInterruptCallback,
.opaque = access,
};
ret = avio_open2(&sys->context, url, AVIO_FLAG_READ, &cb, NULL /* options */);
AVDictionary *options = NULL;
char *psz_opts = var_InheritString(access, "avio-options");
if (psz_opts && *psz_opts) {
options = vlc_av_get_options(psz_opts);
free(psz_opts);
}
ret = avio_open2(&sys->context, url, AVIO_FLAG_READ, &cb, &options);
AVDictionaryEntry *t = NULL;
while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
msg_Err( access, "unknown option \"%s\"", t->key );
av_dict_free(&options);
#endif
if (ret < 0) {
errno = AVUNERROR(ret);
......@@ -216,8 +226,18 @@ int OutOpenAvio(vlc_object_t *object)
.callback = UrlInterruptCallback,
.opaque = access,
};
AVDictionary *options = NULL;
char *psz_opts = var_InheritString(access, "avio-options");
if (psz_opts && *psz_opts) {
options = vlc_av_get_options(psz_opts);
free(psz_opts);
}
ret = avio_open2(&sys->context, access->psz_path, AVIO_FLAG_WRITE,
&cb, NULL /* options */);
&cb, &options);
AVDictionaryEntry *t = NULL;
while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
msg_Err( access, "unknown option \"%s\"", t->key );
av_dict_free(&options);
#endif
if (ret < 0) {
errno = AVUNERROR(ret);
......
......@@ -43,6 +43,7 @@ void OutCloseAvio(vlc_object_t *);
set_capability("access", -1) \
add_shortcut("avio", "rtmp", "rtmpe", "rtmps", "rtmpt", "rtmpte", "rtmpts") \
set_callbacks(OpenAvio, CloseAvio) \
add_string("avio-options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true) \
add_submodule () \
set_shortname( "libavformat" ) \
set_description( N_("libavformat access output") ) \
......@@ -50,4 +51,5 @@ void OutCloseAvio(vlc_object_t *);
set_category( CAT_SOUT ) \
set_subcategory( SUBCAT_SOUT_ACO ) \
add_shortcut( "avio", "rtmp" ) \
set_callbacks( OutOpenAvio, OutCloseAvio)
set_callbacks( OutOpenAvio, OutCloseAvio) \
add_string("avio-options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment