OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 webm_ctx->reader = NULL; | 35 webm_ctx->reader = NULL; |
36 webm_ctx->segment = NULL; | 36 webm_ctx->segment = NULL; |
37 webm_ctx->buffer = NULL; | 37 webm_ctx->buffer = NULL; |
38 webm_ctx->cluster = NULL; | 38 webm_ctx->cluster = NULL; |
39 webm_ctx->block_entry = NULL; | 39 webm_ctx->block_entry = NULL; |
40 webm_ctx->block = NULL; | 40 webm_ctx->block = NULL; |
41 webm_ctx->block_frame_index = 0; | 41 webm_ctx->block_frame_index = 0; |
42 webm_ctx->video_track_index = 0; | 42 webm_ctx->video_track_index = 0; |
43 webm_ctx->timestamp_ns = 0; | 43 webm_ctx->timestamp_ns = 0; |
44 webm_ctx->is_key_frame = false; | |
45 } | 44 } |
46 | 45 |
47 void get_first_cluster(struct WebmInputContext *const webm_ctx) { | 46 void get_first_cluster(struct WebmInputContext *const webm_ctx) { |
48 mkvparser::Segment *const segment = | 47 mkvparser::Segment *const segment = |
49 reinterpret_cast<mkvparser::Segment*>(webm_ctx->segment); | 48 reinterpret_cast<mkvparser::Segment*>(webm_ctx->segment); |
50 const mkvparser::Cluster *const cluster = segment->GetFirst(); | 49 const mkvparser::Cluster *const cluster = segment->GetFirst(); |
51 webm_ctx->cluster = cluster; | 50 webm_ctx->cluster = cluster; |
52 } | 51 } |
53 | 52 |
54 void rewind_and_reset(struct WebmInputContext *const webm_ctx, | 53 void rewind_and_reset(struct WebmInputContext *const webm_ctx, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 delete[] *buffer; | 175 delete[] *buffer; |
177 *buffer = new uint8_t[frame.len]; | 176 *buffer = new uint8_t[frame.len]; |
178 if (*buffer == NULL) { | 177 if (*buffer == NULL) { |
179 return -1; | 178 return -1; |
180 } | 179 } |
181 *buffer_size = frame.len; | 180 *buffer_size = frame.len; |
182 webm_ctx->buffer = *buffer; | 181 webm_ctx->buffer = *buffer; |
183 } | 182 } |
184 *bytes_in_buffer = frame.len; | 183 *bytes_in_buffer = frame.len; |
185 webm_ctx->timestamp_ns = block->GetTime(cluster); | 184 webm_ctx->timestamp_ns = block->GetTime(cluster); |
186 webm_ctx->is_key_frame = block->IsKey(); | |
187 | 185 |
188 mkvparser::MkvReader *const reader = | 186 mkvparser::MkvReader *const reader = |
189 reinterpret_cast<mkvparser::MkvReader*>(webm_ctx->reader); | 187 reinterpret_cast<mkvparser::MkvReader*>(webm_ctx->reader); |
190 return frame.Read(reader, *buffer) ? -1 : 0; | 188 return frame.Read(reader, *buffer) ? -1 : 0; |
191 } | 189 } |
192 | 190 |
193 int webm_guess_framerate(struct WebmInputContext *webm_ctx, | 191 int webm_guess_framerate(struct WebmInputContext *webm_ctx, |
194 struct VpxInputContext *vpx_ctx) { | 192 struct VpxInputContext *vpx_ctx) { |
195 uint32_t i = 0; | 193 uint32_t i = 0; |
196 uint8_t *buffer = NULL; | 194 uint8_t *buffer = NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
212 webm_ctx->block_entry = NULL; | 210 webm_ctx->block_entry = NULL; |
213 webm_ctx->block_frame_index = 0; | 211 webm_ctx->block_frame_index = 0; |
214 webm_ctx->timestamp_ns = 0; | 212 webm_ctx->timestamp_ns = 0; |
215 | 213 |
216 return 0; | 214 return 0; |
217 } | 215 } |
218 | 216 |
219 void webm_free(struct WebmInputContext *webm_ctx) { | 217 void webm_free(struct WebmInputContext *webm_ctx) { |
220 reset(webm_ctx); | 218 reset(webm_ctx); |
221 } | 219 } |
OLD | NEW |