1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  lxf: check the nb_streams instead of relying on padding

Conflicts:
	libavformat/lxfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-09-27 13:27:31 +02:00
commit d8d235ffe9

View File

@ -161,7 +161,7 @@ static int get_packet_header(AVFormatContext *s)
break; break;
case 1: case 1:
//audio //audio
if (!s->streams || !(st = s->streams[1])) { if (s->nb_streams < 2) {
av_log(s, AV_LOG_INFO, "got audio packet, but no audio stream present\n"); av_log(s, AV_LOG_INFO, "got audio packet, but no audio stream present\n");
break; break;
} }
@ -172,6 +172,8 @@ static int get_packet_header(AVFormatContext *s)
channels = bytestream_get_le32(&p); channels = bytestream_get_le32(&p);
track_size = bytestream_get_le32(&p); track_size = bytestream_get_le32(&p);
st = s->streams[1];
//set codec based on specified audio bitdepth //set codec based on specified audio bitdepth
//we only support tightly packed 16-, 20-, 24- and 32-bit PCM at the moment //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; st->codec->bits_per_coded_sample = (audio_format >> 6) & 0x3F;
@ -290,7 +292,6 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
LXFDemuxContext *lxf = s->priv_data; LXFDemuxContext *lxf = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *ast = NULL;
uint32_t stream; uint32_t stream;
int ret, ret2; int ret, ret2;
@ -304,7 +305,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EAGAIN); 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"); av_log(s, AV_LOG_ERROR, "got audio packet without having an audio stream\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -319,7 +320,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = stream; pkt->stream_index = stream;
if (!ast) { if (!stream) {
//picture type (0 = closed I, 1 = open I, 2 = P, 3 = B) //picture type (0 = closed I, 1 = open I, 2 = P, 3 = B)
if (((lxf->video_format >> 22) & 0x3) < 2) if (((lxf->video_format >> 22) & 0x3) < 2)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;