[vlc-devel] commit: Fix megavideo lua demuxer ( Rafaël Carré )

git version control git at videolan.org
Thu Mar 27 21:45:39 CET 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Mar 27 21:43:37 2008 +0100| [b04fc32cafa3b6879b1eb10c0ca8703ebe57a42e]

Fix megavideo lua demuxer

The '\n' was absent from the binary data, and several URLs wouldn't play properly
Simplify the decoding
Remove debug print()
Distribute the file

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b04fc32cafa3b6879b1eb10c0ca8703ebe57a42e
---

 share/Makefile.am               |    1 +
 share/luaplaylist/megavideo.lua |   20 ++++++--------------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/share/Makefile.am b/share/Makefile.am
index 8307e1d..bc6038b 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -259,6 +259,7 @@ DIST_lua= \
 	luaplaylist/lelombrik.lua \
 	luaplaylist/youtube.lua \
 	luaplaylist/youtube_homepage.lua \
+    luaplaylist/megavideo.lua \
 	luaplaylist/metacafe.lua \
 	luaplaylist/googlevideo.lua \
 	luaintf/http.lua \
diff --git a/share/luaplaylist/megavideo.lua b/share/luaplaylist/megavideo.lua
index 8c5763c..44a04f2 100644
--- a/share/luaplaylist/megavideo.lua
+++ b/share/luaplaylist/megavideo.lua
@@ -47,7 +47,7 @@ function parse()
             xml = ""
             while line do
                 -- buffer the full xml
-                xml = xml .. line
+                xml = xml .. line .. '\n'
                 line = vlc.readline()
             end
             -- now gets the encoded url
@@ -56,18 +56,11 @@ function parse()
             i = 1
             while s:byte(i) do
                 c = s:byte(i)
-                if c % 4 < 2 then
-                    if c < 16 and c > 3 then key = 61
-                    elseif c < 96 and c > 67 then key = 189
-                    elseif c < 20 and c > 6 then key = 65
-                    else vlc.msg_err("Oops, please report URL to developers")
-                    end
-                else
-                    if c < 16 and c > 3 then key = 65
-                    elseif c < 96 and c > 67 then key = 193
-                    elseif c < 20 and c > 6 then key = 65
-                    else vlc.msg_err("Oops, please report URL to developers")
-                    end
+                if c % 4 < 2 then mod = 0 else mod = 4 end
+                if c < 16 and c > 3 then key = 61 + mod
+                elseif c < 96 and c > 67 then key = 189 + mod
+                elseif c < 20 and c > 6 then key = 65
+                else vlc.msg_err("Oops, please report URL to developers")
                 end
                 i = i + 1
                 path = path .. string.char(key - c)
@@ -75,7 +68,6 @@ function parse()
         end
         if path then break end
     end
-    print( path )
     if path then
         return { { path = path } }
     else




More information about the vlc-devel mailing list