Message ID | 1319227281-44404-1-git-send-email-martin@martin.st |
---|---|
State | Superseded |
Headers | show |
On 10/21/11 1:01 PM, Martin Storsjö wrote:
> From: Reimar Döffinger<Reimar.Doeffinger@gmx.de>
It does assume that only video would have keyframes and if there isn't
video it wouldn't be possible to have a valid index.
I guess it might be nicer to have a way to support external indexes,
surely passing null to av_add_index_entry isn't nice...
lu
On Fri, 21 Oct 2011, Luca Barbato wrote: > On 10/21/11 1:01 PM, Martin Storsjö wrote: >> From: Reimar Döffinger<Reimar.Doeffinger@gmx.de> > > It does assume that only video would have > keyframes and if there isn't > video it wouldn't be possible to have a valid > index. > > I guess it might be nicer to have a way to support > external indexes, > surely passing null to av_add_index_entry isn't > nice... So would it be better like this then? if ((vstream || astream) && other conditions) parse_keyframes(vstream ? vstream : astream, ...); That would add the index entries to astream if there isn't any vstream, and doesn't crash if neither of them exist. // Martin
On 10/21/11 2:13 PM, Martin Storsjö wrote: > On Fri, 21 Oct 2011, Luca Barbato wrote: > >> On 10/21/11 1:01 PM, Martin Storsjö wrote: >>> From: Reimar Döffinger<Reimar.Doeffinger@gmx.de> >> >> It does assume that only video would have keyframes and if there isn't >> video it wouldn't be possible to have a valid index. >> >> I guess it might be nicer to have a way to support external indexes, >> surely passing null to av_add_index_entry isn't nice... > > So would it be better like this then? > > if ((vstream || astream) && other conditions) > parse_keyframes(vstream ? vstream : astream, ...); > > That would add the index entries to astream if there isn't any vstream, > and doesn't crash if neither of them exist. Seems better to me. Thank you lu
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 395c8f8..6647f0c 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -239,7 +239,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; - if (key && !strcmp(KEYFRAMES_TAG, key) && depth == 1) + if (vstream && key && !strcmp(KEYFRAMES_TAG, key) && depth == 1) if (parse_keyframes_index(s, ioc, vstream, max_pos) < 0) return -1;
From: Reimar Döffinger <Reimar.Doeffinger@gmx.de> --- libavformat/flvdec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)