| 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 |
| 11 #include "./webmdec.h" | 11 #include "./webmdec.h" |
| 12 | 12 |
| 13 #include <stdarg.h> | 13 #include <stdarg.h> |
| 14 | 14 |
| 15 #include "nestegg/include/nestegg/nestegg.h" | 15 #include "third_party/nestegg/include/nestegg/nestegg.h" |
| 16 | 16 |
| 17 static int nestegg_read_cb(void *buffer, size_t length, void *userdata) { | 17 static int nestegg_read_cb(void *buffer, size_t length, void *userdata) { |
| 18 FILE *f = userdata; | 18 FILE *f = userdata; |
| 19 | 19 |
| 20 if (fread(buffer, 1, length, f) < length) { | 20 if (fread(buffer, 1, length, f) < length) { |
| 21 if (ferror(f)) | 21 if (ferror(f)) |
| 22 return -1; | 22 return -1; |
| 23 if (feof(f)) | 23 if (feof(f)) |
| 24 return 0; | 24 return 0; |
| 25 } | 25 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 int file_is_webm(struct WebmInputContext *webm_ctx, | 58 int file_is_webm(struct WebmInputContext *webm_ctx, |
| 59 struct VpxInputContext *vpx_ctx) { | 59 struct VpxInputContext *vpx_ctx) { |
| 60 uint32_t i, n; | 60 uint32_t i, n; |
| 61 int track_type = -1; | 61 int track_type = -1; |
| 62 int codec_id; | 62 int codec_id; |
| 63 | 63 |
| 64 nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, 0}; | 64 nestegg_io io = {nestegg_read_cb, nestegg_seek_cb, nestegg_tell_cb, 0}; |
| 65 nestegg_video_params params; | 65 nestegg_video_params params; |
| 66 | 66 |
| 67 io.userdata = vpx_ctx->file; | 67 io.userdata = vpx_ctx->file; |
| 68 if (nestegg_init(&webm_ctx->nestegg_ctx, io, NULL)) | 68 if (nestegg_init(&webm_ctx->nestegg_ctx, io, NULL, -1)) |
| 69 goto fail; | 69 goto fail; |
| 70 | 70 |
| 71 if (nestegg_track_count(webm_ctx->nestegg_ctx, &n)) | 71 if (nestegg_track_count(webm_ctx->nestegg_ctx, &n)) |
| 72 goto fail; | 72 goto fail; |
| 73 | 73 |
| 74 for (i = 0; i < n; i++) { | 74 for (i = 0; i < n; i++) { |
| 75 track_type = nestegg_track_type(webm_ctx->nestegg_ctx, i); | 75 track_type = nestegg_track_type(webm_ctx->nestegg_ctx, i); |
| 76 | 76 |
| 77 if (track_type == NESTEGG_TRACK_VIDEO) | 77 if (track_type == NESTEGG_TRACK_VIDEO) |
| 78 break; | 78 break; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return 1; | 189 return 1; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void webm_free(struct WebmInputContext *webm_ctx) { | 192 void webm_free(struct WebmInputContext *webm_ctx) { |
| 193 if (webm_ctx && webm_ctx->nestegg_ctx) { | 193 if (webm_ctx && webm_ctx->nestegg_ctx) { |
| 194 if (webm_ctx->pkt) | 194 if (webm_ctx->pkt) |
| 195 nestegg_free_packet(webm_ctx->pkt); | 195 nestegg_free_packet(webm_ctx->pkt); |
| 196 nestegg_destroy(webm_ctx->nestegg_ctx); | 196 nestegg_destroy(webm_ctx->nestegg_ctx); |
| 197 } | 197 } |
| 198 } | 198 } |
| OLD | NEW |