OLD | NEW |
1 /** | 1 /** |
2 Copyright (C) 2005 Matthieu CASTET, Alex Beregszaszi | 2 Copyright (C) 2005 Matthieu CASTET, Alex Beregszaszi |
3 | 3 |
4 Permission is hereby granted, free of charge, to any person | 4 Permission is hereby granted, free of charge, to any person |
5 obtaining a copy of this software and associated documentation | 5 obtaining a copy of this software and associated documentation |
6 files (the "Software"), to deal in the Software without | 6 files (the "Software"), to deal in the Software without |
7 restriction, including without limitation the rights to use, copy, | 7 restriction, including without limitation the rights to use, copy, |
8 modify, merge, publish, distribute, sublicense, and/or sell copies | 8 modify, merge, publish, distribute, sublicense, and/or sell copies |
9 of the Software, and to permit persons to whom the Software is | 9 of the Software, and to permit persons to whom the Software is |
10 furnished to do so, subject to the following conditions: | 10 furnished to do so, subject to the following conditions: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 return 1; | 124 return 1; |
125 } | 125 } |
126 | 126 |
127 static uint64_t | 127 static uint64_t |
128 theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts) | 128 theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts) |
129 { | 129 { |
130 struct ogg *ogg = ctx->priv_data; | 130 struct ogg *ogg = ctx->priv_data; |
131 struct ogg_stream *os = ogg->streams + idx; | 131 struct ogg_stream *os = ogg->streams + idx; |
132 struct theora_params *thp = os->private; | 132 struct theora_params *thp = os->private; |
| 133 if (!thp) return NULL; |
133 uint64_t iframe = gp >> thp->gpshift; | 134 uint64_t iframe = gp >> thp->gpshift; |
134 uint64_t pframe = gp & thp->gpmask; | 135 uint64_t pframe = gp & thp->gpmask; |
135 | 136 |
136 if (thp->version < 0x030201) | 137 if (thp->version < 0x030201) |
137 iframe++; | 138 iframe++; |
138 | 139 |
139 if(!pframe) | 140 if(!pframe) |
140 os->pflags |= AV_PKT_FLAG_KEY; | 141 os->pflags |= AV_PKT_FLAG_KEY; |
141 | 142 |
142 if (dts) | 143 if (dts) |
143 *dts = iframe + pframe; | 144 *dts = iframe + pframe; |
144 | 145 |
145 return iframe + pframe; | 146 return iframe + pframe; |
146 } | 147 } |
147 | 148 |
148 const struct ogg_codec ff_theora_codec = { | 149 const struct ogg_codec ff_theora_codec = { |
149 .magic = "\200theora", | 150 .magic = "\200theora", |
150 .magicsize = 7, | 151 .magicsize = 7, |
151 .header = theora_header, | 152 .header = theora_header, |
152 .gptopts = theora_gptopts | 153 .gptopts = theora_gptopts |
153 }; | 154 }; |
OLD | NEW |