rendered paste bodyIndex: src/pipeline.cpp===================================================================--- src/pipeline.cpp (revision 97720)+++ src/pipeline.cpp (working copy)@@ -1203,7 +1203,8 @@ if (!source->Peek (buffer, 4)) return false; - return buffer [0] == '<' && buffer [1] == 'A' && buffer [2] == 'S' && buffer [3] == 'X';+ return (buffer [0] == '<' && buffer [1] == 'A' && buffer [2] == 'S' && buffer [3] == 'X') || + (buffer [0] == '[' && buffer [1] == 'R' && buffer [2] == 'e' && buffer [3] == 'f'); } IMediaDemuxer *Index: src/playlist.h===================================================================--- src/playlist.h (revision 97720)+++ src/playlist.h (working copy)@@ -236,7 +236,8 @@ Playlist *GetPlaylist () { return playlist; } bool Parse ();- static bool IsASX (IMediaSource *source);+ bool ParseASX2();+ bool IsASX2 (IMediaSource *source); bool IsPlaylistFile (IMediaSource *source); static PlaylistNodeKind StringToKind (const char *str);Index: src/playlist.cpp===================================================================--- src/playlist.cpp (revision 97720)+++ src/playlist.cpp (working copy)@@ -18,7 +18,7 @@ #include "xaml.h" #include "runtime.h" -#define LOG_PLAYLISTS(...)// printf (__VA_ARGS__);+#define LOG_PLAYLISTS(...) printf (__VA_ARGS__); /* * PlaylistNode@@ -702,6 +702,55 @@ } bool+PlaylistParser::IsASX2 (IMediaSource *source)+{+ static const char *asx2_header = "[Reference]";+ int asx2_header_length = strlen (asx2_header);+ char buffer [20];+ + if (!source->Peek (buffer, asx2_header_length))+ return false;+ + return strncmp (asx2_header, buffer, asx2_header_length) == 0;+}++++bool+PlaylistParser::ParseASX2 ()+{+#define BUFFER_SIZE 1024+ int bytes_read;+ char buffer[BUFFER_SIZE];+ char *mms_uri;+ char *end;++ bytes_read = source->Read (buffer, BUFFER_SIZE);+ if (bytes_read < 0) {+ fprintf (stderr, "Could not read asx document for parsing.\n");+ return false;+ }+ if (!g_str_has_prefix (buffer, "[Reference]\r\nRef1=http://") ||+ !strstr (buffer, "?MSWMExt=.asf")) {+ return false;+ }++ end = strstr (buffer, "?MSWMExt=.asf");+ *end = '\0';++ mms_uri = g_strdup_printf ("mms://%s", buffer + strlen ("[Reference]\r\nRef1=http://"));++ playlist = new Playlist (element, source);++ PlaylistEntry *entry = new PlaylistEntry (element, playlist);+ entry->SetSourceName (mms_uri);+ playlist->AddEntry (entry);+ current_entry = entry;++ return true;+}++bool PlaylistParser::Parse () { LOG_PLAYLISTS ("PlaylistParser::Parse ()\n");@@ -709,6 +758,11 @@ int bytes_read; void *buffer; + if (!this->IsPlaylistFile (source) && this->IsASX2 (source)) {+ /* Parse as a asx1 mms file */+ return this->ParseASX2 ();+ }+ // asx documents don't tend to be very big, so there's no need for a big buffer #define BUFFER_SIZE 1024 Index: plugin/browser-mmsh.cpp===================================================================--- plugin/browser-mmsh.cpp (revision 97720)+++ plugin/browser-mmsh.cpp (working copy)@@ -15,8 +15,9 @@ #define LE_16(val) (GINT16_FROM_LE (*((u_int16_t*)(val)))) #define LE_64(val) (GINT64_FROM_LE (*((u_int64_t*)(val)))) -#define MMS_DATA 0x44-#define MMS_HEADER 0x48+#define MMS_DATA 0x44+#define MMS_HEADER 0x48+#define MMS_METADATA 0x4D // BrowserMmshResponse @@ -154,7 +155,10 @@ mms_packet = read_buffer + 4; packet_size = LE_16 (&mms_packet[6]); - if (type == MMS_HEADER) {+ if (type == MMS_METADATA) {+ + /* Get Metadata and figure out file size and so */+ } else if (type == MMS_HEADER) { asf_packet_size = get_asf_packet_size (mms_packet+8); reader (this, this->context, mms_packet+8, this->size, packet_size - 8); this->size += packet_size - 8;