1 /*****************************************************************************
2 * vdummy.c: Dummy video output display method for testing purposes
3 *****************************************************************************
4 * Copyright (C) 2000-2009 VLC authors and VideoLAN
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_plugin.h>
34 #include <vlc_vout_display.h>
36 #define CHROMA_TEXT N_("Dummy image chroma format")
37 #define CHROMA_LONGTEXT N_( \
38 "Force the dummy video output to create images using a specific chroma " \
39 "format instead of trying to improve performances by using the most " \
42 static int OpenDummy( vlc_object_t
* );
43 static int OpenStats( vlc_object_t
* );
44 static void Close( vlc_object_t
* );
47 set_shortname( N_("Dummy") )
48 set_description( N_("Dummy video output") )
49 set_capability( "vout display", 0 )
50 set_callbacks( OpenDummy
, Close
)
51 add_shortcut( "dummy" )
53 set_category( CAT_VIDEO
)
54 set_subcategory( SUBCAT_VIDEO_VOUT
)
55 add_string( "dummy-chroma", NULL
, CHROMA_TEXT
, CHROMA_LONGTEXT
, true )
58 set_description( N_("Statistics video output") )
59 set_capability( "vout display", 0 )
60 add_shortcut( "stats" )
61 set_callbacks( OpenStats
, Close
)
65 /*****************************************************************************
67 *****************************************************************************/
68 struct vout_display_sys_t
{
71 static picture_pool_t
*Pool(vout_display_t
*, unsigned count
);
72 static void Display(vout_display_t
*, picture_t
*, subpicture_t
*);
73 static void DisplayStat(vout_display_t
*, picture_t
*, subpicture_t
*);
74 static int Control(vout_display_t
*, int, va_list);
76 /*****************************************************************************
77 * OpenVideo: activates dummy vout display method
78 *****************************************************************************/
79 static int Open(vlc_object_t
*object
,
80 void (*display
)(vout_display_t
*, picture_t
*, subpicture_t
*))
82 vout_display_t
*vd
= (vout_display_t
*)object
;
83 vout_display_sys_t
*sys
;
85 vd
->sys
= sys
= calloc(1, sizeof(*sys
));
90 /* p_vd->info is not modified */
92 char *chroma
= var_InheritString(vd
, "dummy-chroma");
94 vlc_fourcc_t fcc
= vlc_fourcc_GetCodecFromString(VIDEO_ES
, chroma
);
96 msg_Dbg(vd
, "forcing chroma 0x%.8x (%4.4s)", fcc
, (char*)&fcc
);
97 vd
->fmt
.i_chroma
= fcc
;
103 vd
->display
= display
;
104 vd
->control
= Control
;
107 vout_display_DeleteWindow(vd
, NULL
);
112 static int OpenDummy(vlc_object_t
*object
)
114 return Open(object
, Display
);
117 static int OpenStats(vlc_object_t
*object
)
119 return Open(object
, DisplayStat
);
122 static void Close(vlc_object_t
*object
)
124 vout_display_t
*vd
= (vout_display_t
*)object
;
125 vout_display_sys_t
*sys
= vd
->sys
;
128 picture_pool_Release(sys
->pool
);
132 static picture_pool_t
*Pool(vout_display_t
*vd
, unsigned count
)
134 vout_display_sys_t
*sys
= vd
->sys
;
136 sys
->pool
= picture_pool_NewFromFormat(&vd
->fmt
, count
);
140 static void Display(vout_display_t
*vd
, picture_t
*picture
, subpicture_t
*subpicture
)
143 VLC_UNUSED(subpicture
);
144 picture_Release(picture
);
147 static void DisplayStat(vout_display_t
*vd
, picture_t
*picture
, subpicture_t
*subpicture
)
150 VLC_UNUSED(subpicture
);
151 if (vd
->fmt
.i_width
*vd
->fmt
.i_height
>= sizeof(mtime_t
)) {
153 memcpy(&date
, picture
->p
->p_pixels
, sizeof(date
));
154 msg_Dbg(vd
, "VOUT got %"PRIu64
" ms offset",
155 (mdate() - date
) / 1000 );
157 picture_Release(picture
);
160 static int Control(vout_display_t
*vd
, int query
, va_list args
)