[FFmpeg-devel] [PATCH] lavf: replace remaining use of deprecated get_strz()

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 23 19:36:54 CET 2012


On Mon, Jan 23, 2012 at 05:46:15PM +0000, Paul B Mahol wrote:
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavformat/ffmdec.c |    3 ++-
>  libavformat/mov.c    |    2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
> index 2b7ae7e..6d01eec 100644
> --- a/libavformat/ffmdec.c
> +++ b/libavformat/ffmdec.c
> @@ -325,7 +325,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
>              codec->qcompress = avio_rb16(pb) / 10000.0;
>              codec->qblur = avio_rb16(pb) / 10000.0;
>              codec->bit_rate_tolerance = avio_rb32(pb);
> -            codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
> +            avio_get_str(pb, sizeof(rc_eq_buf), rc_eq_buf, sizeof(rc_eq_buf));
> +            codec->rc_eq = av_strdup(rc_eq_buf);
>              codec->rc_max_rate = avio_rb32(pb);
>              codec->rc_min_rate = avio_rb32(pb);
>              codec->rc_buffer_size = avio_rb32(pb);
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 3bb42fe..cb747b2 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2619,7 +2619,7 @@ static void mov_read_chapters(AVFormatContext *s)
>                  if (len == 1 || len == 2)
>                      title[len] = 0;
>                  else
> -                    get_strz(sc->pb, title + 2, len - 1);
> +                    avio_get_str(sc->pb, len, title + 2, len - 1);
>              }
>          }

As in my other mail on the subject, these don't do the same
when the strings in the file are longer than we expected.
With the old code the files would at least still play in that
case, with the new code they won't.
This kind of thing is why I was very much opposed to the deprecation,
I expect many people to not really understand avio_get_str and how
to use it.


More information about the ffmpeg-devel mailing list