liveMedia/OutputFile.cpp File Reference

#include <sys/stat.h>
#include <string.h>
#include "OutputFile.hh"

Include dependency graph for OutputFile.cpp:

Go to the source code of this file.

Functions

FILE * OpenOutputFile (UsageEnvironment &env, char const *fileName)
void CloseOutputFile (FILE *fid)


Function Documentation

void CloseOutputFile ( FILE *  fid  ) 

Definition at line 57 of file OutputFile.cpp.

References NULL.

Referenced by AVIFileSink::~AVIFileSink(), and QuickTimeFileSink::~QuickTimeFileSink().

00057                                 {
00058   // Don't close 'stdout' or 'stderr', in case we want to use it again later.
00059   if (fid != NULL && fid != stdout && fid != stderr) fclose(fid);
00060 }

FILE* OpenOutputFile ( UsageEnvironment env,
char const *  fileName 
)

Definition at line 32 of file OutputFile.cpp.

References env, NULL, and UsageEnvironment::setResultMsg().

Referenced by FileSink::addData(), AVIFileSink::AVIFileSink(), AMRAudioFileSink::createNew(), FileSink::createNew(), H264VideoFileSink::createNew(), and QuickTimeFileSink::QuickTimeFileSink().

00032                                                                   {
00033   FILE* fid;
00034 
00035   // Check for special case 'file names': "stdout" and "stderr"
00036   if (strcmp(fileName, "stdout") == 0) {
00037     fid = stdout;
00038 #if defined(__WIN32__) || defined(_WIN32)
00039     _setmode(_fileno(stdout), _O_BINARY);       // convert to binary mode
00040 #endif
00041   } else if (strcmp(fileName, "stderr") == 0) {
00042     fid = stderr;
00043 #if defined(__WIN32__) || defined(_WIN32)
00044     _setmode(_fileno(stderr), _O_BINARY);       // convert to binary mode
00045 #endif
00046   } else {
00047     fid = fopen(fileName, "wb");
00048   }
00049 
00050   if (fid == NULL) {
00051     env.setResultMsg("unable to open file \"", fileName, "\"");
00052   }
00053 
00054   return fid;
00055 }


Generated on Tue Oct 7 15:39:12 2008 for live by  doxygen 1.5.2