From 82676b9c941fe7e9c05a1d1758d4d4e4aa381a9b Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 22 Oct 2010 20:13:33 +0200 Subject: [PATCH] Merged vout_pictures.c with video_output.c. --- src/Makefile.am | 1 - src/video_output/video_output.c | 70 ++++++++++++++++++++ src/video_output/vout_pictures.c | 110 ------------------------------- 3 files changed, 70 insertions(+), 111 deletions(-) delete mode 100644 src/video_output/vout_pictures.c diff --git a/src/Makefile.am b/src/Makefile.am index 6d75584726..5671b5c502 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -384,7 +384,6 @@ SOURCES_libvlc_common = \ video_output/postprocessing.c \ video_output/postprocessing.h \ video_output/video_output.c \ - video_output/vout_pictures.c \ video_output/video_text.c \ video_output/video_epg.c \ video_output/video_widgets.c \ diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 915363c5fa..124d68991f 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -368,6 +368,76 @@ void vout_FlushSubpictureChannel( vout_thread_t *vout, int channel ) channel); } +/** + * It retreives a picture from the vout or NULL if no pictures are + * available yet. + * + * You MUST call vout_PutPicture or vout_ReleasePicture on it. + * + * You may use vout_HoldPicture(paired with vout_ReleasePicture) to keep a + * read-only reference. + */ +picture_t *vout_GetPicture(vout_thread_t *vout) +{ + /* Get lock */ + vlc_mutex_lock(&vout->p->picture_lock); + picture_t *picture = picture_pool_Get(vout->p->decoder_pool); + if (picture) { + picture_Reset(picture); + picture->p_next = NULL; + } + vlc_mutex_unlock(&vout->p->picture_lock); + + return picture; +} + +/** + * It gives to the vout a picture to be displayed. + * + * The given picture MUST comes from vout_GetPicture. + * + * Becareful, after vout_PutPicture is called, picture_t::p_next cannot be + * read/used. + */ +void vout_PutPicture(vout_thread_t *vout, picture_t *picture) +{ + vlc_mutex_lock(&vout->p->picture_lock); + + picture->p_next = NULL; + picture_fifo_Push(vout->p->decoder_fifo, picture); + + vlc_mutex_unlock(&vout->p->picture_lock); + + vout_control_Wake(&vout->p->control); +} + +/** + * It releases a picture retreived by vout_GetPicture. + */ +void vout_ReleasePicture(vout_thread_t *vout, picture_t *picture) +{ + vlc_mutex_lock(&vout->p->picture_lock); + + picture_Release(picture); + + vlc_mutex_unlock(&vout->p->picture_lock); + + vout_control_Wake(&vout->p->control); +} + +/** + * It increment the reference counter of a picture retreived by + * vout_GetPicture. + */ +void vout_HoldPicture(vout_thread_t *vout, picture_t *picture) +{ + vlc_mutex_lock(&vout->p->picture_lock); + + picture_Hold(picture); + + vlc_mutex_unlock(&vout->p->picture_lock); +} + /* vout_Control* are usable by anyone at anytime */ void vout_ControlChangeFullscreen(vout_thread_t *vout, bool fullscreen) { diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c deleted file mode 100644 index cf98c2edf8..0000000000 --- a/src/video_output/vout_pictures.c +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * vout_pictures.c : - ***************************************************************************** - * Copyright (C) 2009-2010 Laurent Aimar - * $Id$ - * - * Authors: Laurent Aimar - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include - -#include -#include -#include -#include -#include - -#include "vout_internal.h" - -/** - * It retreives a picture from the vout or NULL if no pictures are - * available yet. - * - * You MUST call vout_PutPicture or vout_ReleasePicture on it. - * - * You may use vout_HoldPicture(paired with vout_ReleasePicture) to keep a - * read-only reference. - */ -picture_t *vout_GetPicture( vout_thread_t *p_vout ) -{ - /* Get lock */ - vlc_mutex_lock( &p_vout->p->picture_lock ); - picture_t *p_pic = picture_pool_Get(p_vout->p->decoder_pool); - if (p_pic) { - picture_Reset(p_pic); - p_pic->p_next = NULL; - } - vlc_mutex_unlock( &p_vout->p->picture_lock ); - - return p_pic; -} - -/** - * It gives to the vout a picture to be displayed. - * - * The given picture MUST comes from vout_GetPicture. - * - * Becareful, after vout_PutPicture is called, picture_t::p_next cannot be - * read/used. - */ -void vout_PutPicture( vout_thread_t *p_vout, picture_t *p_pic ) -{ - vlc_mutex_lock( &p_vout->p->picture_lock ); - - p_pic->p_next = NULL; - picture_fifo_Push(p_vout->p->decoder_fifo, p_pic); - - vlc_mutex_unlock( &p_vout->p->picture_lock ); - - vout_control_Wake( &p_vout->p->control); -} - -/** - * It releases a picture retreived by vout_GetPicture. - */ -void vout_ReleasePicture( vout_thread_t *p_vout, picture_t *p_pic ) -{ - vlc_mutex_lock( &p_vout->p->picture_lock ); - - picture_Release( p_pic ); - - vlc_mutex_unlock( &p_vout->p->picture_lock ); - - vout_control_Wake( &p_vout->p->control); -} - -/** - * It increment the reference counter of a picture retreived by - * vout_GetPicture. - */ -void vout_HoldPicture( vout_thread_t *p_vout, picture_t *p_pic ) -{ - vlc_mutex_lock( &p_vout->p->picture_lock ); - - picture_Hold( p_pic ); - - vlc_mutex_unlock( &p_vout->p->picture_lock ); -} - -- GitLab