1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11 
12 
13 #include "ImageFormatYUV.h"
14 #include "Application.h"
15 #include "DXStrings.h"
16 #if defined(DXD_WIN) || defined(OS2)
17 #define unlink _unlink
18 #endif
19 #if defined(HAVE_UNISTD_H)
20 #include <unistd.h>
21 #endif
22 
23 
24 boolean ImageFormatYUV::ClassInitialized = FALSE;
25 
26 String ImageFormatYUV::DefaultResources[] = {
27     NUL(char*)
28 };
29 
30 
ImageFormatYUV(ImageFormatDialog * dialog)31 ImageFormatYUV::ImageFormatYUV (ImageFormatDialog* dialog) :
32     PixelImageFormat("YUVformat", dialog)
33 {
34 
35 }
36 
~ImageFormatYUV()37 ImageFormatYUV::~ImageFormatYUV()
38 {
39 }
40 
41 
initialize()42 void ImageFormatYUV::initialize()
43 {
44     if (!ImageFormatYUV::ClassInitialized) {
45 	this->setDefaultResources (theApplication->getRootWidget(),
46 	    ImageFormat::DefaultResources);
47 	this->setDefaultResources (theApplication->getRootWidget(),
48 	    PixelImageFormat::DefaultResources);
49 	this->setDefaultResources (theApplication->getRootWidget(),
50 	    ImageFormatYUV::DefaultResources);
51 	ImageFormatYUV::ClassInitialized = TRUE;
52     }
53 }
54 
55 
eraseOutputFile(const char * fname)56 void ImageFormatYUV::eraseOutputFile(const char *fname)
57 {
58     char *cp;
59     char *srcfile = DuplicateString(fname);
60     char *file_to_delete = new char[strlen(fname) + 8];
61     if ( (cp = strstr (srcfile, ".yuv")) ) cp[0] = '\0';
62     sprintf (file_to_delete, "%s.yuv", srcfile);
63     unlink (file_to_delete);
64     sprintf (file_to_delete, "%s.size", srcfile);
65     unlink (file_to_delete);
66 
67     delete file_to_delete;
68     delete srcfile;
69 }
70 
isA(Symbol classname)71 boolean ImageFormatYUV::isA(Symbol classname)
72 {
73     Symbol s = theSymbolManager->registerSymbol(ClassImageFormatYUV);
74     if (s == classname)
75 	return TRUE;
76     else
77 	return this->ImageFormat::isA(classname);
78 }
79 
80