1 /*****************************************************************************
2 * vout.c: Dummy video output display method for testing purposes
3 *****************************************************************************
4 * Copyright (C) 2000-2009 the VideoLAN team
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_vout_display.h>
36 /*****************************************************************************
38 *****************************************************************************/
39 struct vout_display_sys_t {
42 static picture_pool_t *Pool(vout_display_t *, unsigned count);
43 static void Display(vout_display_t *, picture_t *);
44 static void DisplayStat(vout_display_t *, picture_t *);
45 static int Control(vout_display_t *, int, va_list);
46 static void Manage (vout_display_t *);
48 /*****************************************************************************
49 * OpenVideo: activates dummy vout display method
50 *****************************************************************************/
51 static int OpenVideoCommon(vlc_object_t *object, bool display_stat)
53 vout_display_t *vd = (vout_display_t *)object;
54 vout_display_sys_t *sys;
56 vd->sys = sys = calloc(1, sizeof(*sys));
61 /* p_vd->info is not modified */
63 char *chroma = var_CreateGetNonEmptyString(vd, "dummy-chroma");
65 vlc_fourcc_t fcc = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
67 msg_Dbg(vd, "forcing chroma 0x%.8x (%4.4s)", fcc, (char*)&fcc);
68 vd->fmt.i_chroma = fcc;
74 vd->display = display_stat ? DisplayStat : Display;
75 vd->control = Control;
80 int OpenVideo(vlc_object_t *object)
82 return OpenVideoCommon(object, false);
84 int OpenVideoStat(vlc_object_t *object)
86 return OpenVideoCommon(object, true);
89 void CloseVideo(vlc_object_t *object)
91 vout_display_t *vd = (vout_display_t *)object;
92 vout_display_sys_t *sys = vd->sys;
95 picture_pool_Delete(sys->pool);
99 static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
101 vout_display_sys_t *sys = vd->sys;
103 sys->pool = picture_pool_NewFromFormat(&vd->fmt, count);
107 static void Display(vout_display_t *vd, picture_t *picture)
110 picture_Release(picture);
113 static void DisplayStat(vout_display_t *vd, picture_t *picture)
116 if (vd->fmt.i_width*vd->fmt.i_height >= sizeof(mtime_t)) {
118 memcpy(&date, picture->p->p_pixels, sizeof(date));
119 msg_Dbg(vd, "VOUT got %"PRIu64" ms offset",
120 (mdate() - date) / 1000 );
122 picture_Release(picture);
125 static int Control(vout_display_t *vd, int query, va_list args)
133 static void Manage(vout_display_t *vd)