blob: 4cdfd6882c60a1670251c2f0c64b4053674f9372 [file] [log] [blame]
Tom Finegan03848f52013-11-05 10:02:18 -08001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Tom Finegan03848f52013-11-05 10:02:18 -08003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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.
Tom Finegan03848f52013-11-05 10:02:18 -080010 */
James Zerne1cbb132018-08-22 14:10:36 -070011#ifndef AOM_COMMON_WEBMENC_H_
12#define AOM_COMMON_WEBMENC_H_
Tom Finegan03848f52013-11-05 10:02:18 -080013
14#include <stdio.h>
15#include <stdlib.h>
16
Tom Finegan03848f52013-11-05 10:02:18 -080017#include "tools_common.h"
Yaowu Xuf883b422016-08-30 14:01:10 -070018#include "aom/aom_encoder.h"
Tom Finegan03848f52013-11-05 10:02:18 -080019
James Zern25cfd8e2014-01-18 12:16:11 -080020#ifdef __cplusplus
21extern "C" {
22#endif
23
Vignesh Venkatasubramanian9441f102016-04-25 13:28:24 -070024struct WebmOutputContext {
Tom Finegan03848f52013-11-05 10:02:18 -080025 int debug;
Tom Finegan03848f52013-11-05 10:02:18 -080026 FILE *stream;
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -070027 int64_t last_pts_ns;
28 void *writer;
29 void *segment;
Tom Finegan03848f52013-11-05 10:02:18 -080030};
31
32/* Stereo 3D packed frame format */
33typedef enum stereo_format {
Tom Finegan1f0c2e72013-11-06 10:02:31 -080034 STEREO_FORMAT_MONO = 0,
Tom Finegan03848f52013-11-05 10:02:18 -080035 STEREO_FORMAT_LEFT_RIGHT = 1,
36 STEREO_FORMAT_BOTTOM_TOP = 2,
37 STEREO_FORMAT_TOP_BOTTOM = 3,
38 STEREO_FORMAT_RIGHT_LEFT = 11
39} stereo_format_t;
40
Tom Fineganbb8157b2018-09-20 15:33:11 -070041// The following functions wrap libwebm's mkvmuxer. All functions return 0 upon
42// success, or -1 upon failure.
Tom Finegan03848f52013-11-05 10:02:18 -080043
Tom Fineganbb8157b2018-09-20 15:33:11 -070044int write_webm_file_header(struct WebmOutputContext *webm_ctx,
45 aom_codec_ctx_t *encoder_ctx,
46 const aom_codec_enc_cfg_t *cfg,
47 stereo_format_t stereo_fmt, unsigned int fourcc,
48 const struct AvxRational *par);
Tom Finegan03848f52013-11-05 10:02:18 -080049
Tom Fineganbb8157b2018-09-20 15:33:11 -070050int write_webm_block(struct WebmOutputContext *webm_ctx,
51 const aom_codec_enc_cfg_t *cfg,
52 const aom_codec_cx_pkt_t *pkt);
53
54int write_webm_file_footer(struct WebmOutputContext *webm_ctx);
Tom Finegan03848f52013-11-05 10:02:18 -080055
James Zern25cfd8e2014-01-18 12:16:11 -080056#ifdef __cplusplus
57} // extern "C"
58#endif
59
James Zerne1cbb132018-08-22 14:10:36 -070060#endif // AOM_COMMON_WEBMENC_H_