OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 David Conrad | 2 * Copyright (C) 2008 David Conrad |
3 * | 3 * |
4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
5 * | 5 * |
6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 29 matching lines...) Expand all Loading... |
40 return -1; | 40 return -1; |
41 | 41 |
42 st->codec->codec_type = CODEC_TYPE_VIDEO; | 42 st->codec->codec_type = CODEC_TYPE_VIDEO; |
43 st->codec->codec_id = CODEC_ID_DIRAC; | 43 st->codec->codec_id = CODEC_ID_DIRAC; |
44 // dirac in ogg always stores timestamps as though the video were interlaced | 44 // dirac in ogg always stores timestamps as though the video were interlaced |
45 st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_bas
e.den}; | 45 st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_bas
e.den}; |
46 return 1; | 46 return 1; |
47 } | 47 } |
48 | 48 |
49 // various undocument things: granule is signed (only for dirac!) | 49 // various undocument things: granule is signed (only for dirac!) |
50 static uint64_t dirac_gptopts(AVFormatContext *s, int idx, int64_t gp, | 50 static uint64_t dirac_gptopts(AVFormatContext *s, int idx, uint64_t granule, |
51 int64_t *dts_out) | 51 int64_t *dts_out) |
52 { | 52 { |
| 53 int64_t gp = granule; |
53 struct ogg *ogg = s->priv_data; | 54 struct ogg *ogg = s->priv_data; |
54 struct ogg_stream *os = ogg->streams + idx; | 55 struct ogg_stream *os = ogg->streams + idx; |
55 | 56 |
56 unsigned dist = ((gp >> 14) & 0xff00) | (gp & 0xff); | 57 unsigned dist = ((gp >> 14) & 0xff00) | (gp & 0xff); |
57 int64_t dts = (gp >> 31); | 58 int64_t dts = (gp >> 31); |
58 int64_t pts = dts + ((gp >> 9) & 0x1fff); | 59 int64_t pts = dts + ((gp >> 9) & 0x1fff); |
59 | 60 |
60 if (!dist) | 61 if (!dist) |
61 os->pflags |= PKT_FLAG_KEY; | 62 os->pflags |= PKT_FLAG_KEY; |
62 | 63 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 .granule_is_start = 1, | 106 .granule_is_start = 1, |
106 }; | 107 }; |
107 | 108 |
108 const struct ogg_codec ff_old_dirac_codec = { | 109 const struct ogg_codec ff_old_dirac_codec = { |
109 .magic = "KW-DIRAC", | 110 .magic = "KW-DIRAC", |
110 .magicsize = 8, | 111 .magicsize = 8, |
111 .header = old_dirac_header, | 112 .header = old_dirac_header, |
112 .gptopts = old_dirac_gptopts, | 113 .gptopts = old_dirac_gptopts, |
113 .granule_is_start = 1, | 114 .granule_is_start = 1, |
114 }; | 115 }; |
OLD | NEW |