1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/*****************************************************************************
* vdummy.c: Dummy video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2000-2009 VLC authors and VideoLAN
* $Id: 94d1255fef952d3cf6cfdfd337c94b2f5e5c096a $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout_display.h>
#define CHROMA_TEXT N_("Dummy image chroma format")
#define CHROMA_LONGTEXT N_( \
"Force the dummy video output to create images using a specific chroma " \
"format instead of trying to improve performances by using the most " \
"efficient one.")
static int OpenDummy( vlc_object_t * );
static int OpenStats( vlc_object_t * );
static void Close( vlc_object_t * );
vlc_module_begin ()
set_shortname( N_("Dummy") )
set_description( N_("Dummy video output") )
set_capability( "vout display", 0 )
set_callbacks( OpenDummy, Close )
add_shortcut( "dummy" )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VOUT )
add_string( "dummy-chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
add_submodule ()
set_description( N_("Statistics video output") )
set_capability( "vout display", 0 )
add_shortcut( "stats" )
set_callbacks( OpenStats, Close )
vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct vout_display_sys_t {
picture_pool_t *pool;
};
static picture_pool_t *Pool(vout_display_t *, unsigned count);
static void Display(vout_display_t *, picture_t *, subpicture_t *);
static void DisplayStat(vout_display_t *, picture_t *, subpicture_t *);
static int Control(vout_display_t *, int, va_list);
/*****************************************************************************
* OpenVideo: activates dummy vout display method
*****************************************************************************/
static int Open(vlc_object_t *object,
void (*display)(vout_display_t *, picture_t *, subpicture_t *))
{
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_EGENERIC;
sys->pool = NULL;
/* p_vd->info is not modified */
char *chroma = var_InheritString(vd, "dummy-chroma");
if (chroma) {
vlc_fourcc_t fcc = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
if (fcc != 0) {
msg_Dbg(vd, "forcing chroma 0x%.8x (%4.4s)", fcc, (char*)&fcc);
vd->fmt.i_chroma = fcc;
}
free(chroma);
}
vd->pool = Pool;
vd->prepare = NULL;
vd->display = display;
vd->control = Control;
vd->manage = NULL;
return VLC_SUCCESS;
}
static int OpenDummy(vlc_object_t *object)
{
return Open(object, Display);
}
static int OpenStats(vlc_object_t *object)
{
return Open(object, DisplayStat);
}
static void Close(vlc_object_t *object)
{
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
picture_pool_Delete(sys->pool);
free(sys);
}
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
if (!sys->pool)
sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
return sys->pool;
}
static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
VLC_UNUSED(vd);
VLC_UNUSED(subpicture);
picture_Release(picture);
}
static void DisplayStat(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
VLC_UNUSED(vd);
VLC_UNUSED(subpicture);
if (vd->fmt.i_width*vd->fmt.i_height >= sizeof(mtime_t)) {
mtime_t date;
memcpy(&date, picture->p->p_pixels, sizeof(date));
msg_Dbg(vd, "VOUT got %"PRIu64" ms offset",
(mdate() - date) / 1000 );
}
picture_Release(picture);
}
static int Control(vout_display_t *vd, int query, va_list args)
{
VLC_UNUSED(vd);
VLC_UNUSED(query);
VLC_UNUSED(args);
return VLC_SUCCESS;
}
|