Commit 9afb7061 authored by Samuel Pitoiset's avatar Samuel Pitoiset Committed by Martin Storsjö
Browse files

mov_chan: Pass a separate AVIOContext for reading

This fixes crashes when called from rtpdec_qt, where
AVFormatContext->pb is null, a crash present since 3bab7cd1

.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 91a84a52
...@@ -268,7 +268,7 @@ static int read_header(AVFormatContext *s) ...@@ -268,7 +268,7 @@ static int read_header(AVFormatContext *s)
break; break;
case MKBETAG('c','h','a','n'): case MKBETAG('c','h','a','n'):
if ((ret = ff_mov_read_chan(s, st, size)) < 0) if ((ret = ff_mov_read_chan(s, s->pb, st, size)) < 0)
return ret; return ret;
break; break;
......
...@@ -583,7 +583,7 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -583,7 +583,7 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 16) if (atom.size < 16)
return 0; return 0;
ff_mov_read_chan(c->fc, st, atom.size - 4); ff_mov_read_chan(c->fc, pb, st, atom.size - 4);
return 0; return 0;
} }
......
...@@ -543,9 +543,9 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, ...@@ -543,9 +543,9 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
return tag; return tag;
} }
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size) int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
int64_t size)
{ {
AVIOContext *pb = s->pb;
uint32_t layout_tag, bitmap, num_descr, label_mask; uint32_t layout_tag, bitmap, num_descr, label_mask;
int i; int i;
......
...@@ -57,10 +57,12 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, ...@@ -57,10 +57,12 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
* Read 'chan' tag from the input stream. * Read 'chan' tag from the input stream.
* *
* @param s AVFormatContext * @param s AVFormatContext
* @param pb AVIOContext
* @param st The stream to set codec values for * @param st The stream to set codec values for
* @param size Remaining size in the 'chan' tag * @param size Remaining size in the 'chan' tag
* @return 0 if ok, or negative AVERROR code on failure * @return 0 if ok, or negative AVERROR code on failure
*/ */
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size); int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
int64_t size);
#endif /* AVFORMAT_MOV_CHAN_H */ #endif /* AVFORMAT_MOV_CHAN_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment