Mercurial > libavformat.hg
diff asf.c @ 188:6c9d6422a2f6 libavformat
update duration and start_time - add av_new_stream() usage
| author | bellard |
|---|---|
| date | Fri, 08 Aug 2003 17:52:53 +0000 |
| parents | 6b74809d2496 |
| children | 01bec1059bdf |
line wrap: on
line diff
--- a/asf.c Fri Aug 08 17:52:30 2003 +0000 +++ b/asf.c Fri Aug 08 17:52:53 2003 +0000 @@ -48,7 +48,7 @@ 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 @@ 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 @@ 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;
