Mercurial > libavformat.hg
comparison mov.c @ 4202:baf5439883f1 libavformat
Use the dimensions in tkhd for timed text tracks
author | conrad |
---|---|
date | Sun, 11 Jan 2009 23:24:28 +0000 |
parents | 7d2f3f1b68d8 |
children | c3102b189cb6 |
comparison
equal
deleted
inserted
replaced
4201:7d2f3f1b68d8 | 4202:baf5439883f1 |
---|---|
133 int16_t audio_cid; ///< stsd audio compression id | 133 int16_t audio_cid; ///< stsd audio compression id |
134 unsigned drefs_count; | 134 unsigned drefs_count; |
135 MOVDref *drefs; | 135 MOVDref *drefs; |
136 int dref_id; | 136 int dref_id; |
137 int wrong_dts; ///< dts are wrong due to negative ctts | 137 int wrong_dts; ///< dts are wrong due to negative ctts |
138 int width; ///< tkhd width | |
139 int height; ///< tkhd height | |
138 } MOVStreamContext; | 140 } MOVStreamContext; |
139 | 141 |
140 typedef struct MOVContext { | 142 typedef struct MOVContext { |
141 AVFormatContext *fc; | 143 AVFormatContext *fc; |
142 int time_scale; | 144 int time_scale; |
981 // ttxt stsd contains display flags, justification, background | 983 // ttxt stsd contains display flags, justification, background |
982 // color, fonts, and default styles, so fake an atom to read it | 984 // color, fonts, and default styles, so fake an atom to read it |
983 MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) }; | 985 MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) }; |
984 mov_read_glbl(c, pb, fake_atom); | 986 mov_read_glbl(c, pb, fake_atom); |
985 st->codec->codec_id= id; | 987 st->codec->codec_id= id; |
988 st->codec->width = sc->width; | |
989 st->codec->height = sc->height; | |
986 } else { | 990 } else { |
987 /* other codec type, just skip (rtp, mp4s, tmcd ...) */ | 991 /* other codec type, just skip (rtp, mp4s, tmcd ...) */ |
988 url_fskip(pb, size - (url_ftell(pb) - start_pos)); | 992 url_fskip(pb, size - (url_ftell(pb) - start_pos)); |
989 } | 993 } |
990 /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ | 994 /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ |
1470 int width; | 1474 int width; |
1471 int height; | 1475 int height; |
1472 int64_t disp_transform[2]; | 1476 int64_t disp_transform[2]; |
1473 int display_matrix[3][2]; | 1477 int display_matrix[3][2]; |
1474 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 1478 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
1479 MOVStreamContext *sc = st->priv_data; | |
1475 int version = get_byte(pb); | 1480 int version = get_byte(pb); |
1476 | 1481 |
1477 get_be24(pb); /* flags */ | 1482 get_be24(pb); /* flags */ |
1478 /* | 1483 /* |
1479 MOV_TRACK_ENABLED 0x0001 | 1484 MOV_TRACK_ENABLED 0x0001 |
1511 get_be32(pb); // 2.30 fixed point (not used) | 1516 get_be32(pb); // 2.30 fixed point (not used) |
1512 } | 1517 } |
1513 | 1518 |
1514 width = get_be32(pb); // 16.16 fixed point track width | 1519 width = get_be32(pb); // 16.16 fixed point track width |
1515 height = get_be32(pb); // 16.16 fixed point track height | 1520 height = get_be32(pb); // 16.16 fixed point track height |
1521 sc->width = width >> 16; | |
1522 sc->height = height >> 16; | |
1516 | 1523 |
1517 //transform the display width/height according to the matrix | 1524 //transform the display width/height according to the matrix |
1518 // skip this if the display matrix is the default identity matrix | 1525 // skip this if the display matrix is the default identity matrix |
1519 // to keep the same scale, use [width height 1<<16] | 1526 // to keep the same scale, use [width height 1<<16] |
1520 if (width && height && | 1527 if (width && height && |