Main Page | Namespace List | Compound List | File List | Compound Members | File Members

pfspd_env.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include <stdlib.h>
00012 #include <stdio.h>
00013 #include <string.h>
00014 #include "pfspd_env.h"
00015 
00016 pfspdEnv::pfspdEnv (
00017   const Id&           n,
00018   In<pfspd_args_t>&   pfspdArgumentsF,
00019   Out<VYAfileName>&   fileNameF,
00020   Out<pT_header>&     outSeqInfoF)
00021 :
00022   // member initialization: bind ports to fifo’s
00023   Process(n),
00024   pfspdArgumentsP(id("pfspdArgumentsP"),pfspdArgumentsF),
00025   fileNameP(id("fileName"),fileNameF),
00026   outSeqInfoP(id("outSeqInfo"),outSeqInfoF)
00027 { }
00028 
00029 void pfspdEnv::main()
00030 {
00031   while(true)
00032   {
00033     VYAfileName   fileName;
00034     pfspd_args_t  arguments;
00035     int           nrFrames;
00036     int           hSize;
00037     int           vSize;
00038     pT_color      colorFormat;
00039     int           scan; //0 if interlace, 1 if progressive
00040     pT_header     outSeqInfo;
00041 
00042     read(pfspdArgumentsP, arguments);
00043   
00044     if (getenv(arguments.path))
00045     {
00046       strcpy(fileName, getenv(arguments.path));
00047       strcat(fileName, "/");
00048       strcat(fileName, arguments.filename);
00049     }
00050     else
00051     {
00052       strcpy(fileName, arguments.filename);
00053     }
00054     nrFrames = arguments.num_frames;
00055     hSize = arguments.h_size;
00056     vSize = arguments.v_size;
00057     colorFormat = arguments.color_format;
00058     scan = arguments.scan;
00059 
00060     write(fileNameP, fileName);
00061 
00062     if ((p_create_ext_header(&outSeqInfo, colorFormat, P_50HZ,P_SD, 720, scan, P_16_9) != P_OK) || 
00063         (p_mod_image_size(&outSeqInfo, hSize, vSize) != P_OK) ||
00064         (p_mod_num_frames(&outSeqInfo, nrFrames) != P_OK))
00065     {
00066       printf("%s: Error, cannot create pfspd header\n",fullName());
00067       exit(1);
00068     }
00069     write(outSeqInfoP, outSeqInfo);
00070   }
00071 }

Generated on Wed Feb 15 14:52:43 2006 for pfspdfebe by doxygen 1.3.2