| 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; |
| 44 } | 45 } |
| 45 | 46 |
| 46 void get_first_cluster(struct WebmInputContext *const webm_ctx) { | 47 void get_first_cluster(struct WebmInputContext *const webm_ctx) { |
| 47 mkvparser::Segment *const segment = | 48 mkvparser::Segment *const segment = |
| 48 reinterpret_cast<mkvparser::Segment*>(webm_ctx->segment); | 49 reinterpret_cast<mkvparser::Segment*>(webm_ctx->segment); |
| 49 const mkvparser::Cluster *const cluster = segment->GetFirst(); | 50 const mkvparser::Cluster *const cluster = segment->GetFirst(); |
| 50 webm_ctx->cluster = cluster; | 51 webm_ctx->cluster = cluster; |
| 51 } | 52 } |
| 52 | 53 |
| 53 void rewind_and_reset(struct WebmInputContext *const webm_ctx, | 54 void rewind_and_reset(struct WebmInputContext *const webm_ctx, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 delete[] *buffer; | 176 delete[] *buffer; |
| 176 *buffer = new uint8_t[frame.len]; | 177 *buffer = new uint8_t[frame.len]; |
| 177 if (*buffer == NULL) { | 178 if (*buffer == NULL) { |
| 178 return -1; | 179 return -1; |
| 179 } | 180 } |
| 180 *buffer_size = frame.len; | 181 *buffer_size = frame.len; |
| 181 webm_ctx->buffer = *buffer; | 182 webm_ctx->buffer = *buffer; |
| 182 } | 183 } |
| 183 *bytes_in_buffer = frame.len; | 184 *bytes_in_buffer = frame.len; |
| 184 webm_ctx->timestamp_ns = block->GetTime(cluster); | 185 webm_ctx->timestamp_ns = block->GetTime(cluster); |
| 186 webm_ctx->is_key_frame = block->IsKey(); |
| 185 | 187 |
| 186 mkvparser::MkvReader *const reader = | 188 mkvparser::MkvReader *const reader = |
| 187 reinterpret_cast<mkvparser::MkvReader*>(webm_ctx->reader); | 189 reinterpret_cast<mkvparser::MkvReader*>(webm_ctx->reader); |
| 188 return frame.Read(reader, *buffer) ? -1 : 0; | 190 return frame.Read(reader, *buffer) ? -1 : 0; |
| 189 } | 191 } |
| 190 | 192 |
| 191 int webm_guess_framerate(struct WebmInputContext *webm_ctx, | 193 int webm_guess_framerate(struct WebmInputContext *webm_ctx, |
| 192 struct VpxInputContext *vpx_ctx) { | 194 struct VpxInputContext *vpx_ctx) { |
| 193 uint32_t i = 0; | 195 uint32_t i = 0; |
| 194 uint8_t *buffer = NULL; | 196 uint8_t *buffer = NULL; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 210 webm_ctx->block_entry = NULL; | 212 webm_ctx->block_entry = NULL; |
| 211 webm_ctx->block_frame_index = 0; | 213 webm_ctx->block_frame_index = 0; |
| 212 webm_ctx->timestamp_ns = 0; | 214 webm_ctx->timestamp_ns = 0; |
| 213 | 215 |
| 214 return 0; | 216 return 0; |
| 215 } | 217 } |
| 216 | 218 |
| 217 void webm_free(struct WebmInputContext *webm_ctx) { | 219 void webm_free(struct WebmInputContext *webm_ctx) { |
| 218 reset(webm_ctx); | 220 reset(webm_ctx); |
| 219 } | 221 } |
| OLD | NEW |