root/OpenSceneGraph/trunk/src/osgPlugins/quicktime/QTUtils.cpp @ 9769

Revision 9769, 1.9 kB (checked in by robert, 5 years ago)

From Riccardo Corsi, "in attach you'll find a patch to cleanup a little bit the (de)initialization code of QuickTime? environment from the quickTime pluging.
It basically removes the static init() and exit() functions,and move them inside the observer class (the one that cleans everything up when the last media is unloaded).

It also add an extra check to clean up on exit if the QuickTime? env is initialized, but no media is succesfully loaded / written (it might happens with streaming resources).

I tested it under WinXP with zero, one and multiple videos.

Stephan reads in copy: could you kindly check if everything runs smooth under OSX as well? Also, have you got a chance to test it with streaming media?
"

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[2815]1/*
2 *  QTUtils.cpp
3 *  NativeContext
4 *
5 *  Created by Stephan Huber on Fri Sep 06 2002.
6 *  Copyright (c) 2002 digital mind. All rights reserved.
7 *
8 */
[5799]9#include <osg/ref_ptr>
10#include <osg/Referenced>
[2815]11#include <osg/Notify>
12#include "QTUtils.h"
[5799]13#include "osgDB/Registry"
[2815]14
[5799]15
[2815]16using namespace std;
17
18
[4801]19    // ---------------------------------------------------------------------------
20    // MakeFSSPecFromPath
21    // wandelt einen Posix-Pfad in ein FSSpec um.
22    // ---------------------------------------------------------------------------
23    OSStatus MakeFSSpecFromPath(const char* path, FSSpec* spec) {
[5799]24#ifdef __APPLE__
[4801]25        OSStatus err;
26        FSRef fsref;
27        Boolean isdir;
28          /*
29           FSPathMakeRef is only available in Carbon.  It takes a POSIX path and
30           tries to convert it into a MacOS FSRef object.
31           We don't want folders, only files, so we'll fail here if we got a
32           directory.
33           */
34        err = FSPathMakeRef((const UInt8*)path, &fsref, &isdir);
35        if (err!=0) return err;
36        if (isdir) return 1;
37          // Ditto
38        err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, spec, NULL);
39        return err;
[5799]40#else
41        return -1;
42#endif
[4801]43    }
[2815]44
[4801]45    // ---------------------------------------------------------------------------
46    // MakeMovieFromPath
47    // ---------------------------------------------------------------------------
[8792]48    OSStatus MakeMovieFromPath(const char* path, Movie* movie, short& resref) {
[4801]49        OSStatus err;
50        FSSpec   spec;
[5799]51#ifdef __APPLE__
[4801]52        MakeFSSpecFromPath(path, &spec);
[5799]53#else
54        err = NativePathNameToFSSpec((char*)path, &spec, 0 /* flags */);
55#endif
[4801]56        err = OpenMovieFile(&spec, &resref, fsRdPerm);
57        if (err!=0) return err;
58        err = NewMovieFromFile(movie, resref, NULL, NULL, 0, NULL);
59        if (err==0) err=GetMoviesError();
60        return err;
61    }
[2815]62
63
Note: See TracBrowser for help on using the browser.