2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
13 #include "./tools_common.h"
19 struct VpxInputContext;
21 struct WebmInputContext {
26 const void *block_entry;
28 int block_frame_index;
29 int video_track_index;
30 uint64_t timestamp_ns;
34 // Checks if the input is a WebM file. If so, initializes WebMInputContext so
35 // that webm_read_frame can be called to retrieve a video frame.
36 // Returns 1 on success and 0 on failure or input is not WebM file.
37 // TODO(vigneshv): Refactor this function into two smaller functions specific
39 int file_is_webm(struct WebmInputContext *webm_ctx,
40 struct VpxInputContext *vpx_ctx);
42 // Reads a WebM Video Frame. Memory for the buffer is created, owned and managed
43 // by this function. For the first call, |buffer| should be NULL and
44 // |*bytes_in_buffer| should be 0. Once all the frames are read and used,
45 // webm_free() should be called, otherwise there will be a leak.
47 // webm_ctx - WebmInputContext object
48 // buffer - pointer where the frame data will be filled.
49 // bytes_in_buffer - pointer to buffer size.
50 // buffer_size - unused TODO(vigneshv): remove this
55 // TODO(vigneshv): Make the return values consistent across all functions in
57 int webm_read_frame(struct WebmInputContext *webm_ctx,
59 size_t *bytes_in_buffer,
62 // Guesses the frame rate of the input file based on the container timestamps.
63 int webm_guess_framerate(struct WebmInputContext *webm_ctx,
64 struct VpxInputContext *vpx_ctx);
66 // Resets the WebMInputContext.
67 void webm_free(struct WebmInputContext *webm_ctx);