ContainerFile Class Reference

<class description="" goes="" here=""> <short description=""> More...

#include <ContainerFile.hpp>

List of all members.


Public Types

enum  ParseType { RUN_THROUGH, ESTIMATE1, ESTIMATE2 }

Static Public Member Functions

ContainerInfoloadContainerInfo (const char *fileName, Url *uri=NULL, const ParseType type=ESTIMATE1)
 init.
bool saveToContainerFile (const char *fileName, ContainerInfo *ci)
 FIXME not implemented: multiplexes a set of ES to a ISOMP4ContainerFile.

Detailed Description

<class description="" goes="" here=""> <short description="">

Author:
Peter Schojer
Version:
Id
ContainerFile.hpp,v 1.5 2006/02/24 08:17:31 mkropfbe Exp

Definition at line 64 of file ContainerFile.hpp.


Member Function Documentation

ContainerInfo * ContainerFile::loadContainerInfo const char *  fileName,
Url uri = NULL,
const ParseType  type = ESTIMATE1
[static]
 

init.

a video object from a pre-stored ContainerFile. No data is read, just metainfoDefinition at line 63 of file ContainerFile.cpp.

References HttpByteStream::close(), HttpByteStream::getMimeTypeEnum(), Url::getProtocol(), HttpByteStream::open(), and Url::toString().

00063 { 00064 ContainerInfo * info = NULL; 00065 HttpByteStream *stream = NULL; 00066 HttpMimeType mimeType = mime_unknown; 00067 00068 dprintf_full("ContainerFile::loadContainerInfo: ####HANDLE####\n"); 00069 #ifdef ENABLE_DVDREAD 00070 dvd_handle_t *dvd_handle = DVDContainerFile::openDVD(fileName); 00071 00072 if(dvd_handle) { 00073 // treat as DVD 00074 u32 main_title_no = DVDContainerFile::getMainTitleNo(dvd_handle); 00075 /* load the containerinfo for the main video title set */ 00076 info = DVDContainerFile::loadContainerInfo(dvd_handle,main_title_no); 00077 delete dvd_handle; 00078 } 00079 #endif 00080 00081 00082 if(info==NULL) { 00083 // was not detected by DVD? 00084 00085 if (!uri) 00086 uri = new Url(fileName); 00087 00088 if (strstr(uri->getProtocol(), "http")) { 00089 stream = new HttpByteStream(uri->toString(), true /* forReading */); 00090 if (!stream->open()) { 00091 dprintf_err("ContainerFile::loadContainerInfo: file not found: %s!\n",fileName); 00092 return NULL; 00093 } 00094 mimeType = stream->getMimeTypeEnum(); 00095 } 00096 00097 00098 const char* suffix=strrchr(fileName,'.'); 00099 if(suffix || (mimeType != mime_unknown)) { 00100 00101 // handle VITOOKI file format 00102 if((mimeType == mime_vit) || strstr(fileName,".vit") || strstr(fileName,".VIT")) { 00103 dprintf_full("ContainerFile::loadContainerInfo(): VITOOKI container detected!\n"); 00104 info = VITContainerFile::loadContainerInfo(uri,stream); 00105 }// if .vit 00106 00107 #ifdef ENABLE_OGG 00108 // handle OGG file format 00109 else if((mimeType == mime_ogg) || strstr(fileName,".ogg") || strstr(fileName,".OGG")) { 00110 dprintf_full("ContainerFile::loadContainerInfo(): OGG container detected!\n"); 00111 info = OGGContainerFile::loadContainerInfo(uri,stream); 00112 }// if .ogg 00113 #endif 00114 00115 #ifdef ENABLE_MKV 00116 // handle MATROSKA file format 00117 else if((mimeType == mime_mkv) || strstr(fileName,".mkv") || strstr(fileName,".MKV")) { 00118 if (stream) 00119 stream->close(); //direct stream passing not yet supported.... 00120 dprintf_full("ContainerFile::loadContainerInfo(): MATROSKA detected!\n"); 00121 info = MKContainerFile::loadContainerInfo(fileName,uri); 00122 }// if .mkv 00123 #endif 00124 00125 else if(strstr(fileName,".mp4") || strstr(fileName,".MP4") || mimeType == mime_mp4) { 00126 if (stream) 00127 stream->close(); //direct stream passing not yet supported.... 00128 00129 // we can now choose between ISOMP4 or ffmpeg 00130 // assume that if ISOMP4 is defined this is the preferred one 00131 dprintf_full("ContainerFile::loadContainerInfo(): MP4 detected!\n"); 00132 #ifdef ISOMP4 00133 info = ISOMP4ContainerFile::loadContainerInfo(fileName,uri); 00134 #endif 00135 #ifdef ENABLE_FFMPEG 00136 // if this fails try ffmpeg 00137 if(info==NULL) 00138 info = ffMP4ContainerFile::loadContainerInfo(fileName,uri,(ffMP4ContainerFile::ParseType)type); 00139 #endif 00140 }//if .mp4 00141 else { 00142 if (stream) 00143 stream->close(); //direct stream passing not yet supported.... 00144 00145 #ifdef ENABLE_FFMPEG 00146 dprintf_full("ContainerFile::loadContainerInfo(): UNDEFINED detected!\n"); 00147 // NOT KNOWN, still give it a try with ffmpeg.... 00148 info = ffMP4ContainerFile::loadContainerInfo(fileName,uri,(ffMP4ContainerFile::ParseType)type); 00149 #endif 00150 }// NOT KNOWN extension 00151 } //has suffix 00152 else { 00153 // no suffix and no mimetype????? try ffmpeg and hope 00154 if (stream) 00155 stream->close(); //direct stream passing not yet supported.... 00156 #ifdef ENABLE_FFMPEG 00157 info = ffMP4ContainerFile::loadContainerInfo(fileName,uri,(ffMP4ContainerFile::ParseType)type); 00158 #endif 00159 } 00160 } 00161 00162 return info; 00163 }


The documentation for this class was generated from the following files: