Changeset fd0cdccc7cf66bc0734889ce53f9c7d958774a9b

Show
Ignore:
Timestamp:
03/21/08 18:02:55 (4 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1206118975 +0100
git-parent:

[f38c418960343365c1b7c9da1f9e4af747e03044]

git-author:
Rafaël Carré <funman@videolan.org> 1206053325 +0100
Message:

DM: Use built-in priority for known codecs

Not every dailymotion video is available in vp6

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • share/luaplaylist/dailymotion.lua

    rf79fb4e rfd0cdcc  
    4343            /A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264 
    4444            Not everybody can decode HD, not everybody has a 80x60 screen, 
    45             H264/MP4 is buggy , so i choose VP6 
     45            H264/MP4 is buggy , so i choose VP6 as the highest priority 
    4646 
    4747            Ideally, VLC would propose the different streams available, codecs 
    4848            and resolutions (the resolutions are part of the URL) 
     49 
     50            For now we just built a list of preferred codecs : lowest value 
     51            means highest priority 
    4952         ]] 
     53            local pref = { ["vp6"]=0, ["spark"]=1, ["h264"]=2, ["vp6-hd"]=3, ["spark-mini"]=4 } 
     54            local available = {} 
    5055            for n in string.gmatch(videos, "[^|]+") do 
    5156                i = string.find(n, "@@") 
    5257                if i then 
    53                     video = string.sub( n, 0, i - 1) 
    54                     codec = string.sub( n, i + 2 ) 
    55                     if video and codec and string.match(codec, "vp6") then 
    56                         path = "http://dailymotion.com" .. video 
    57                         break 
    58                     end 
     58                    available[string.sub(n, i+2)] = string.sub(n, 0, i-1) 
    5959                end 
     60            end 
     61            local score = 666 
     62            local bestcodec 
     63            for codec,_ in pairs(available) do 
     64                if pref[codec] < score then 
     65                    bestcodec = codec 
     66                    score = pref[codec] 
     67                end 
     68            end 
     69            if bestcodec then 
     70                path = "http://dailymotion.com" .. available[bestcodec] 
    6071            end 
    6172        end