diff --git a/libavformat/isom.h b/libavformat/isom.h
index 542b76b..fde15c9 100644
|
a
|
b
|
typedef struct MOVStreamContext {
|
| 126 | 126 | int wrong_dts; ///< dts are wrong due to huge ctts offset (iMovie files) |
| 127 | 127 | int width; ///< tkhd width |
| 128 | 128 | int height; ///< tkhd height |
| | 129 | int display_width; ///< width to override display of video |
| | 130 | int display_height; ///< height to override display of video |
| 129 | 131 | int dts_shift; ///< dts shift when ctts is negative |
| 130 | 132 | uint32_t palette[256]; |
| 131 | 133 | int has_palette; |
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 222166e..360acf9 100644
|
a
|
b
|
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
| 2156 | 2156 | sc->time_scale, sc->stts_data[0].duration, INT_MAX); |
| 2157 | 2157 | } |
| 2158 | 2158 | |
| | 2159 | /* |
| | 2160 | If a display width / height are set we need to set a proper aspect |
| | 2161 | ratio as Quicktime uses this to force the size of the video. |
| | 2162 | */ |
| | 2163 | if (sc->display_width) |
| | 2164 | st->sample_aspect_ratio = av_d2q( |
| | 2165 | ((double) sc->display_width / sc->display_height) / |
| | 2166 | ((double) sc->width / sc->height), INT_MAX); |
| | 2167 | |
| 2159 | 2168 | switch (st->codec->codec_id) { |
| 2160 | 2169 | #if CONFIG_H261_DECODER |
| 2161 | 2170 | case CODEC_ID_H261: |
| … |
… |
static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
| 2592 | 2601 | return 0; |
| 2593 | 2602 | } |
| 2594 | 2603 | |
| | 2604 | static int mov_read_clef(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| | 2605 | { |
| | 2606 | /* |
| | 2607 | Track Clean Aperture Dimensions - overrides other dimensions and |
| | 2608 | aspect ratio information. |
| | 2609 | */ |
| | 2610 | unsigned int width; |
| | 2611 | unsigned int height; |
| | 2612 | AVStream *st; |
| | 2613 | MOVStreamContext *sc; |
| | 2614 | |
| | 2615 | avio_skip(pb, 2); /* flags */ |
| | 2616 | width = avio_rb32(pb); /* cleanApertureWidth */ |
| | 2617 | height = avio_rb32(pb); /* cleanApertureHeight */ |
| | 2618 | |
| | 2619 | av_log(c->fc, AV_LOG_DEBUG, "clef atom read, forcing size to %ux%u\n", |
| | 2620 | width, height); |
| | 2621 | |
| | 2622 | if (c->fc->nb_streams < 1) |
| | 2623 | return 0; |
| | 2624 | st = c->fc->streams[c->fc->nb_streams-1]; |
| | 2625 | sc = st->priv_data; |
| | 2626 | |
| | 2627 | sc->display_width = width; |
| | 2628 | sc->display_height = height; |
| | 2629 | |
| | 2630 | return 0; |
| | 2631 | } |
| | 2632 | |
| 2595 | 2633 | static const MOVParseTableEntry mov_default_parse_table[] = { |
| 2596 | 2634 | { MKTAG('A','P','R','G'), mov_read_aprg }, |
| 2597 | 2635 | { MKTAG('a','v','s','s'), mov_read_avss }, |
| … |
… |
static const MOVParseTableEntry mov_default_parse_table[] = {
|
| 2650 | 2688 | { MKTAG('c','m','o','v'), mov_read_cmov }, |
| 2651 | 2689 | { MKTAG('c','h','a','n'), mov_read_chan }, /* channel layout */ |
| 2652 | 2690 | { MKTAG('d','v','c','1'), mov_read_dvc1 }, |
| | 2691 | { MKTAG('t','a','p','t'), mov_read_default }, |
| | 2692 | { MKTAG('c','l','e','f'), mov_read_clef }, |
| 2653 | 2693 | { 0, NULL } |
| 2654 | 2694 | }; |
| 2655 | 2695 | |