diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2003-08-08 17:52:53 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2003-08-08 17:52:53 +0000 |
commit | 247eadca9d3158b91d500af27065d68aef7c9347 (patch) | |
tree | c951ea1a3a6a711d6227d6ae2aeee3174541bd26 /libavformat/asf.c | |
parent | fa26a29d6508e71e52abc6d71ee37279b837de37 (diff) | |
download | ffmpeg-247eadca9d3158b91d500af27065d68aef7c9347.tar.gz |
update duration and start_time - add av_new_stream() usage
Originally committed as revision 2110 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asf.c')
-rw-r--r-- | libavformat/asf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c index 602c3ef0f4..1712f8f22d 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -48,7 +48,7 @@ typedef struct { uint8_t v4[8]; } GUID; -typedef struct __attribute__((packed)) { +typedef struct { GUID guid; // generated by client computer uint64_t file_size; // in bytes // invalid if broadcasting @@ -811,16 +811,16 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) pos1 = url_ftell(pb); - st = av_mallocz(sizeof(AVStream)); + st = av_new_stream(s, 0); if (!st) goto fail; - avcodec_get_context_defaults(&st->codec); - s->streams[s->nb_streams] = st; asf_st = av_mallocz(sizeof(ASFStream)); if (!asf_st) goto fail; st->priv_data = asf_st; - st->time_length = (asf->hdr.send_time - asf->hdr.preroll) / 10; // us + st->start_time = asf->hdr.preroll / (10000000 / AV_TIME_BASE); + st->duration = (asf->hdr.send_time - asf->hdr.preroll) / + (10000000 / AV_TIME_BASE); get_guid(pb, &g); if (!memcmp(&g, &audio_stream, sizeof(GUID))) { type = CODEC_TYPE_AUDIO; @@ -835,7 +835,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) get_le32(pb); st->id = get_le16(pb) & 0x7f; /* stream id */ // mapping of asf ID to AV stream ID; - asf->asfid2avid[st->id] = s->nb_streams++; + asf->asfid2avid[st->id] = s->nb_streams - 1; get_le32(pb); st->codec.codec_type = type; |