Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
82d12e9890
3 changed files with 38 additions and 32 deletions
  1. +6
    -6
      build/macosx/platform_specific_code/juce_posix_SharedCode.cpp
  2. +6
    -3
      extras/juce demo/src/binarydata/TreeViewDemo.cpp
  3. +26
    -23
      src/juce_appframework/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp

+ 6
- 6
build/macosx/platform_specific_code/juce_posix_SharedCode.cpp View File

@@ -299,13 +299,13 @@ void* juce_fileOpen (const String& fileName, bool forWriting) throw()
void juce_fileClose (void* handle) throw()
{
if (handle != 0)
close ((int) handle);
close ((int) (pointer_sized_int) handle);
}
int juce_fileRead (void* handle, void* buffer, int size) throw()
{
if (handle != 0)
return read ((int) handle, buffer, size);
return read ((int) (pointer_sized_int) handle, buffer, size);
return 0;
}
@@ -313,14 +313,14 @@ int juce_fileRead (void* handle, void* buffer, int size) throw()
int juce_fileWrite (void* handle, const void* buffer, int size) throw()
{
if (handle != 0)
return write ((int) handle, buffer, size);
return write ((int) (pointer_sized_int) handle, buffer, size);
return 0;
}
int64 juce_fileSetPosition (void* handle, int64 pos) throw()
{
if (handle != 0 && lseek ((int) handle, pos, SEEK_SET) == pos)
if (handle != 0 && lseek ((int) (pointer_sized_int) handle, pos, SEEK_SET) == pos)
return pos;
return -1;
@@ -329,7 +329,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos) throw()
int64 juce_fileGetPosition (void* handle) throw()
{
if (handle != 0)
return lseek ((int) handle, 0, SEEK_CUR);
return lseek ((int) (pointer_sized_int) handle, 0, SEEK_CUR);
else
return -1;
}
@@ -337,7 +337,7 @@ int64 juce_fileGetPosition (void* handle) throw()
void juce_fileFlush (void* handle) throw()
{
if (handle != 0)
fsync ((int) handle);
fsync ((int) (pointer_sized_int) handle);
}
//==============================================================================


+ 6
- 3
extras/juce demo/src/binarydata/TreeViewDemo.cpp View File

@@ -155,10 +155,13 @@ public:
rootItem = new TreeViewDemoItem (treeXml);
rootItem->setOpen (true);
OwnedArray <File> roots;
File::findFileSystemRoots (roots);
// find the root of the user's home drive, and set that as our root..
File folder (File::getSpecialLocation (File::userHomeDirectory));
while (folder.getParentDirectory() != folder)
folder = folder.getParentDirectory();
directoryList = new DirectoryContentsList (0, thread);
directoryList->setDirectory (*roots[0], true, true);
directoryList->setDirectory (folder, true, true);
thread.startThread (3);
addAndMakeVisible (typeButton = new TextButton (T("Type of treeview...")));


+ 26
- 23
src/juce_appframework/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp View File

@@ -374,25 +374,27 @@ private:
zeromem (props, sizeof (props));
int prop = 0;

FileInputStream* fin = dynamic_cast <FileInputStream*> (input);
DataReferenceRecord dr;
props[prop].propClass = kQTPropertyClass_DataLocation;
props[prop].propID = kQTDataLocationPropertyID_DataReference;
props[prop].propValueSize = sizeof (dr);
props[prop].propValueAddress = (void*) &dr;
++prop;

FileInputStream* const fin = dynamic_cast <FileInputStream*> (input);

if (fin != 0)
{
String path (fin->getFile().getFullPathName().replaceCharacter (T('\\'), T('/')));
if (path.startsWithChar (T('/')))
path = path.substring (1);
CFStringRef filePath = juceStringToCFString (fin->getFile().getFullPathName());

CFStringRef pathString = juceStringToCFString (T("file://") + URL::addEscapeChars (path));
CFURLRef urlRef = CFURLCreateWithString (kCFAllocatorDefault, pathString, 0);
CFRelease (pathString);
QTNewDataReferenceFromFullPathCFString (filePath, (QTPathStyle) kQTNativeDefaultPathStyle, 0,
&dr.dataRef, &dr.dataRefType);

props[prop].propClass = kQTPropertyClass_DataLocation;
props[prop].propID = kQTDataLocationPropertyID_CFURL;
props[prop].propValueSize = sizeof (urlRef);
props[prop].propValueAddress = &urlRef;
++prop;

ok = openMovie (props, prop);

DisposeHandle (dr.dataRef);
CFRelease (filePath);
}
else
{
@@ -414,7 +416,7 @@ private:

for (int i = 0; i < numElementsInArray (suffixesToTry) && ! ok; ++i)
{
Handle dataRef = createHandleDataRef (dataHandle, suffixesToTry [i]);
dr.dataRef = createHandleDataRef (dataHandle, suffixesToTry [i]);

/* // this fails for some bizarre reason - it can be bodged to work with
// movies, but can't seem to do it for other file types..
@@ -430,18 +432,10 @@ private:
props[prop].propValueAddress = (void*) &procInfo;
++prop; */

DataReferenceRecord dr;
dr.dataRef = dataRef;
dr.dataRefType = HandleDataHandlerSubType;
props[prop].propClass = kQTPropertyClass_DataLocation;
props[prop].propID = kQTDataLocationPropertyID_DataReference;
props[prop].propValueSize = sizeof (dr);
props[prop].propValueAddress = (void*) &dr;
++prop;

ok = openMovie (props, prop);

DisposeHandle (dataRef);
DisposeHandle (dr.dataRef);
}

DisposeHandle (dataHandle);
@@ -459,6 +453,12 @@ private:
props[prop].propValueAddress = &trueBool;
++prop;

props[prop].propClass = kQTPropertyClass_MovieInstantiation;
props[prop].propID = kQTMovieInstantiationPropertyID_AsyncOK;
props[prop].propValueSize = sizeof (trueBool);
props[prop].propValueAddress = &trueBool;
++prop;

Boolean isActive = true;
props[prop].propClass = kQTPropertyClass_NewMovieProperty;
props[prop].propID = kQTNewMoviePropertyID_Active;
@@ -472,7 +472,10 @@ private:
MacSetPort (0);
#endif

return NewMovieFromProperties (prop, props, 0, 0, &movie) == noErr;
jassert (prop <= 5);
OSStatus err = NewMovieFromProperties (prop, props, 0, 0, &movie);
return err == noErr;
}

//==============================================================================


Loading…
Cancel
Save