1 /*! ========================================================================
4 ** $Id: trgt_dv.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $
6 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
8 ** This software and associated documentation
9 ** are CONFIDENTIAL and PROPRIETARY property of
10 ** the above-mentioned copyright holder.
12 ** You may not copy, print, publish, or in any
13 ** other way distribute this software without
14 ** a prior written agreement with
15 ** the copyright holder.
17 ** === N O T E S ===========================================================
19 ** ========================================================================= */
21 /* === H E A D E R S ======================================================= */
32 #include <ETL/stringf>
41 /* === M A C R O S ========================================================= */
43 using namespace sinfg;
47 /* === G L O B A L S ======================================================= */
49 SINFG_TARGET_INIT(dv_trgt);
50 SINFG_TARGET_SET_NAME(dv_trgt,"dv");
51 SINFG_TARGET_SET_EXT(dv_trgt,"dv");
52 SINFG_TARGET_SET_VERSION(dv_trgt,"0.1");
53 SINFG_TARGET_SET_CVS_ID(dv_trgt,"$Id: trgt_dv.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $");
55 /* === M E T H O D S ======================================================= */
58 dv_trgt::dv_trgt(const char *Filename)
75 delete [] color_buffer;
79 dv_trgt::set_rend_desc(RendDesc *given_desc)
81 // Set the aspect ratio
85 given_desc->set_wh(160,90);
87 // Widescreen should be progressive scan
88 given_desc->set_interlaced(false);
93 given_desc->set_wh(400,300);
95 // We should be interlaced
96 given_desc->set_interlaced(true);
99 // but the pixel res should be 720x480
100 given_desc->clear_flags(),given_desc->set_wh(720,480);
102 // NTSC Frame rate is 29.97
103 given_desc->set_frame_rate(29.97);
105 // The pipe to encodedv is PPM, which needs RGB data
106 //given_desc->set_pixel_format(PF_RGB);
108 // Set the description
117 imagecount=desc.get_frame_start();
122 command=strprintf("encodedv -w 1 - > \"%s\"\n",filename.c_str());
124 command=strprintf("encodedv - > \"%s\"\n",filename.c_str());
126 // Open the pipe to encodedv
127 file=popen(command.c_str(),"w");
131 sinfg::error(_("Unable to open pipe to encodedv"));
135 // Sleep for a moment to let the pipe catch up
136 etl::clock().sleep(0.25f);
150 dv_trgt::start_frame(sinfg::ProgressCallback *callback)
152 int w=desc.get_w(),h=desc.get_h();
157 fprintf(file, "P6\n");
158 fprintf(file, "%d %d\n", w, h);
159 fprintf(file, "%d\n", 255);
162 buffer=new unsigned char[3*w];
164 delete [] color_buffer;
165 color_buffer=new Color[w];
171 dv_trgt::start_scanline(int scanline)
177 dv_trgt::end_scanline()
182 convert_color_format(buffer, color_buffer, desc.get_w(), PF_RGB, gamma());
184 if(!fwrite(buffer,1,desc.get_w()*3,file))