3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #ifndef INCLUDED_VIDEO_SDL_SINK_UC_H
24 #define INCLUDED_VIDEO_SDL_SINK_UC_H
26 #include <gr_sync_block.h>
30 /* fourcc (four character code) */
31 #define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24))
32 #define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
34 class video_sdl_sink_uc;
35 typedef boost::shared_ptr<video_sdl_sink_uc> video_sdl_sink_uc_sptr;
37 video_sdl_sink_uc_sptr
38 video_sdl_make_sink_uc (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1);
41 * \brief video sink using SDL
43 * input signature is one, two or three streams of uchar.
44 * One stream: stream is grey (Y)
45 * two streems: first is grey (Y), second is alternating U and V
46 * Three streams: first is grey (Y), second is U, third is V
47 * Input samples must be in the range [0,255].
50 class video_sdl_sink_uc : public gr_sync_block {
51 friend video_sdl_sink_uc_sptr
52 video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height);
57 video_sdl_sink_uc (double framerate,int width, int height,unsigned int format,
58 int dst_width,int dst_height);
59 void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
60 const unsigned char * src_pixels,int src_width);
61 void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
62 const unsigned char * src_pixels,int src_width);
63 void copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
64 void copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
65 int copy_plane_to_surface (int plane,int noutput_items,
66 const unsigned char * src_pixels);
68 int d_wanted_frametime_ms;
75 SDL_Surface *d_screen;
79 unsigned int d_wanted_ticks;
83 ~video_sdl_sink_uc ();
85 int work (int noutput_items,
86 gr_vector_const_void_star &input_items,
87 gr_vector_void_star &output_items);
90 #endif /* INCLUDED_VIDEO_SDL_SINK_UC_H */