2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
14 #include "./tools_common.h"
20 struct AvxInputContext
;
22 struct WebmInputContext
{
27 const void *block_entry
;
29 int block_frame_index
;
30 int video_track_index
;
31 uint64_t timestamp_ns
;
36 // Checks if the input is a WebM file. If so, initializes WebMInputContext so
37 // that webm_read_frame can be called to retrieve a video frame.
38 // Returns 1 on success and 0 on failure or input is not WebM file.
39 // TODO(vigneshv): Refactor this function into two smaller functions specific
41 int file_is_webm(struct WebmInputContext
*webm_ctx
,
42 struct AvxInputContext
*aom_ctx
);
44 // Reads a WebM Video Frame. Memory for the buffer is created, owned and managed
45 // by this function. For the first call, |buffer| should be NULL and
46 // |*buffer_size| should be 0. Once all the frames are read and used,
47 // webm_free() should be called, otherwise there will be a leak.
49 // webm_ctx - WebmInputContext object
50 // buffer - pointer where the frame data will be filled.
51 // buffer_size - pointer to buffer size.
56 int webm_read_frame(struct WebmInputContext
*webm_ctx
, uint8_t **buffer
,
59 // Guesses the frame rate of the input file based on the container timestamps.
60 int webm_guess_framerate(struct WebmInputContext
*webm_ctx
,
61 struct AvxInputContext
*aom_ctx
);
63 // Resets the WebMInputContext.
64 void webm_free(struct WebmInputContext
*webm_ctx
);