diff options
author | Marton Balint <cus@passwd.hu> | 2017-12-29 01:01:37 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2018-01-28 23:06:43 +0100 |
commit | ea3672b7d67c432724bdbc8de0221f869b6a04c6 (patch) | |
tree | 7127b576630f140f79a0f73d07bc4a34a92ea824 /libavformat/mux.c | |
parent | dc5d1515681b57a257443ba72bb81fb3e6e6621b (diff) |
avformat: add url field to AVFormatContext
This will replace the 1024 character limited filename field. Compatiblity for
output contexts are provided by copying filename field to URL if URL is unset
and by providing an internal function for muxers to set both url and filename
at once.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r-- | libavformat/mux.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index ea9f13fdf5..de63f2ca25 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -186,8 +186,12 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *ofor } else s->priv_data = NULL; - if (filename) + if (filename) { av_strlcpy(s->filename, filename, sizeof(s->filename)); + if (!(s->url = av_strdup(filename))) + goto nomem; + + } *avctx = s; return 0; nomem: @@ -251,6 +255,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0) goto fail; + if (!s->url && !(s->url = av_strdup(s->filename))) { + ret = AVERROR(ENOMEM); + goto fail; + } + #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT) { |