vlc | branch: master | Steve Lhomme <[email protected]> | Fri Sep 20 09:46:50 2019 +0200| [4dbf653b84dfb3db31d01f61d6d694f432ca3c51] | committer: Steve Lhomme
video context: add a Create/Release function for the video context > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4dbf653b84dfb3db31d01f61d6d694f432ca3c51 --- include/vlc_picture.h | 3 +++ src/input/decoder_helpers.c | 15 +++++++++++++++ src/libvlccore.sym | 2 ++ src/video_output/display.c | 8 ++++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/vlc_picture.h b/include/vlc_picture.h index c314c9c207..99495ca43a 100644 --- a/include/vlc_picture.h +++ b/include/vlc_picture.h @@ -85,6 +85,9 @@ typedef struct vlc_video_context vlc_decoder_device *device; } vlc_video_context; +VLC_API vlc_video_context * vlc_video_context_Create(vlc_decoder_device *); +VLC_API void vlc_video_context_Release(vlc_video_context *); + /** * Video picture */ diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c index eac988f85d..f5926b4851 100644 --- a/src/input/decoder_helpers.c +++ b/src/input/decoder_helpers.c @@ -181,3 +181,18 @@ vlc_decoder_device_Release(vlc_decoder_device *device) vlc_object_delete(device); } } + +/* video context */ + +vlc_video_context * vlc_video_context_Create(vlc_decoder_device *device) +{ + vlc_video_context *vctx = malloc(sizeof(*vctx)); + if (unlikely(vctx == NULL)) + return NULL; + vctx->device = device; + return vctx; +} +void vlc_video_context_Release(vlc_video_context *vctx) +{ + free(vctx); +} diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 2037763178..84347ea047 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -945,3 +945,5 @@ vlc_media_tree_Unlock vlc_media_tree_Find vlc_media_tree_Preparse vlc_viewpoint_to_4x4 +vlc_video_context_Create +vlc_video_context_Release diff --git a/src/video_output/display.c b/src/video_output/display.c index 9051eb5248..0ecf794972 100644 --- a/src/video_output/display.c +++ b/src/video_output/display.c @@ -770,11 +770,11 @@ vout_display_t *vout_display_New(vlc_object_t *parent, if (owner) vd->owner = *owner; - vlc_video_context fake_vtcx = { .device = dec_device }; + vlc_video_context *fake_vctx = vlc_video_context_Create(dec_device); if (vlc_module_load(vd, "vout display", module, module && *module != '\0', vout_display_start, vd, &osys->cfg, &vd->fmt, - &fake_vtcx) == NULL) + fake_vctx) == NULL) goto error; #if defined(__OS2__) @@ -796,8 +796,12 @@ vout_display_t *vout_display_New(vlc_object_t *parent, video_format_Clean(&vd->fmt); goto error; } + if (fake_vctx) + vlc_video_context_Release(fake_vctx); return vd; error: + if (fake_vctx) + vlc_video_context_Release(fake_vctx); video_format_Clean(&vd->source); vlc_object_delete(vd); return NULL; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
