Changeset 43055c96af0ccb6b70a449eba96bb2a2327a0194
- Timestamp:
- 04/06/08 19:00:26 (4 months ago)
- git-parent:
- Files:
-
- share/lua/http/dialogs/input (modified) (1 diff)
- share/lua/http/dialogs/sout (modified) (2 diffs)
- share/lua/http/flash.html (modified) (1 diff)
- share/lua/http/js/functions.js (modified) (9 diffs)
- share/lua/http/requests/status.xml (modified) (2 diffs)
- share/lua/intf/http.lua (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
share/lua/http/dialogs/input
rd8b6a43 r43055c9 33 33 </div> 34 34 <div class="controls"> 35 <label for="input_mrl">Input (MRL)</label>35 <label for="input_mrl">Input</label> 36 36 <?vlc if current_page == "vlm" then ?> 37 37 <input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_input_change();"/> 38 <?vlc else ?> 39 <input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) in_play();"/> 40 <?vlc end ?> 41 <div> 42 Options 43 <!-- <input type="button" value="Refresh options" onclick="refresh_input_options_list();" /> --> 44 <input type="button" value="Add option" onclick="add_input_option(':option=value');" /> 45 <div id="input_options_list"></div> 46 </div> 47 <?vlc if current_page == "vlm" then ?> 38 48 <input type="button" value="Ok" onclick="vlm_input_change();" /> 39 49 <input type="button" value="Cancel" onclick="hide('input');" /> 40 50 <input type="hidden" id="input_dest" value="" /> 41 51 <?vlc else ?> 42 <input type="text" name="input_mrl" id="input_mrl" size="60" onkeypress="if( event.keyCode == 13 ) in_play();"/>43 52 <input type="button" value="Play" onclick="in_play();" /> 44 53 <input type="button" value="Enqueue" onclick="in_enqueue();" /> share/lua/http/dialogs/sout
rd8b6a43 r43055c9 34 34 </div> 35 35 <div class="controls"> 36 <label for="sout_mrl">Destination (MRL)</label>36 <label for="sout_mrl">Destination</label> 37 37 <?vlc if current_page == "vlm" then ?> 38 <input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_output_change();" />38 <input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) vlm_output_change();" disabled="disabled" /> 39 39 <br/> 40 40 <input type="button" value="Ok" onclick="vlm_output_change();" /> … … 42 42 <input type="hidden" id="sout_dest" /> 43 43 <?vlc else ?> 44 <input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) save_sout();" />44 <input type="text" name="sout_mrl" id="sout_mrl" size="60" onkeypress="if( event.keyCode == 13 ) save_sout();" disabled="disabled" /> 45 45 <br/> 46 46 <input type="button" value="Save" onclick="save_sout();" /> share/lua/http/flash.html
rd8b6a43 r43055c9 14 14 // <![CDATA[ 15 15 host = document.location.toString().replace( /http:\/\//, '' ).replace( /[:/].*/, '' ); 16 input_options.push( ":sout=#transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv}" ); 17 input_options.push( ":no-sout-keep" ); 16 18 // ]]> 17 19 </script> 18 20 </head> 19 21 20 <body onload="hide('playlist'); ">22 <body onload="hide('playlist'); refresh_input_options_list();"> 21 23 <?vlc 22 24 current_page = "index" 23 25 dialogs("browse","main","input","playlist") ?> 24 25 <input id="sout_mrl" type="hidden" value=":sout=#transcode{vcodec=FLV1,acodec=mp3,channels=2,samplerate=44100}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8081/stream.flv} :no-sout-keep" />26 26 27 27 <div style='height: 100%; width: 100%; text-align: center;'> share/lua/http/js/functions.js
rd8b6a43 r43055c9 37 37 var slider_dx = 0; 38 38 39 var input_options = new Array(); 40 39 41 /* findPosX() from http://www.quirksmode.rg/js/indpos.html */ 40 42 function findPosX(obj) … … 284 286 *********************************************************************/ 285 287 /* input actions */ 286 function in_play ()288 function in_playenqueue( cmd ) 287 289 { 288 290 var input = value('input_mrl'); 289 if( value('sout_mrl') != '' ) 290 input += ' '+value('sout_mrl'); 291 var url = 'requests/status.xml?command=in_play&input='+encodeURIComponent( addslashes(escapebackslashes(input)) ); 291 var url = 'requests/status.xml?command=in_'+cmd+'&input='+encodeURIComponent( addslashes(escapebackslashes(input)) ); 292 for( i in input_options ) 293 if( input_options[i] != ':option=value' ) 294 url += '&option='+encodeURIComponent( addslashes(escapebackslashes(input_options[i]) )); 292 295 loadXMLDoc( url, parse_status ); 293 296 setTimeout( 'update_playlist()', 1000 ); 294 297 } 298 299 function in_play() 300 { 301 in_playenqueue( 'play' ); 302 } 303 295 304 function in_enqueue() 296 305 { 297 var input = value('input_mrl'); 298 if( value('sout_mrl') != '' ) 299 input += ' '+value('sout_mrl'); 300 var url = 'requests/status.xml?command=in_enqueue&input='+encodeURIComponent( addslashes(escapebackslashes(input)) ); 301 loadXMLDoc( url, parse_status ); 302 setTimeout( 'update_playlist()', 1000 ); 306 in_playenqueue( 'enqueue' ); 303 307 } 304 308 … … 772 776 } 773 777 778 remove_input_options( ':sub-track' ); 779 remove_input_options( ':audio-track' ); 780 774 781 if( type != "cdda" ) 775 782 { 776 783 if( subs != '' ) 777 mrl.value += " :sub-track="+subs;784 add_input_option( ":sub-track="+subs ); 778 785 if( audio != '' ) 779 mrl.value += " :audio-track="+audio;786 add_input_option( ":audio-track="+audio ); 780 787 } 781 788 … … 826 833 } 827 834 835 remove_input_options( ':access-filter' ); 828 836 if( checked( "input_net_timeshift" ) ) 829 mrl.value += " :access-filter=timeshift";837 add_input_option( ":access-filter=timeshift" ); 830 838 } 831 839 … … 833 841 function update_input_fake() 834 842 { 843 remove_input_options( ":fake" ); 835 844 var mrl = document.getElementById( 'input_mrl' ); 836 845 837 846 mrl.value = "fake:"; 838 mrl.value += " :fake-file=" + value( "input_fake_filename" ); 847 848 add_input_option( ":fake-file=" + value( "input_fake_filename" ) ); 839 849 840 850 if( value( "input_fake_width" ) ) 841 mrl.value += " :fake-width=" + value( "input_fake_width");851 add_input_option( ":fake-width=" + value( "input_fake_width" ) ); 842 852 if( value( "input_fake_height" ) ) 843 mrl.value += " :fake-height=" + value( "input_fake_height");853 add_input_option( ":fake-height=" + value( "input_fake_height" ) ); 844 854 if( value( "input_fake_ar" ) ) 845 mrl.value += " :fake-ar=" + value( "input_fake_ar");855 add_input_option( ":fake-ar=" + value( "input_fake_ar" ) ); 846 856 } 847 857 … … 868 878 function update_sout() 869 879 { 870 var mrl = document.getElementById( 'sout_mrl' ); 871 mrl.value = ""; 880 var option = ""; 881 /* Remove all options starting with :sout since we're going to write them 882 * again. */ 883 remove_input_options( ":sout" ); 872 884 873 885 check_and_replace_int( 'sout_http_port', 8080 ); … … 893 905 if( transcode ) 894 906 { 895 mrl.value += ":sout=#transcode{";907 option = ":sout=#transcode{"; 896 908 var alot = false; /* alot == at least one transcode */ 897 909 if( checked( 'sout_vcodec_s' ) ) 898 910 { 899 mrl.value+= "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' );911 option += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' ); 900 912 alot = true; 901 913 } 902 914 if( checked( 'sout_acodec_s' ) ) 903 915 { 904 if( alot ) mrl.value+= ",";905 mrl.value+= "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' );916 if( alot ) option += ","; 917 option += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' ); 906 918 if( value( 'sout_channels' ) ) 907 mrl.value+= ",channels="+value( 'sout_channels' );919 option += ",channels="+value( 'sout_channels' ); 908 920 alot = true; 909 921 } 910 922 if( checked( 'sout_soverlay' ) ) 911 923 { 912 if( alot ) mrl.value+= ",";913 mrl.value+= "soverlay";924 if( alot ) option += ","; 925 option += "soverlay"; 914 926 alot = true; 915 927 } 916 928 else if( checked( 'sout_sub' ) ) 917 929 { 918 if( alot ) mrl.value+= ",";919 mrl.value+= "scodec="+value( 'sout_scodec' );930 if( alot ) option += ","; 931 option += "scodec="+value( 'sout_scodec' ); 920 932 alot = true; 921 933 } 922 mrl.value+= value( 'sout_transcode_extra' );934 option += value( 'sout_transcode_extra' ); 923 935 924 mrl.value += "}"; 936 option += "}"; 937 925 938 } 926 939 … … 932 945 { 933 946 if( transcode ) 934 mrl.value+= ":";947 option += ":"; 935 948 else 936 mrl.value+= ":sout=#";949 option += ":sout=#"; 937 950 var aloo = false; /* aloo == at least one output */ 938 951 var mux = radio_value( 'sout_mux' ); 939 952 var ttl = parseInt( value( 'sout_ttl' ) ); 940 if( output > 1 ) mrl.value+= "duplicate{";953 if( output > 1 ) option += "duplicate{"; 941 954 if( checked( 'sout_display' ) ) 942 955 { 943 if( output > 1 ) mrl.value+= "dst="944 mrl.value+= "display";956 if( output > 1 ) option += "dst=" 957 option += "display"; 945 958 aloo = true; 946 959 } 947 960 if( checked( 'sout_file' ) ) 948 961 { 949 if( aloo ) mrl.value+= ",";950 if( output > 1 ) mrl.value+= "dst="951 mrl.value+= "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}";962 if( aloo ) option += ","; 963 if( output > 1 ) option += "dst=" 964 option += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}"; 952 965 aloo = true; 953 966 } 954 967 if( checked( 'sout_http' ) ) 955 968 { 956 if( aloo ) mrl.value+= ",";957 if( output > 1 ) mrl.value+= "dst="958 mrl.value+= "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' );969 if( aloo ) option += ","; 970 if( output > 1 ) option += "dst=" 971 option += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' ); 959 972 if( value( 'sout_http_port' ) ) 960 mrl.value+= ":"+value( 'sout_http_port' );961 mrl.value+= "}";973 option += ":"+value( 'sout_http_port' ); 974 option += "}"; 962 975 aloo = true; 963 976 } 964 977 if( checked( 'sout_mmsh' ) ) 965 978 { 966 if( aloo ) mrl.value+= ",";967 if( output > 1 ) mrl.value+= "dst="968 mrl.value+= "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' );979 if( aloo ) option += ","; 980 if( output > 1 ) option += "dst=" 981 option += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' ); 969 982 if( value( 'sout_mmsh_port' ) ) 970 mrl.value+= ":"+value( 'sout_mmsh_port' );971 mrl.value+= "}";983 option += ":"+value( 'sout_mmsh_port' ); 984 option += "}"; 972 985 aloo = true; 973 986 } 974 987 if( checked( 'sout_rtp' ) ) 975 988 { 976 if( aloo ) mrl.value+= ",";977 if( output > 1 ) mrl.value+= "dst="978 mrl.value+= "std{access=rtp";979 if( ttl ) mrl.value+= "{ttl="+ttl+"}";980 mrl.value+= ",mux="+mux+",dst="+value( 'sout_rtp_addr' );989 if( aloo ) option += ","; 990 if( output > 1 ) option += "dst=" 991 option += "std{access=rtp"; 992 if( ttl ) option += "{ttl="+ttl+"}"; 993 option += ",mux="+mux+",dst="+value( 'sout_rtp_addr' ); 981 994 if( value( 'sout_rtp_port' ) ) 982 mrl.value+= ":"+value( 'sout_rtp_port' );995 option += ":"+value( 'sout_rtp_port' ); 983 996 if( checked( 'sout_sap' ) ) 984 997 { 985 mrl.value+= ",sap";998 option += ",sap"; 986 999 if( value( 'sout_sap_group' ) != '' ) 987 1000 { 988 mrl.value+= ",group=\""+value( 'sout_sap_group' )+"\"";1001 option += ",group=\""+value( 'sout_sap_group' )+"\""; 989 1002 } 990 mrl.value+= ",name=\""+value( 'sout_sap_name' )+"\"";991 } 992 mrl.value+= "}";1003 option += ",name=\""+value( 'sout_sap_name' )+"\""; 1004 } 1005 option += "}"; 993 1006 aloo = true; 994 1007 } 995 1008 if( checked( 'sout_udp' ) ) 996 1009 { 997 if( aloo ) mrl.value+= ",";998 if( output > 1 ) mrl.value+= "dst="999 mrl.value+= "std{access=udp";1000 if( ttl ) mrl.value+= "{ttl="+ttl+"}";1001 mrl.value+= ",mux="+mux+",dst="+value( 'sout_udp_addr' );1010 if( aloo ) option += ","; 1011 if( output > 1 ) option += "dst=" 1012 option += "std{access=udp"; 1013 if( ttl ) option += "{ttl="+ttl+"}"; 1014 option += ",mux="+mux+",dst="+value( 'sout_udp_addr' ); 1002 1015 if( value('sout_udp_port' ) ) 1003 mrl.value+= ":"+value( 'sout_udp_port' );1016 option += ":"+value( 'sout_udp_port' ); 1004 1017 if( checked( 'sout_sap' ) ) 1005 1018 { 1006 mrl.value+= ",sap";1019 option += ",sap"; 1007 1020 if( value( 'sout_sap_group' ) != '' ) 1008 1021 { 1009 mrl.value+= ",group=\""+value( 'sout_sap_group' )+"\"";1022 option += ",group=\""+value( 'sout_sap_group' )+"\""; 1010 1023 } 1011 mrl.value+= ",name=\""+value( 'sout_sap_name' )+"\"";1012 } 1013 mrl.value+= "}";1024 option += ",name=\""+value( 'sout_sap_name' )+"\""; 1025 } 1026 option += "}"; 1014 1027 aloo = true; 1015 1028 } 1016 if( output > 1 ) mrl.value += "}"; 1017 } 1029 if( output > 1 ) option += "}"; 1030 } 1031 1032 if( option != "" ) 1033 input_options.push( option ); 1018 1034 1019 1035 if( ( transcode || output ) && checked( 'sout_all' ) ) 1020 mrl.value += " :sout-all"; 1036 input_options.push( ":sout-all" ); 1037 1038 /*var mrl = document.getElementById( 'sout_mrl' ); 1039 mrl.value = input_options.join( " " )*/ 1040 1041 refresh_input_options_list(); 1021 1042 } 1022 1043 … … 1032 1053 document.getElementById('sout_old_mrl').value = value('sout_mrl'); 1033 1054 } 1055 1056 function refresh_input_options_list() 1057 { 1058 var iol = document.getElementById( 'input_options_list' ); 1059 clear_children( iol ); 1060 input_options.sort(); 1061 for( i in input_options ) 1062 { 1063 var o = document.createElement( 'div' ); 1064 var ot = document.createElement( 'input' ); 1065 ot.setAttribute( 'type', 'text' ); 1066 ot.setAttribute( 'size', '60' ); 1067 ot.setAttribute( 'value', input_options[i] ); 1068 ot.setAttribute( 'id', 'input_option_item_'+i ); 1069 ot.setAttribute( 'onchange', 'javascript:save_input_option('+i+',this.value);' ); 1070 ot.setAttribute( 'onfocus', 'if( this.value == ":option=value" ) this.value = ":";' ); 1071 ot.setAttribute( 'onblur', 'if( this.value == ":" ) this.value = ":option=value";' ); 1072 o.appendChild( ot ); 1073 var od = document.createElement( 'a' ); 1074 od.setAttribute( 'href', 'javascript:delete_input_option('+i+');' ); 1075 var delimg = document.createElement( "img" ); 1076 delimg.setAttribute( 'src', 'images/delete_small.png' ); 1077 delimg.setAttribute( 'alt', '(delete)' ); 1078 od.appendChild( delimg ); 1079 o.appendChild( od ); 1080 iol.appendChild( o ); 1081 } 1082 } 1083 1084 function delete_input_option( i ) 1085 { 1086 input_options.splice(i,1); 1087 refresh_input_options_list(); 1088 } 1089 1090 function save_input_option( i, value ) 1091 { 1092 input_options[i] = value; 1093 refresh_input_options_list(); 1094 } 1095 1096 function add_input_option( value ) 1097 { 1098 input_options.push( value ); 1099 refresh_input_options_list(); 1100 } 1101 1102 function remove_input_options( prefix ) 1103 { 1104 for( i in input_options ) 1105 if( input_options[i].substring( 0, prefix.length ) == prefix ) 1106 { 1107 delete input_options[i]; 1108 i--; 1109 } 1110 } 1111 1034 1112 1035 1113 /********************************************************************** share/lua/http/requests/status.xml
rd8b6a43 r43055c9 31 31 local id = tonumber(_GET['id'] or -1) 32 32 local val = _GET['val'] 33 local options = _GET['option'] 34 if type(options) ~= "table" then -- Deal with the 0 or 1 option case 35 options = { options } 36 end 33 37 34 -- vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))38 ---[[]] vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val)) 35 39 36 40 local function stripslashes(s) … … 41 45 42 46 if command == "in_play" then 43 local options = {} 44 for o in string.gmatch(input," :[^ ]*") do -- FIXME: options should be in seperate variables, not in the same string as the input. 45 table.insert(options,string.sub(o,3)) 47 ---[[ 48 vlc.msg.err( "<options>" ) 49 for a,b in ipairs(options) do 50 vlc.msg.err(b) 46 51 end 52 vlc.msg.err( "</options>" ) 53 --]] 47 54 vlc.playlist.add({{path=stripslashes(input),options=options}}) 48 55 elseif command == "in_enqueue" then 49 vlc.playlist.enqueue( stripslashes(input))56 vlc.playlist.enqueue({{path=stripslashes(input),options=options}}) 50 57 elseif command == "pl_play" then 51 58 vlc.playlist.goto(id) share/lua/intf/http.lua
rd8b6a43 r43055c9 36 36 require "common" 37 37 38 vlc.msg. err("Lua HTTP interface")38 vlc.msg.info("Lua HTTP interface") 39 39 40 40 open_tag = "<?vlc" … … 176 176 local k_ = vlc.decode_uri(k) 177 177 local v_ = vlc.decode_uri(v) 178 t[k_]=v_ 178 if t[k_] ~= nil then 179 local t2 180 if type(t[k_]) ~= "table" then 181 t2 = {} 182 table.insert(t2,t[k_]) 183 t[k_] = t2 184 else 185 t2 = t[k_] 186 end 187 table.insert(t2,v_) 188 else 189 t[k_] = v_ 190 end 179 191 end 180 192 return t
