~ubuntu-branches/ubuntu/natty/vlc/natty

« back to all changes in this revision

Viewing changes to share/lua/intf/modules/common.lua

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-06-25 01:09:16 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100625010916-asxhep2mutg6g6pd
Tags: 1.1.0-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - build and install the libx264 plugin
  - add Xb-Npp header to vlc package
  - Add apport hook to include more vlc dependencies in bug reports
* Drop xulrunner patches.
* Drop 502_xulrunner_191.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
-- Trigger a hotkey
25
25
function hotkey(arg)
26
 
    vlc.var.set( vlc.object.libvlc(), "key-pressed", vlc.config.get( arg ) )
 
26
    local id = vlc.misc.action_id( arg )
 
27
    if id ~= nil then
 
28
        vlc.var.set( vlc.object.libvlc(), "key-action", id )
 
29
        return true
 
30
    else
 
31
        return false
 
32
    end
27
33
end
28
34
 
29
35
-- Take a video snapshot
48
54
-- print a table (recursively)
49
55
function table_print(t,prefix)
50
56
    local prefix = prefix or ""
 
57
    if not t then
 
58
        print(prefix.."/!\\ nil")
 
59
        return
 
60
    end
51
61
    for a,b in pairs_sorted(t) do
52
62
        print(prefix..tostring(a),b)
53
63
        if type(b)==type({}) then
57
67
end
58
68
 
59
69
-- print the list of callbacks registered in lua
 
70
-- useful for debug purposes
60
71
function print_callbacks()
61
72
    print "callbacks:"
62
73
    table_print(vlc.callbacks)
85
95
        vlc.var.set(input,"time",tonumber(value))
86
96
    end
87
97
end
 
98
 
 
99
function volume(value)
 
100
    if type(value)=="string" and string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
 
101
        vlc.volume.set(vlc.volume.get()+tonumber(value))
 
102
    else
 
103
        vlc.volume.set(tostring(value))
 
104
    end
 
105
end