[FFmpeg-devel] [PATCH 6/7] avformat: migrate to AVFormatContext->url

Michael Niedermayer michael at niedermayer.cc
Mon Jan 15 02:36:28 EET 2018


On Sun, Jan 14, 2018 at 11:34:03PM +0100, Marton Balint wrote:
> 
> On Sun, 14 Jan 2018, Michael Niedermayer wrote:
> 
> >On Sat, Jan 06, 2018 at 09:50:31PM +0100, Marton Balint wrote:
> >>Signed-off-by: Marton Balint <cus at passwd.hu>
> >>---
> >> libavformat/concatdec.c          |  4 ++--
> >> libavformat/dashenc.c            | 16 ++++++++--------
> >> libavformat/fifo.c               |  8 ++++----
> >> libavformat/flvenc.c             |  4 ++--
> >> libavformat/gxfenc.c             |  4 ++--
> >> libavformat/hdsenc.c             | 24 ++++++++++++------------
> >> libavformat/img2dec.c            |  4 ++--
> >> libavformat/img2enc.c            |  4 ++--
> >> libavformat/matroskadec.c        |  4 ++--
> >> libavformat/mlvdec.c             |  4 ++--
> >> libavformat/mov.c                |  2 +-
> >> libavformat/movenc.c             | 10 +++++-----
> >> libavformat/mpeg.c               |  4 ++--
> >> libavformat/mpegtsenc.c          |  2 +-
> >> libavformat/options.c            |  2 +-
> >> libavformat/rtsp.c               | 18 ++++++++++++------
> >> libavformat/rtspdec.c            |  4 ++--
> >> libavformat/rtspenc.c            |  4 +++-
> >> libavformat/sapdec.c             |  2 +-
> >> libavformat/sapenc.c             | 10 ++++++++--
> >> libavformat/sdp.c                |  4 ++--
> >> libavformat/segment.c            | 36 +++++++++++++++++++++---------------
> >> libavformat/smoothstreamingenc.c | 12 ++++++------
> >> libavformat/tee.c                |  4 ++--
> >> libavformat/utils.c              |  2 +-
> >> libavformat/webm_chunk.c         | 10 +++++-----
> >> 26 files changed, 111 insertions(+), 91 deletions(-)
> >>
> >>diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> >>index bd5174ada2..178fac86cb 100644
> >>--- a/libavformat/concatdec.c
> >>+++ b/libavformat/concatdec.c
> >>@@ -126,10 +126,10 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
> >>         url = filename;
> >>         filename = NULL;
> >>     } else {
> >>-        url_len = strlen(avf->filename) + strlen(filename) + 16;
> >>+        url_len = strlen(avf->url) + strlen(filename) + 16;
> >>         if (!(url = av_malloc(url_len)))
> >>             FAIL(AVERROR(ENOMEM));
> >>-        ff_make_absolute_url(url, url_len, avf->filename, filename);
> >>+        ff_make_absolute_url(url, url_len, avf->url, filename);
> >>         av_freep(&filename);
> >>     }
> >>
> >>diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> >>index 3345b89118..59c55cc8b7 100644
> >>--- a/libavformat/dashenc.c
> >>+++ b/libavformat/dashenc.c
> >>@@ -685,7 +685,7 @@ static int write_manifest(AVFormatContext *s, int final)
> >>     AVIOContext *out;
> >>     char temp_filename[1024];
> >>     int ret, i;
> >>-    const char *proto = avio_find_protocol_name(s->filename);
> >>+    const char *proto = avio_find_protocol_name(s->url);
> >>     int use_rename = proto && !strcmp(proto, "file");
> >>     static unsigned int warned_non_file = 0;
> >>     AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
> >>@@ -694,7 +694,7 @@ static int write_manifest(AVFormatContext *s, int final)
> >>     if (!use_rename && !warned_non_file++)
> >>         av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n");
> >>
> >>-    snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename);
> >>+    snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->url);
> >
> >could be truncated, the same applies to other cases
> 
> We already did silent truncations in the past, so I think this is not
> worse than before.
> 
> Fixing the fixed length buffers all around the codebase is a lot of work and
> it is easy to make mistakes. So these can be fixed later by the relevant
> maintainers, or this can be a candiate for a janitor task.

iam fine if its fixed in seperate commits or by others but someone should fix
these.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180115/e4d022cf/attachment.sig>


More information about the ffmpeg-devel mailing list