eriksl / streamproxy

This stream proxy can replace the streamproxy, transtreamproxy and filestreamproxy on VU+ receiver. Care has been taken to always fetch all bufferend data, so the transcoding engine won't crash.
Other
11 stars 14 forks source link

Use this streamproxy for VU+ / Openatv? #8

Open jbleyel opened 5 years ago

jbleyel commented 5 years ago

Hi Erik, do you have any problems with that? The original VU code of this is very old.

eriksl commented 5 years ago

No, in the contrary, I'd like it very much. For the simple reason we can have a uniform interface, easier for the Android/Apple apps developers.

jbleyel commented 5 years ago

Hi Erik, I see only 2 open points.

  1. changes will affect after reboot
  2. authentication like the original VU code

Do you see any way to fix these 2 open points. I can try to help coding but i don't have a build environment for debugging or testing.

eriksl commented 5 years ago

What do you mean by #1? Streamproxy has a file monitor on /etc/enigma2/settings and /etc/enigma2/streamproxy.conf. If either one is changed, streamproxy restarts.

I also don't understand #2? It's a veeeery long time ago that I saw the code of transtreamproxy.

jbleyel commented 5 years ago

Okay ..

  1. DONE
  2. I mean the OWF authentication and streaming authentication should be not mixed. In my case: I want streaming authentication enabled but no http authentication for the openwebif. OR i want streaming authentication via SID (sessionid) created by OWF.
eriksl commented 5 years ago

Does transtreamproxy understand this OWIF "sid"? I can't remember, but it may have been added.

2a This is interesting. I was going to try it, but the OWIF config doesn't allow me. When I set HTTP authentication to "no", the option for "Enable authentication for streaming" disappears. Streamproxy does parse the enigma2/settings file though and uses the setting config.OpenWebif.auth. Currently it does not know of the config.OpenWebif.auth_for_streaming option. I could add support for it.

2b Streamproxy uses the same http basic authentication realm as OWIF (if not changed in the meantime), so once the user has logged in with OWIF, he doesn't have to login to streamproxy (as long as the basic auth request is fulfilled, any proper browser will do this). So at the moment I don't see the requirement for passing a "session id"?

jbleyel commented 5 years ago

This sid is a something like a logon token and you don't need to check the auth logon if done this by openwebif already. Schmmelreiter has also reintegrated your OWF changes.

eriksl commented 5 years ago

Reverted it. That is two hours of work I spent tonight for adapting streamproxy down the drain.

Ok, he broke it, he can keep the pieces. If you and anudanan want your problems fixed, have him do it.

There is more than OWIF and Schimmelreiter's version of streamproxy, which apparently can't be fixed to act sensibly.

The "token" ID assumes streaming is always initiated from OWIF and that is simply not true, nor will I limit streamproxy to be only operational in combination with OWIF.

jbleyel commented 5 years ago

Sorry, i'm not too deep in this hole thing. All what i want is only one stable streaming / transcoding solution. Too many different implementations will increase the complexity and this is not helpful. We should work together and not against.

eriksl commented 5 years ago

A blunt revert seriously makes my motivation go away very quickly.

So now I reverted Schimmelreiter's revert on our OE as patch, so my work isn't lost.

Now it's up to Schimmelreiter for a proposal to either keep this situation or fix it in a constructive way.

jbleyel commented 5 years ago

That's exactly my concern. He has investigate a lot and spend many time. There is probably not THIS single solution but it should work on all distros with all possible use case at the end of the day.

eriksl commented 5 years ago

You seem to forget the time I spent...

Anyway, I am not going to spend much time on neither streamproxy nor any other streaming/transcoding solution.

This is functionality that should be in enigma itself (like the Xtrend patch does for their transcoding). Once that is done, all issues regarding authentication are gone and OWIF is no longer necessary to set up a service. In the ideal case, all images will start using that code and drop their own streaming/transcoding solutions. It should not be rocket science to make the interface compatible with all of them.

Now only find the time.

eriksl commented 5 years ago

I have some plans to make a.o. the "session cookie" authentication working (which never worked before between OWIF and streamproxy). That will also fix the other authentication issues we're now having between OWIF and streamproxy, I think. Most of the work I'll do myself, in streamproxy, but for OWIF I could do with some help, as I am not that familiar with either OWIF or Python.

I already add some code to OpenPLi enigma2 to facilitate this, a.o. I added an alternative "converter" called "streaming2" that implements the addition of the selected audio stream. I don't think the code is very good, it copies most of the streaming converter, I guess that could be done better.

For testing with OWIF I copied the "stream" controller+adapter in stream.py to stream2.py and make a few small changes there (call converter Stream2 instead of Stream and add the selected audio track to the output). I also made a dummy "authenticate" page in the "web" controller.

Altogether it works but it's ugly. I would be very grateful if one of you OWIF developers would implement the OWIF part in a proper way. Do you think that's possible?

jbleyel commented 5 years ago

Hi Erik, what you mean with "session cookie"? Please think about non browser usage.

I will check the OWF modifications and probably we don't need a second stream.py. We can remove the stream2.py later on if stream.py works for you too.

eriksl commented 5 years ago

What I mean with "session cookie" is the construct that OWIF uses to pass it outside the browser, the "-sid:" thing. I am going to make sure that it will end up in OWIF no matter if streamproxy uses it's own authentication or not, by requesting the authentication page from OWIF with the "-sid" authentication present.

I was proposing a separate stream page for two reasons:

But if you think it can be done in another way, please don't hesitate.

jbleyel commented 5 years ago

Okay. understud. Then we should start with the stream2.py to get it work and don't break anything else.

eriksl commented 5 years ago

If you could come up with something, that would be great, do you need any additional information?

There is a "new" Streaming2.py converter in OpenPLi enigma, it's a simple clone from Streaming.py with the "default audio pid" property added (when available), like this:

       if s is None or not any(s):
           err = hasattr(service, 'getError') and service.getError()
           if err:
               return _("-SERVICE ERROR:%d\n") % err
           else:
               return _("=NO STREAM\n")

                retval = "+%d:%s" % (s["demux"], ','.join(["%x:%s" % (x[0], x[1]) for x in s["pids"]]))

                if "default_audio_pid" in s:
                        retval += ",%x:%s" % (s["default_audio_pid"], "default_audio_pid")

                retval += "\n"

                return(retval);

I guess it could also be added to the existing Streaming.py converter, but with a parameter to select whether default_audio_pid should be added to the output. But I have no idea how to do that at this point in Enigma, so I simply duplicated existing code (which indeed is ugly).