how do you determine if a file is a media file?

Mark Smith mark at maseurope.net
Wed Sep 26 19:20:32 EDT 2007


Josh, many (most?) media file-types have 'magic-numbers' at the start  
(and sometimes also at the end), which identify them as whatever type  
they are.

Have a look at http://en.wikipedia.org/wiki/Magic_number_(programming)

Best,

Mark


On 27 Sep 2007, at 00:00, Josh Mellicker wrote:

> I am working on a handler to determine whether a file is a media  
> file. (for OS X and Windows)
>
> First, I check if the file has a proper extension (.mov, .jpg,  
> etc.) if so, I assume the extension is correct (a leap of faith  
> perhaps)
>
> Second, I try to get the OS X filetype from the detailed files.  
> Some movies properly list "Moov", some don't.
>
> Third, was going to try loading the file into a Player or Image  
> object and see if there's an error, but many types of files will  
> load into those objects fine (like text files)
>
> So, I'm wondering if anyone has any tips beyond these things...
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list