Mercurial > libavformat.hg
comparison mov.c @ 2006:2f0154760e5f libavformat
Get rid of unnecessary pointer casts.
patch by Nicholas Tung, ntung ntung com
author | diego |
---|---|
date | Sun, 08 Apr 2007 20:24:16 +0000 |
parents | 1a3c9056982a |
children | a3e79d6e4e3c |
comparison
equal
deleted
inserted
replaced
2005:fb04036147f8 | 2006:2f0154760e5f |
---|---|
359 } | 359 } |
360 | 360 |
361 static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 361 static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
362 { | 362 { |
363 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 363 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
364 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 364 MOVStreamContext *sc = st->priv_data; |
365 int tag, len; | 365 int tag, len; |
366 | 366 |
367 /* Well, broken but suffisant for some MP4 streams */ | 367 /* Well, broken but suffisant for some MP4 streams */ |
368 get_be32(pb); /* version + flags */ | 368 get_be32(pb); /* version + flags */ |
369 len = mov_mp4_read_descr(c, pb, &tag); | 369 len = mov_mp4_read_descr(c, pb, &tag); |
445 | 445 |
446 | 446 |
447 static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 447 static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
448 { | 448 { |
449 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 449 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
450 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 450 MOVStreamContext *sc = st->priv_data; |
451 int version = get_byte(pb); | 451 int version = get_byte(pb); |
452 int lang; | 452 int lang; |
453 | 453 |
454 if (version > 1) | 454 if (version > 1) |
455 return 1; /* unsupported */ | 455 return 1; /* unsupported */ |
616 } | 616 } |
617 | 617 |
618 static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 618 static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
619 { | 619 { |
620 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 620 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
621 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 621 MOVStreamContext *sc = st->priv_data; |
622 unsigned int i, entries; | 622 unsigned int i, entries; |
623 | 623 |
624 get_byte(pb); /* version */ | 624 get_byte(pb); /* version */ |
625 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 625 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
626 | 626 |
648 } | 648 } |
649 | 649 |
650 static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 650 static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
651 { | 651 { |
652 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 652 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
653 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 653 MOVStreamContext *sc = st->priv_data; |
654 int entries, frames_per_sample; | 654 int entries, frames_per_sample; |
655 uint32_t format; | 655 uint32_t format; |
656 uint8_t codec_name[32]; | 656 uint8_t codec_name[32]; |
657 | 657 |
658 /* for palette traversal */ | 658 /* for palette traversal */ |
937 } | 937 } |
938 | 938 |
939 static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 939 static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
940 { | 940 { |
941 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 941 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
942 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 942 MOVStreamContext *sc = st->priv_data; |
943 unsigned int i, entries; | 943 unsigned int i, entries; |
944 | 944 |
945 get_byte(pb); /* version */ | 945 get_byte(pb); /* version */ |
946 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 946 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
947 | 947 |
966 } | 966 } |
967 | 967 |
968 static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 968 static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
969 { | 969 { |
970 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 970 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
971 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 971 MOVStreamContext *sc = st->priv_data; |
972 unsigned int i, entries; | 972 unsigned int i, entries; |
973 | 973 |
974 get_byte(pb); /* version */ | 974 get_byte(pb); /* version */ |
975 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 975 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
976 | 976 |
996 } | 996 } |
997 | 997 |
998 static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 998 static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
999 { | 999 { |
1000 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 1000 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
1001 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 1001 MOVStreamContext *sc = st->priv_data; |
1002 unsigned int i, entries, sample_size; | 1002 unsigned int i, entries, sample_size; |
1003 | 1003 |
1004 get_byte(pb); /* version */ | 1004 get_byte(pb); /* version */ |
1005 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 1005 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
1006 | 1006 |
1031 } | 1031 } |
1032 | 1032 |
1033 static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 1033 static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
1034 { | 1034 { |
1035 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 1035 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
1036 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 1036 MOVStreamContext *sc = st->priv_data; |
1037 unsigned int i, entries; | 1037 unsigned int i, entries; |
1038 int64_t duration=0; | 1038 int64_t duration=0; |
1039 int64_t total_sample_count=0; | 1039 int64_t total_sample_count=0; |
1040 | 1040 |
1041 get_byte(pb); /* version */ | 1041 get_byte(pb); /* version */ |
1077 } | 1077 } |
1078 | 1078 |
1079 static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 1079 static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
1080 { | 1080 { |
1081 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 1081 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
1082 MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; | 1082 MOVStreamContext *sc = st->priv_data; |
1083 unsigned int i, entries; | 1083 unsigned int i, entries; |
1084 | 1084 |
1085 get_byte(pb); /* version */ | 1085 get_byte(pb); /* version */ |
1086 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 1086 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
1087 entries = get_be32(pb); | 1087 entries = get_be32(pb); |
1469 sc->sample_count = st->nb_index_entries; | 1469 sc->sample_count = st->nb_index_entries; |
1470 } | 1470 } |
1471 | 1471 |
1472 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) | 1472 static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) |
1473 { | 1473 { |
1474 MOVContext *mov = (MOVContext *) s->priv_data; | 1474 MOVContext *mov = s->priv_data; |
1475 ByteIOContext *pb = &s->pb; | 1475 ByteIOContext *pb = &s->pb; |
1476 int i, err; | 1476 int i, err; |
1477 MOV_atom_t atom = { 0, 0, 0 }; | 1477 MOV_atom_t atom = { 0, 0, 0 }; |
1478 | 1478 |
1479 mov->fc = s; | 1479 mov->fc = s; |
1662 } | 1662 } |
1663 | 1663 |
1664 static int mov_read_close(AVFormatContext *s) | 1664 static int mov_read_close(AVFormatContext *s) |
1665 { | 1665 { |
1666 int i; | 1666 int i; |
1667 MOVContext *mov = (MOVContext *) s->priv_data; | 1667 MOVContext *mov = s->priv_data; |
1668 for(i=0; i<mov->total_streams; i++) | 1668 for(i=0; i<mov->total_streams; i++) |
1669 mov_free_stream_context(mov->streams[i]); | 1669 mov_free_stream_context(mov->streams[i]); |
1670 /* free color tabs */ | 1670 /* free color tabs */ |
1671 for(i=0; i<mov->ctab_size; i++) | 1671 for(i=0; i<mov->ctab_size; i++) |
1672 av_freep(&mov->ctab[i]); | 1672 av_freep(&mov->ctab[i]); |