media/libvpx/vpx/svc_context.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /*
michael@0 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 /**
michael@0 12 * SvcContext - input parameters and state to encode a multi-layered
michael@0 13 * spatial SVC frame
michael@0 14 */
michael@0 15
michael@0 16 #ifndef VPX_SVC_CONTEXT_H_
michael@0 17 #define VPX_SVC_CONTEXT_H_
michael@0 18
michael@0 19 #include "vpx/vp8cx.h"
michael@0 20 #include "vpx/vpx_encoder.h"
michael@0 21
michael@0 22 #ifdef __cplusplus
michael@0 23 extern "C" {
michael@0 24 #endif
michael@0 25
michael@0 26 typedef enum SVC_ENCODING_MODE {
michael@0 27 INTER_LAYER_PREDICTION_I,
michael@0 28 ALT_INTER_LAYER_PREDICTION_IP,
michael@0 29 INTER_LAYER_PREDICTION_IP,
michael@0 30 USE_GOLDEN_FRAME
michael@0 31 } SVC_ENCODING_MODE;
michael@0 32
michael@0 33 typedef enum SVC_LOG_LEVEL {
michael@0 34 SVC_LOG_ERROR,
michael@0 35 SVC_LOG_INFO,
michael@0 36 SVC_LOG_DEBUG
michael@0 37 } SVC_LOG_LEVEL;
michael@0 38
michael@0 39 typedef struct {
michael@0 40 // public interface to svc_command options
michael@0 41 int spatial_layers; // number of layers
michael@0 42 int first_frame_full_size; // set to one to force first frame full size
michael@0 43 SVC_ENCODING_MODE encoding_mode; // svc encoding strategy
michael@0 44 SVC_LOG_LEVEL log_level; // amount of information to display
michael@0 45 int log_print; // when set, printf log messages instead of returning the
michael@0 46 // message with svc_get_message
michael@0 47
michael@0 48 // private storage for vpx_svc_encode
michael@0 49 void *internal;
michael@0 50 } SvcContext;
michael@0 51
michael@0 52 /**
michael@0 53 * Set SVC options
michael@0 54 * options are supplied as a single string separated by spaces
michael@0 55 * Format: encoding-mode=<i|ip|alt-ip|gf>
michael@0 56 * layers=<layer_count>
michael@0 57 * scaling-factors=<n1>/<d1>,<n2>/<d2>,...
michael@0 58 * quantizers=<q1>,<q2>,...
michael@0 59 */
michael@0 60 vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options);
michael@0 61
michael@0 62 /**
michael@0 63 * Set SVC quantizer values
michael@0 64 * values comma separated, ordered from lowest resolution to highest
michael@0 65 * e.g., "60,53,39,33,27"
michael@0 66 */
michael@0 67 vpx_codec_err_t vpx_svc_set_quantizers(SvcContext *svc_ctx,
michael@0 68 const char *quantizer_values);
michael@0 69
michael@0 70 /**
michael@0 71 * Set SVC scale factors
michael@0 72 * values comma separated, ordered from lowest resolution to highest
michael@0 73 * e.g., "4/16,5/16,7/16,11/16,16/16"
michael@0 74 */
michael@0 75 vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
michael@0 76 const char *scale_factors);
michael@0 77
michael@0 78 /**
michael@0 79 * initialize SVC encoding
michael@0 80 */
michael@0 81 vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
michael@0 82 vpx_codec_iface_t *iface,
michael@0 83 vpx_codec_enc_cfg_t *cfg);
michael@0 84 /**
michael@0 85 * encode a frame of video with multiple layers
michael@0 86 */
michael@0 87 vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
michael@0 88 struct vpx_image *rawimg, vpx_codec_pts_t pts,
michael@0 89 int64_t duration, int deadline);
michael@0 90
michael@0 91 /**
michael@0 92 * finished with svc encoding, release allocated resources
michael@0 93 */
michael@0 94 void vpx_svc_release(SvcContext *svc_ctx);
michael@0 95
michael@0 96 /**
michael@0 97 * dump accumulated statistics and reset accumulated values
michael@0 98 */
michael@0 99 const char *vpx_svc_dump_statistics(SvcContext *svc_ctx);
michael@0 100
michael@0 101 /**
michael@0 102 * get status message from previous encode
michael@0 103 */
michael@0 104 const char *vpx_svc_get_message(const SvcContext *svc_ctx);
michael@0 105
michael@0 106 /**
michael@0 107 * return size of encoded data to be returned by vpx_svc_get_buffer
michael@0 108 */
michael@0 109 size_t vpx_svc_get_frame_size(const SvcContext *svc_ctx);
michael@0 110
michael@0 111 /**
michael@0 112 * return buffer with encoded data
michael@0 113 */
michael@0 114 void *vpx_svc_get_buffer(const SvcContext *svc_ctx);
michael@0 115
michael@0 116 /**
michael@0 117 * return spatial resolution of the specified layer
michael@0 118 */
michael@0 119 vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
michael@0 120 int layer,
michael@0 121 unsigned int *width,
michael@0 122 unsigned int *height);
michael@0 123 /**
michael@0 124 * return number of frames that have been encoded
michael@0 125 */
michael@0 126 int vpx_svc_get_encode_frame_count(const SvcContext *svc_ctx);
michael@0 127
michael@0 128 /**
michael@0 129 * return 1 if last encoded frame was a keyframe
michael@0 130 */
michael@0 131 int vpx_svc_is_keyframe(const SvcContext *svc_ctx);
michael@0 132
michael@0 133 /**
michael@0 134 * force the next frame to be a keyframe
michael@0 135 */
michael@0 136 void vpx_svc_set_keyframe(SvcContext *svc_ctx);
michael@0 137
michael@0 138 #ifdef __cplusplus
michael@0 139 } // extern "C"
michael@0 140 #endif
michael@0 141
michael@0 142 #endif /* VPX_SVC_CONTEXT_H_ */

mercurial