vlc | branch: master | Alexandre Janniaux <[email protected]> | Wed Jan 13 12:07:18 2021 +0100| [d4baeda87ba023ce1e5b7d7b3f93ef34b2a3bf79] | committer: Alexandre Janniaux
mediacodec: forward get_texture in video context We need to expose the new .get_texture from the context, but we only have a single SurfaceTexture here since we cannot easily switch SurfaceTexture and might need to produce more than one frame. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4baeda87ba023ce1e5b7d7b3f93ef34b2a3bf79 --- modules/codec/omxil/mediacodec.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c index ebf3178b38..9741248614 100644 --- a/modules/codec/omxil/mediacodec.c +++ b/modules/codec/omxil/mediacodec.c @@ -542,6 +542,16 @@ static bool PictureContextRenderPicTs(struct picture_context_t *ctx, return false; } +static struct vlc_asurfacetexture * +PictureContextGetTexture(picture_context_t *context) +{ + android_video_context_t *avctx = + vlc_video_context_GetPrivate(context->vctx, VLC_VIDEO_CONTEXT_AWINDOW); + decoder_sys_t *p_sys = avctx->dec_opaque; + + return p_sys->video.surfacetexture; +} + static void PictureContextDestroy(struct picture_context_t *ctx) { struct android_picture_ctx *apctx = @@ -646,6 +656,7 @@ CreateVideoContext(decoder_t *p_dec) * projection or an orientation to handle, if the Surface owner is not able * to modify its layout, or if there is no external subtitle surfaces. */ + p_sys->video.surfacetexture = NULL; bool use_surfacetexture = p_dec->fmt_out.video.projection_mode != PROJECTION_MODE_RECTANGULAR || (!p_sys->api.b_support_rotation && p_dec->fmt_out.video.orientation != ORIENT_NORMAL) @@ -655,6 +666,7 @@ CreateVideoContext(decoder_t *p_dec) if (use_surfacetexture) { p_sys->video.surfacetexture = vlc_asurfacetexture_New(awh); + assert(p_sys->video.surfacetexture); if (p_sys->video.surfacetexture == NULL) goto error; p_sys->video.p_surface = p_sys->video.surfacetexture->window; @@ -690,6 +702,7 @@ CreateVideoContext(decoder_t *p_dec) avctx->dec_opaque = p_dec->p_sys; avctx->render = PictureContextRenderPic; avctx->render_ts = p_sys->api.release_out_ts ? PictureContextRenderPicTs : NULL; + avctx->get_texture = p_sys->video.surfacetexture ? PictureContextGetTexture : NULL; for (size_t i = 0; i < ARRAY_SIZE(p_sys->video.apic_ctxs); ++i) { @@ -906,11 +919,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init) goto bailout; } - android_video_context_t *avctx = - vlc_video_context_GetPrivate(p_sys->video.ctx, - VLC_VIDEO_CONTEXT_AWINDOW); - - if (p_sys->api.b_support_rotation && avctx->texture == NULL) + if (p_sys->api.b_support_rotation && p_sys->video.surfacetexture == NULL) { switch (p_dec->fmt_in.video.orientation) { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
