/* * yuvmagick - reads a yuv stream from stdin and passes it to * converts it to ppm images, passes it to ImageMagick's * convert command with the specified options and converts * back to yuv on stdout. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "yuv4mpeg.h" int headerprinted=0; static void usage (progname) { fprintf (stderr, "usage: %s \n",progname); } void y4mtoppm (y4m_stream_info_t streaminfo,y4m_frame_info_t frameinfo, unsigned char *yuv[],int argc, char *argv[],int interlace){ int out[2],magickin[2],magickout[2],in[2]; int pid,status,i; char *magickargs[argc+4]; char framerate[16]; int w,h; unsigned char *newyuv[3]; /* output */ y4m_stream_info_t newstreaminfo; y4m_frame_info_t newframeinfo; sprintf(framerate,"%d:%d",streaminfo.framerate.n,streaminfo.framerate.d); pipe(out); pipe(magickin); magickargs[0]=(char *)malloc(strlen("convert")+1); magickargs[1]=(char *)malloc(strlen("PPM:-")+1); sprintf(magickargs[0],"convert"); sprintf(magickargs[1],"PPM:-"); i=1; while (i