Commit 82676b9c authored by Laurent Aimar's avatar Laurent Aimar

Merged vout_pictures.c with video_output.c.

parent 1ccc38ba
......@@ -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 \
......
......@@ -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)
{
......
/*****************************************************************************
* vout_pictures.c :
*****************************************************************************
* Copyright (C) 2009-2010 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* 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 <assert.h>
#include <vlc_common.h>
#include <libvlc.h>
#include <vlc_vout.h>
#include <vlc_picture_fifo.h>
#include <vlc_picture_pool.h>
#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 );
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment