[FFmpeg-devel] [PATCH 2/7] avformat: add url field to AVFormatContext
Marton Balint
cus at passwd.hu
Mon Jan 8 18:52:48 EET 2018
On Mon, 8 Jan 2018, Bang He wrote:
> On Sun, Jan 7, 2018 at 4:50 AM, Marton Balint <cus at passwd.hu> wrote:
>
>> 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 at passwd.hu>
>> ---
>> doc/APIchanges | 3 +++
>> libavformat/avformat.h | 15 +++++++++++++++
>> libavformat/internal.h | 7 +++++++
>> libavformat/mux.c | 11 ++++++++++-
>> libavformat/utils.c | 14 ++++++++++++++
>> libavformat/version.h | 2 +-
>> 6 files changed, 50 insertions(+), 2 deletions(-)
>>
[...]
>> @@ -5624,3 +5630,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
>> return st->internal->avctx->time_base;
>> #endif
>> }
>> +
>> +void ff_format_set_url(AVFormatContext *s, char *url)
>> +{
>> + av_assert0(url);
>> + av_freep(&s->url);
>> + s->url = url;
>>
> mybe you should: s->url=av_strdup(url)
>
This is intentional, as the URL can be typically a result of av_sprintf or
av_bprintf buffer, so re-allocating it would be a waste. Also this way the
function can remain void because it always succeeds.
Regards,
Marton
More information about the ffmpeg-devel
mailing list