oatpp / example-hls-media-stream

Example project how-to build HLS-streaming server using oat++ Async-API.

Home Page:https://oatpp.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access request/controller from MediaController member function

vinkaga opened this issue · comments

My C++ is very rusty :-).

I was trying to move lines https://github.com/oatpp/example-hls-media-stream/blob/master/src/controller/MediaController.hpp#L145-L170 out to a MediaController member function in another file. I am not able to access request and controller from inside of that member function. Of course I can pass them as parameters but I was trying to figure out the correct way of doing it.

Can you provide an example where you move those lines to another file (so that controller code is more readable)? Thanks.

@vinkaga

How to access request/controller from MediaController member function

The MediaController and the controller is the same object here. So in order to access the controller from MediaController member function you just access its' fields directly.

Request is the object which is passed to the Endpoint Coroutine. MediaController can't access it directly. So you have to pass Request object in the MediaController member function in order to access it from there.

Thanks for the info and the example!

You are welcome!