summaryrefslogtreecommitdiff
path: root/libavcodec/mediacodec.h
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-07-31 18:34:15 -0700
committerAman Gupta <aman@tmm1.net>2018-10-11 20:51:14 -0700
commitf6d48b618aadb7acea6539e3973c91e14164f531 (patch)
tree4c2bdc25c9dce6cf76c29b8054c296bd26824d32 /libavcodec/mediacodec.h
parente265832c378c3f4dc372f1c0f477810f63dd60fd (diff)
downloadffmpeg-f6d48b618aadb7acea6539e3973c91e14164f531.tar.gz
avcodec/mediacodec: add av_mediacodec_render_buffer_at_time()
The existing av_mediacodec_release_buffer allows the user to render or discard the Surface-backed frame. This new method allows the user to control exactly when the frame will be rendered to its SurfaceView. Available since Android API 21. Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/mediacodec.h')
-rw-r--r--libavcodec/mediacodec.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/mediacodec.h b/libavcodec/mediacodec.h
index 5606d24a1e..4c8545df03 100644
--- a/libavcodec/mediacodec.h
+++ b/libavcodec/mediacodec.h
@@ -85,4 +85,17 @@ typedef struct MediaCodecBuffer AVMediaCodecBuffer;
*/
int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
+/**
+ * Release a MediaCodec buffer and render it at the given time to the surface
+ * that is associated with the decoder. The timestamp must be within one second
+ * of the current java/lang/System#nanoTime() (which is implemented using
+ * CLOCK_MONOTONIC on Android). See the Android MediaCodec documentation
+ * of android/media/MediaCodec#releaseOutputBuffer(int,long) for more details.
+ *
+ * @param buffer the buffer to render
+ * @param time timestamp in nanoseconds of when to render the buffer
+ * @return 0 on success, < 0 otherwise
+ */
+int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time);
+
#endif /* AVCODEC_MEDIACODEC_H */