[vlc-devel] [PATCH v2 1/1] avformat: replace deprecated field in AVFormatContext

Marvin Scholz epirat07 at gmail.com
Wed Apr 8 20:40:26 CEST 2020



On 8 Apr 2020, at 20:33, Mehdi Sabwat wrote:

> From: Mehdi Sabwat <mehdisabwat at gmail.com>
>
> Since Jan 21, 2018 (ea3672b7d67c432724bdbc8de0221f869b6a04c6)
> filename field was deprecated in favor of `url` which now has
> no length restrictions.
>
> ```
> 2018-01-28 - ea3672b7d6 - lavf 58.7.100 - avformat.h
>   Deprecate AVFormatContext filename field which had limited length, 
> use the
>   new dynamically allocated url field instead.
> ```
> ---
>  modules/demux/avformat/mux.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/modules/demux/avformat/mux.c 
> b/modules/demux/avformat/mux.c
> index 9179daf592..35ffb4c517 100644
> --- a/modules/demux/avformat/mux.c
> +++ b/modules/demux/avformat/mux.c
> @@ -90,8 +90,10 @@ int avformat_OpenMux( vlc_object_t *p_this )
>      sout_mux_t *p_mux = (sout_mux_t*)p_this;
>      bool dummy = !strcmp( p_mux->p_access->psz_access, "dummy");
>
> +#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 7, 100))
>      if( dummy && strlen(p_mux->p_access->psz_path)
>                                >= sizeof (((AVFormatContext 
> *)NULL)->filename) )
> +#endif
>          return VLC_EGENERIC;
>

This will unconditionally return VLC_EGENERIC with the older versions,
probably not what you intended to do.

>      msg_Dbg( p_mux, "using %s %s", AVPROVIDER(LIBAVFORMAT), 
> LIBAVFORMAT_IDENT );
> @@ -127,7 +129,11 @@ int avformat_OpenMux( vlc_object_t *p_this )
>      p_sys->oc->oformat = file_oformat;
>      /* If we use dummy access, let avformat write output */
>      if( dummy )
> +#if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 7, 100))
> +        p_sys->oc->url = av_strdup(p_mux->p_access->psz_path);
> +#else
>          strcpy( p_sys->oc->filename, p_mux->p_access->psz_path );
> +#endif

This does not seem to check libav properly, just ffmpeg?

>
>      /* Create I/O wrapper */
>      p_sys->io_buffer_size = 10 * 1024 * 1024;  /* FIXME */
> -- 
> 2.25.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list