Thu, 15 Jan 2015 15:59:08 +0100
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) 2011 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 | #ifndef LOOKAHEAD_H |
michael@0 | 11 | #define LOOKAHEAD_H |
michael@0 | 12 | #include "vpx_scale/yv12config.h" |
michael@0 | 13 | #include "vpx/vpx_integer.h" |
michael@0 | 14 | |
michael@0 | 15 | struct lookahead_entry |
michael@0 | 16 | { |
michael@0 | 17 | YV12_BUFFER_CONFIG img; |
michael@0 | 18 | int64_t ts_start; |
michael@0 | 19 | int64_t ts_end; |
michael@0 | 20 | unsigned int flags; |
michael@0 | 21 | }; |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | struct lookahead_ctx; |
michael@0 | 25 | |
michael@0 | 26 | /**\brief Initializes the lookahead stage |
michael@0 | 27 | * |
michael@0 | 28 | * The lookahead stage is a queue of frame buffers on which some analysis |
michael@0 | 29 | * may be done when buffers are enqueued. |
michael@0 | 30 | * |
michael@0 | 31 | * |
michael@0 | 32 | */ |
michael@0 | 33 | struct lookahead_ctx* vp8_lookahead_init(unsigned int width, |
michael@0 | 34 | unsigned int height, |
michael@0 | 35 | unsigned int depth |
michael@0 | 36 | ); |
michael@0 | 37 | |
michael@0 | 38 | |
michael@0 | 39 | /**\brief Destroys the lookahead stage |
michael@0 | 40 | * |
michael@0 | 41 | */ |
michael@0 | 42 | void vp8_lookahead_destroy(struct lookahead_ctx *ctx); |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | /**\brief Enqueue a source buffer |
michael@0 | 46 | * |
michael@0 | 47 | * This function will copy the source image into a new framebuffer with |
michael@0 | 48 | * the expected stride/border. |
michael@0 | 49 | * |
michael@0 | 50 | * If active_map is non-NULL and there is only one frame in the queue, then copy |
michael@0 | 51 | * only active macroblocks. |
michael@0 | 52 | * |
michael@0 | 53 | * \param[in] ctx Pointer to the lookahead context |
michael@0 | 54 | * \param[in] src Pointer to the image to enqueue |
michael@0 | 55 | * \param[in] ts_start Timestamp for the start of this frame |
michael@0 | 56 | * \param[in] ts_end Timestamp for the end of this frame |
michael@0 | 57 | * \param[in] flags Flags set on this frame |
michael@0 | 58 | * \param[in] active_map Map that specifies which macroblock is active |
michael@0 | 59 | */ |
michael@0 | 60 | int |
michael@0 | 61 | vp8_lookahead_push(struct lookahead_ctx *ctx, |
michael@0 | 62 | YV12_BUFFER_CONFIG *src, |
michael@0 | 63 | int64_t ts_start, |
michael@0 | 64 | int64_t ts_end, |
michael@0 | 65 | unsigned int flags, |
michael@0 | 66 | unsigned char *active_map); |
michael@0 | 67 | |
michael@0 | 68 | |
michael@0 | 69 | /**\brief Get the next source buffer to encode |
michael@0 | 70 | * |
michael@0 | 71 | * |
michael@0 | 72 | * \param[in] ctx Pointer to the lookahead context |
michael@0 | 73 | * \param[in] drain Flag indicating the buffer should be drained |
michael@0 | 74 | * (return a buffer regardless of the current queue depth) |
michael@0 | 75 | * |
michael@0 | 76 | * \retval NULL, if drain set and queue is empty |
michael@0 | 77 | * \retval NULL, if drain not set and queue not of the configured depth |
michael@0 | 78 | * |
michael@0 | 79 | */ |
michael@0 | 80 | struct lookahead_entry* |
michael@0 | 81 | vp8_lookahead_pop(struct lookahead_ctx *ctx, |
michael@0 | 82 | int drain); |
michael@0 | 83 | |
michael@0 | 84 | |
michael@0 | 85 | #define PEEK_FORWARD 1 |
michael@0 | 86 | #define PEEK_BACKWARD -1 |
michael@0 | 87 | /**\brief Get a future source buffer to encode |
michael@0 | 88 | * |
michael@0 | 89 | * \param[in] ctx Pointer to the lookahead context |
michael@0 | 90 | * \param[in] index Index of the frame to be returned, 0 == next frame |
michael@0 | 91 | * |
michael@0 | 92 | * \retval NULL, if no buffer exists at the specified index |
michael@0 | 93 | * |
michael@0 | 94 | */ |
michael@0 | 95 | struct lookahead_entry* |
michael@0 | 96 | vp8_lookahead_peek(struct lookahead_ctx *ctx, |
michael@0 | 97 | unsigned int index, |
michael@0 | 98 | int direction); |
michael@0 | 99 | |
michael@0 | 100 | |
michael@0 | 101 | /**\brief Get the number of frames currently in the lookahead queue |
michael@0 | 102 | * |
michael@0 | 103 | * \param[in] ctx Pointer to the lookahead context |
michael@0 | 104 | */ |
michael@0 | 105 | unsigned int |
michael@0 | 106 | vp8_lookahead_depth(struct lookahead_ctx *ctx); |
michael@0 | 107 | |
michael@0 | 108 | |
michael@0 | 109 | #endif |