| 155 | } |
| 156 | |
| 157 | void MovieBase::initFromDataSource( DataSourceRef dataSourceRef, const std::string &mimeTypeHint ) |
| 158 | { |
| 159 | startQuickTime(); |
| 160 | if( dataSourceRef->isFilePath() ) { // try to use quicktime's native file handling if possible |
| 161 | getObj()->mMovie = openMovieFromPath( dataSourceRef->getFilePath() ); |
| 162 | // no need to retain the data source |
| 163 | } |
| 164 | else if( dataSourceRef->isUrl() ) { // try to use quicktime's native Url handling if possible |
| 165 | // Create a loader for this Url and then wait on it |
| 166 | MovieLoader loader( dataSourceRef->getUrl() ); |
| 167 | loader.waitForLoaded(); |
| 168 | getObj()->mMovie = loader.transferMovieHandle(); |
| 169 | // no need to retain the data source |
| 170 | } |
| 171 | else { // we'll need to load from memory; and we'll rer to the data source to make sure it doesn't go away before the movie does |
| 172 | BufferRef buffer( dataSourceRef->getBuffer() ); |
| 173 | getObj()->mMovie = openMovieFromMemory( buffer->getData(), buffer->getSize(), dataSourceRef->getFilePathHint().string(), mimeTypeHint ); |
| 174 | getObj()->mDataSource = dataSourceRef; // retain a reference to the dataSource so that it doesn't go away before we do |
| 175 | } |
| 176 | init(); |
| 177 | } |
| 178 | |
| 179 | void MovieBase::init() |
| 180 | { |
nothing calls this directly
no test coverage detected