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>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user