Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: source/patched-ffmpeg-mt/libavformat/mov.c

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * MOV demuxer 2 * MOV demuxer
3 * Copyright (c) 2001 Fabrice Bellard 3 * Copyright (c) 2001 Fabrice Bellard
4 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot co m> 4 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot co m>
5 * 5 *
6 * This file is part of FFmpeg. 6 * This file is part of FFmpeg.
7 * 7 *
8 * FFmpeg is free software; you can redistribute it and/or 8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return AVERROR(ENOMEM); 340 return AVERROR(ENOMEM);
341 sc->drefs_count = entries; 341 sc->drefs_count = entries;
342 342
343 for (i = 0; i < sc->drefs_count; i++) { 343 for (i = 0; i < sc->drefs_count; i++) {
344 MOVDref *dref = &sc->drefs[i]; 344 MOVDref *dref = &sc->drefs[i];
345 uint32_t size = get_be32(pb); 345 uint32_t size = get_be32(pb);
346 int64_t next = url_ftell(pb) + size - 4; 346 int64_t next = url_ftell(pb) + size - 4;
347 if (size < 8) 347 if (size < 8)
348 return -1; 348 return -1;
349 349
350 if (size < 12)
351 return -1;
352
350 dref->type = get_le32(pb); 353 dref->type = get_le32(pb);
351 get_be32(pb); // version + flags 354 get_be32(pb); // version + flags
352 dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); 355 dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
353 356
354 if (dref->type == MKTAG('a','l','i','s') && size > 150) { 357 if (dref->type == MKTAG('a','l','i','s') && size > 150) {
355 /* macintosh alias record */ 358 /* macintosh alias record */
356 uint16_t volume_len, len; 359 uint16_t volume_len, len;
357 int16_t type; 360 int16_t type;
358 361
359 url_fskip(pb, 10); 362 url_fskip(pb, 10);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 557 }
555 } 558 }
556 return 0; 559 return 0;
557 } 560 }
558 561
559 static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom) 562 static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
560 { 563 {
561 return ff_mov_read_esds(c->fc, pb, atom); 564 return ff_mov_read_esds(c->fc, pb, atom);
562 } 565 }
563 566
567 static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
568 {
569 AVStream *st;
570 int ac3info, acmod, lfeon;
571
572 st = c->fc->streams[c->fc->nb_streams-1];
573
574 ac3info = get_be24(pb);
575 acmod = (ac3info >> 11) & 0x7;
576 lfeon = (ac3info >> 10) & 0x1;
577 st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
578
579 return 0;
580 }
581
564 static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) 582 static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
565 { 583 {
566 const int num = get_be32(pb); 584 const int num = get_be32(pb);
567 const int den = get_be32(pb); 585 const int den = get_be32(pb);
568 AVStream *st; 586 AVStream *st;
569 587
570 if (c->fc->nb_streams < 1) 588 if (c->fc->nb_streams < 1)
571 return 0; 589 return 0;
572 st = c->fc->streams[c->fc->nb_streams-1]; 590 st = c->fc->streams[c->fc->nb_streams-1];
573 591
574 if (den != 0) { 592 if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default
575 if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default 593 (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.nu m)) {
576 (den != st->sample_aspect_ratio.den || num != st->sample_aspect_rati o.num)) 594 av_log(c->fc, AV_LOG_WARNING,
577 av_log(c->fc, AV_LOG_WARNING, 595 "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom ( %d:%d)\n",
578 "sample aspect ratio already set to %d:%d, overriding by 'pas p' atom\n", 596 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
579 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); 597 num, den);
598 } else if (den != 0) {
580 st->sample_aspect_ratio.num = num; 599 st->sample_aspect_ratio.num = num;
581 st->sample_aspect_ratio.den = den; 600 st->sample_aspect_ratio.den = den;
582 } 601 }
583 return 0; 602 return 0;
584 } 603 }
585 604
586 /* this atom contains actual media data */ 605 /* this atom contains actual media data */
587 static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) 606 static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
588 { 607 {
589 if(atom.size == 0) /* wrong one (MP4) */ 608 if(atom.size == 0) /* wrong one (MP4) */
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */ 2259 { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */
2241 { MKTAG('t','r','a','k'), mov_read_trak }, 2260 { MKTAG('t','r','a','k'), mov_read_trak },
2242 { MKTAG('t','r','a','f'), mov_read_default }, 2261 { MKTAG('t','r','a','f'), mov_read_default },
2243 { MKTAG('t','r','e','f'), mov_read_default }, 2262 { MKTAG('t','r','e','f'), mov_read_default },
2244 { MKTAG('c','h','a','p'), mov_read_chap }, 2263 { MKTAG('c','h','a','p'), mov_read_chap },
2245 { MKTAG('t','r','e','x'), mov_read_trex }, 2264 { MKTAG('t','r','e','x'), mov_read_trex },
2246 { MKTAG('t','r','u','n'), mov_read_trun }, 2265 { MKTAG('t','r','u','n'), mov_read_trun },
2247 { MKTAG('u','d','t','a'), mov_read_default }, 2266 { MKTAG('u','d','t','a'), mov_read_default },
2248 { MKTAG('w','a','v','e'), mov_read_wave }, 2267 { MKTAG('w','a','v','e'), mov_read_wave },
2249 { MKTAG('e','s','d','s'), mov_read_esds }, 2268 { MKTAG('e','s','d','s'), mov_read_esds },
2269 { MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */
2250 { MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */ 2270 { MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
2251 { MKTAG('c','m','o','v'), mov_read_cmov }, 2271 { MKTAG('c','m','o','v'), mov_read_cmov },
2252 { 0, NULL } 2272 { 0, NULL }
2253 }; 2273 };
2254 2274
2255 static int mov_probe(AVProbeData *p) 2275 static int mov_probe(AVProbeData *p)
2256 { 2276 {
2257 unsigned int offset; 2277 unsigned int offset;
2258 uint32_t tag; 2278 uint32_t tag;
2259 int score = 0; 2279 int score = 0;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 AVInputFormat mov_demuxer = { 2611 AVInputFormat mov_demuxer = {
2592 "mov,mp4,m4a,3gp,3g2,mj2", 2612 "mov,mp4,m4a,3gp,3g2,mj2",
2593 NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"), 2613 NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"),
2594 sizeof(MOVContext), 2614 sizeof(MOVContext),
2595 mov_probe, 2615 mov_probe,
2596 mov_read_header, 2616 mov_read_header,
2597 mov_read_packet, 2617 mov_read_packet,
2598 mov_read_close, 2618 mov_read_close,
2599 mov_read_seek, 2619 mov_read_seek,
2600 }; 2620 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavformat/mmst.c ('k') | source/patched-ffmpeg-mt/libavformat/movenc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698