diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2003-08-08 17:52:30 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2003-08-08 17:52:30 +0000 |
commit | fa26a29d6508e71e52abc6d71ee37279b837de37 (patch) | |
tree | b6494397fbc0b6d295321c690648ece3c2879851 /libavformat | |
parent | ee404803190c6c3827244219ec5f2519786fa885 (diff) | |
download | ffmpeg-fa26a29d6508e71e52abc6d71ee37279b837de37.tar.gz |
add av_new_stream() usage
Originally committed as revision 2109 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/au.c | 9 | ||||
-rw-r--r-- | libavformat/ffm.c | 12 | ||||
-rw-r--r-- | libavformat/swf.c | 5 |
3 files changed, 7 insertions, 19 deletions
diff --git a/libavformat/au.c b/libavformat/au.c index 50f22a8c9a..4a8353c444 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -140,16 +140,9 @@ static int au_read_header(AVFormatContext *s, } /* 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; diff --git a/libavformat/ffm.c b/libavformat/ffm.c index de2ea6bef1..7eb3ca4e88 100644 --- a/libavformat/ffm.c +++ b/libavformat/ffm.c @@ -368,7 +368,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) FFMStream *fst; ByteIOContext *pb = &s->pb; AVCodecContext *codec; - int i; + int i, nb_streams; uint32_t tag; /* header */ @@ -386,17 +386,15 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) 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 @@ offset_t ffm_read_write_index(int fd) 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; } diff --git a/libavformat/swf.c b/libavformat/swf.c index 60d931e2bf..2e2201f960 100644 --- a/libavformat/swf.c +++ b/libavformat/swf.c @@ -481,17 +481,14 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) 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: |