[FFmpeg-devel] [PATCH 4/7] avdevice: migrate to AVFormatContext->url

Michael Niedermayer michael at niedermayer.cc
Mon Jan 15 00:13:55 EET 2018


On Sat, Jan 06, 2018 at 09:50:29PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavdevice/alsa.c              |  4 ++--
>  libavdevice/avfoundation.m      |  2 +-
>  libavdevice/bktr.c              |  2 +-
>  libavdevice/caca.c              |  2 +-
>  libavdevice/decklink_common.cpp |  2 +-
>  libavdevice/decklink_dec.cpp    |  4 ++--
>  libavdevice/decklink_enc.cpp    |  4 ++--
>  libavdevice/dshow.c             |  2 +-
>  libavdevice/fbdev_dec.c         |  4 ++--
>  libavdevice/fbdev_enc.c         |  4 ++--
>  libavdevice/gdigrab.c           |  2 +-
>  libavdevice/iec61883.c          |  8 ++++----
>  libavdevice/jack.c              |  6 +++---
>  libavdevice/lavfi.c             |  2 +-
>  libavdevice/libcdio.c           |  6 +++---
>  libavdevice/libndi_newtek_dec.c |  2 +-
>  libavdevice/libndi_newtek_enc.c |  4 ++--
>  libavdevice/openal-dec.c        |  2 +-
>  libavdevice/opengl_enc.c        |  2 +-
>  libavdevice/oss_dec.c           |  2 +-
>  libavdevice/oss_enc.c           |  2 +-
>  libavdevice/pulse_audio_dec.c   |  4 ++--
>  libavdevice/pulse_audio_enc.c   |  4 ++--
>  libavdevice/sdl2.c              |  2 +-
>  libavdevice/sndio_dec.c         |  2 +-
>  libavdevice/sndio_enc.c         |  2 +-
>  libavdevice/v4l2.c              | 16 +++++++++-------
>  libavdevice/v4l2enc.c           |  4 ++--
>  libavdevice/vfwcap.c            |  4 ++--
>  libavdevice/xcbgrab.c           |  8 ++++----
>  libavdevice/xv.c                |  2 +-
>  31 files changed, 59 insertions(+), 57 deletions(-)
[...]

> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -939,7 +939,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
>          cctx->raw_format = MKBETAG('v','2','1','0');
>      }
>  
> -    strcpy (fname, avctx->filename);
> +    av_strlcpy(fname, avctx->url, sizeof(fname));

This could truncate the url

[...]
> @@ -1042,11 +1042,13 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l
>          return ret;
>      }
>      while ((entry = readdir(dir))) {
> +        char device_name[256];
> +
>          if (!v4l2_is_v4l_dev(entry->d_name))
>              continue;
>  
> -        snprintf(ctx->filename, sizeof(ctx->filename), "/dev/%s", entry->d_name);
> -        if ((s->fd = device_open(ctx)) < 0)
> +        snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);

This too could truncate the device name in theory

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

No great genius has ever existed without some touch of madness. -- 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/20180114/e6840220/attachment.sig>


More information about the ffmpeg-devel mailing list