[libav-stable] lxf: check the nb_streams instead of relying on padding

Reinhard Tartler siretart at gmail.com
Sun Jan 5 23:07:14 CET 2014


Hi Luca,

the patch below doesn't cleanly apply to releas/9. Can you have a look at it?

Reinhard

On Thu, Sep 26, 2013 at 7:33 PM, Luca Barbato <git at libav.org> wrote:
> Module: libav
> Branch: master
> Commit: 5c349ad08a9fa930ddd9339f5de83eb818a0994c
>
> Author:    Luca Barbato <lu_zero at gentoo.org>
> Committer: Luca Barbato <lu_zero at gentoo.org>
> Date:      Tue Jun 25 16:42:02 2013 +0200
>
> lxf: check the nb_streams instead of relying on padding
>
> Remove the now unneeded stream pointer while at it.
>
> Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC: libav-stable at libav.org
>
> ---
>
>  libavformat/lxfdec.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
> index cae954f..859fc71 100644
> --- a/libavformat/lxfdec.c
> +++ b/libavformat/lxfdec.c
> @@ -160,7 +160,7 @@ static int get_packet_header(AVFormatContext *s)
>          break;
>      case 1:
>          //audio
> -        if (!(st = s->streams[1])) {
> +        if (s->nb_streams < 2) {
>              av_log(s, AV_LOG_INFO, "got audio packet, but no audio stream present\n");
>              break;
>          }
> @@ -171,6 +171,8 @@ static int get_packet_header(AVFormatContext *s)
>          channels     = bytestream_get_le32(&p);
>          track_size   = bytestream_get_le32(&p);
>
> +        st = s->streams[1];
> +
>          //set codec based on specified audio bitdepth
>          //we only support tightly packed 16-, 20-, 24- and 32-bit PCM at the moment
>          st->codec->bits_per_coded_sample = (audio_format >> 6) & 0x3F;
> @@ -288,7 +290,6 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
>  {
>      LXFDemuxContext *lxf = s->priv_data;
>      AVIOContext   *pb  = s->pb;
> -    AVStream *ast = NULL;
>      uint32_t stream;
>      int ret, ret2;
>
> @@ -302,7 +303,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
>          return AVERROR(EAGAIN);
>      }
>
> -    if (stream == 1 && !(ast = s->streams[1])) {
> +    if (stream == 1 && s->nb_streams < 2) {
>          av_log(s, AV_LOG_ERROR, "got audio packet without having an audio stream\n");
>          return AVERROR_INVALIDDATA;
>      }
> @@ -317,7 +318,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
>
>      pkt->stream_index = stream;
>
> -    if (!ast) {
> +    if (!stream) {
>          //picture type (0 = closed I, 1 = open I, 2 = P, 3 = B)
>          if (((lxf->video_format >> 22) & 0x3) < 2)
>              pkt->flags |= AV_PKT_FLAG_KEY;
>
> _______________________________________________
> libav-stable mailing list
> libav-stable at libav.org
> https://lists.libav.org/mailman/listinfo/libav-stable



-- 
regards,
    Reinhard


More information about the libav-stable mailing list