Bug 19299 - QTMovieWin should not hard code supported MIME types
Summary: QTMovieWin should not hard code supported MIME types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-05-28 15:04 PDT by Eric Carlson
Modified: 2008-06-08 11:24 PDT (History)
4 users (show)

See Also:


Attachments
proposed fix (5.73 KB, patch)
2008-05-28 15:41 PDT, Eric Carlson
koivisto: review+
Details | Formatted Diff | Diff
Revised patch (5.40 KB, patch)
2008-05-30 14:15 PDT, Eric Carlson
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2008-05-28 15:04:44 PDT
QTMovieWin currently has a hard coded list of MIME types. The list doesn't include many common types supported by a default QuickTime install (eg. "audio/mp3" or the many other MP3 synonyms), but it also means that WebKit won't list types added by third party movie importers (eg. the ogg importers).
Comment 1 Mark Rowe (bdash) 2008-05-28 15:06:33 PDT
<rdar://problem/5969392>
Comment 2 Eric Carlson 2008-05-28 15:41:32 PDT
Created attachment 21405 [details]
proposed fix
Comment 3 Antti Koivisto 2008-05-29 09:51:20 PDT
Looks good. Some style comments, I guess this was adapted from existing code. 

+    ComponentDescription    findCD;
+    QTAtom                  mimeTag;
+    Component               comp;
+    char                    *atomData;
+    int                     index;
+    long                    componentCount;
+    OSErr                   err = noErr;

+                QTAtomContainer         mimeList = NULL;
+                ComponentDescription    infoCD;
+                int                     typeIndex, typeCount;
+                long                    typeLength;

WebKit code doesn't usually align variable names like this.

+                // grab every type from the container
+                QTLockContainer(mimeList);
+                typeCount = QTCountChildrenOfType(mimeList, kParentAtomIsContainer, kMimeInfoMimeTypeTag);
+                for (typeIndex = 1; typeIndex <= typeCount; typeIndex++) {
+                    if ( 0 != (mimeTag = QTFindChildByIndex(mimeList, 0, kMimeInfoMimeTypeTag, typeIndex, NULL))) {

Extra space after (
It would be better to do assignment separately from comparison.
This and the next if could use continue instead, reducing code nesting.

+                            if (0 != strncmp(typeBuffer, "audio/", 6) && 0 != strncmp(typeBuffer, "video/", 6))

0 != is unnecessary

+                            for ( int addedIndex = 0; addedIndex < gSupportedTypes->size(); addedIndex++ ) {

extra space after ( and before  )
Comment 4 Eric Carlson 2008-05-30 14:15:17 PDT
Created attachment 21437 [details]
Revised patch
Comment 5 Darin Adler 2008-06-08 11:23:42 PDT
Committed revision 34444.