Streaming to my Motorola Droid
#1
Hi,

I really like this app and while I had some time I tried adding streaming. This is a Proof of Concept implementation, not very robust, not configurable etc...

But you might want to use it as a starting point.
On the XBMC machine you need to install vlc with lua and x264 support.
android xbmc remote has a button stream episode if you click it the app will call a vlc website with the file you want to stream. vlc now start the stream and the android app starts the MediaPlayer with the stream address and if everything is fine the cellphone should display the episode.

On the vlc side you need to install my lua interface:
Code:
-- http_cmd.lua
require "common"
require "string"

vlc.msg.info("Lua HTTP command interface")

function ok()
      return [[Status: 200
Content-Type: text/plain
Content-Length:2

OK]]
end

function failed()
      return [[Status: 404
Content-Type: text/plain
Content-Length:5

False]]
end


function parse_url_request(request)
    if not request then return {} end
    local t = {}
    for k,v in string.gmatch(request,"([^=&]+)=?([^=&]*)") do
        local k_ = vlc.strings.decode_uri(k)
        local v_ = vlc.strings.decode_uri(v)
        if t[k_] ~= nil then
            local t2
            if type(t[k_]) ~= "table" then
                t2 = {}
                table.insert(t2,t[k_])
                t[k_] = t2
            else
                t2 = t[k_]
            end
            table.insert(t2,v_)
        else
            t[k_] = v_
        end
    end
    return t
end


function callback_cmd(data, url, request, type, inp, addr)

   vlc.msg.info(request)
   vlc.msg.info(addr)
   --local variables =
   local parameter = parse_url_request(request)
   --parseRequest(request, parameter)

   if parameter["file"] then

        local filename = parameter["file"] --string.gsub(parameter["file"], " ", "\\ ")
        vlc.msg.info("File request:" .. filename)
        v = vlc.vlm()

        v:execute_command( "del test" )
        v:execute_command( "new test broadcast enabled" )
        v:execute_command( "setup test input '".. filename.."'")
        v:execute_command( "setup test output #transcode{venc=x264{keyint=24,ref=3,bframes=0,profile=baseline,level=1.2,nocabac,qpmax=36,qpmin=10,me=hex,merange=24,subme=9,qcomp=0.6},scale=0.5,vcodec=h264,vb=350,acodec=mp4a,ab=32,channels=2,samplerate=48000,audio-sync}:gather:rtp{mp4a-latm,sdp=rtsp://0.0.0.0:6767/test.sdp}" )
        
        v:execute_command( "control test play" )
  end

   return ok()
end

local u = vlc.net.url_parse( config.host or "0.0.0.0:4212" )
h = vlc.httpd(u.host, u.port)
local a = h:handler("/cmd",nil,nil,nil,callback_cmd,nil)
while not vlc.misc.lock_and_wait() do end -- everything happens in callbacks
Start vlc:
Code:
vlc -vvvv -I lua --lua-intf http_cmd

My changes to xbmc remote ... ok I am not allowed to attach my patch ... who wants it?

Gastar
Reply
#2
Sure! Sorry I'm replying so late. Please paste this and your patch to the tracker, I'm checking this more regularly. A method to stream without third party tools (VLC) would be preferred though. Dharma will be able to post raw streams, so you may have a look at that.
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#3
Roger.

Added as Issue 350.
Reply

Logout Mark Read Team Forum Stats Members Help
Streaming to my Motorola Droid0