Mercurial > libavformat.hg
changeset 187:2fa5e94ba716 libavformat
add av_new_stream() usage
author | bellard |
---|---|
date | Fri, 08 Aug 2003 17:52:30 +0000 |
parents | 2265d21a04c8 |
children | 6c9d6422a2f6 |
files | au.c ffm.c swf.c |
diffstat | 3 files changed, 7 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/au.c Fri Aug 08 17:49:27 2003 +0000 +++ b/au.c Fri Aug 08 17:52:30 2003 +0000 @@ -140,16 +140,9 @@ } /* now we are ready: build format streams */ - st = av_malloc(sizeof(AVStream)); + st = av_new_stream(s, 0); if (!st) return -1; - avcodec_get_context_defaults(&st->codec); - - s->nb_streams = 1; - s->streams[0] = st; - - st->id = 0; - st->codec.codec_type = CODEC_TYPE_AUDIO; st->codec.codec_tag = id; st->codec.codec_id = codec;
--- a/ffm.c Fri Aug 08 17:49:27 2003 +0000 +++ b/ffm.c Fri Aug 08 17:52:30 2003 +0000 @@ -368,7 +368,7 @@ FFMStream *fst; ByteIOContext *pb = &s->pb; AVCodecContext *codec; - int i; + int i, nb_streams; uint32_t tag; /* header */ @@ -386,17 +386,15 @@ ffm->file_size = (uint64_t_C(1) << 63) - 1; } - s->nb_streams = get_be32(pb); + nb_streams = get_be32(pb); get_be32(pb); /* total bitrate */ /* read each stream */ - for(i=0;i<s->nb_streams;i++) { + for(i=0;i<nb_streams;i++) { char rc_eq_buf[128]; - st = av_mallocz(sizeof(AVStream)); + st = av_new_stream(s, 0); if (!st) goto fail; - avcodec_get_context_defaults(&st->codec); - s->streams[i] = st; fst = av_mallocz(sizeof(FFMStream)); if (!fst) goto fail; @@ -611,7 +609,7 @@ read(fd, buf, 8); pos = 0; for(i=0;i<8;i++) - pos |= buf[i] << (56 - i * 8); + pos |= (int64_t)buf[i] << (56 - i * 8); return pos; }
--- a/swf.c Fri Aug 08 17:49:27 2003 +0000 +++ b/swf.c Fri Aug 08 17:52:30 2003 +0000 @@ -481,17 +481,14 @@ get_le16(pb); /* if mp3 streaming found, OK */ if ((v & 0x20) != 0) { - st = av_mallocz(sizeof(AVStream)); + st = av_new_stream(s, 0); if (!st) return -ENOMEM; - avcodec_get_context_defaults(&st->codec); if (v & 0x01) st->codec.channels = 2; else st->codec.channels = 1; - s->nb_streams = 1; - s->streams[0] = st; switch((v>> 2) & 0x03) { case 1: