Changeset fd0cdccc7cf66bc0734889ce53f9c7d958774a9b
- 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
| rf79fb4e |
rfd0cdcc |
|
| 43 | 43 | /A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264 |
|---|
| 44 | 44 | 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 |
|---|
| 46 | 46 | |
|---|
| 47 | 47 | Ideally, VLC would propose the different streams available, codecs |
|---|
| 48 | 48 | 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 |
|---|
| 49 | 52 | ]] |
|---|
| | 53 | local pref = { ["vp6"]=0, ["spark"]=1, ["h264"]=2, ["vp6-hd"]=3, ["spark-mini"]=4 } |
|---|
| | 54 | local available = {} |
|---|
| 50 | 55 | for n in string.gmatch(videos, "[^|]+") do |
|---|
| 51 | 56 | i = string.find(n, "@@") |
|---|
| 52 | 57 | 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) |
|---|
| 59 | 59 | 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] |
|---|
| 60 | 71 | end |
|---|
| 61 | 72 | end |
|---|