-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto
, hide
and always
three background drawing mode support.
#50
Conversation
So technically we can now not have to deal with the black screen and just render the incoming flow when it comes ? |
This may be make #37 possible. |
@moda20 It should be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR! I have a few suggestions for your changes before merging them:
-
It seems your IDE modified the indentation in a lot of places. I have now streamlined many project files to consistently use four spaces instead of tabs, so please rebase on that commit and remove your modifications to indentation. It’s difficult to figure out the actual changes you made since there are lots of line replacements highlighted that are really just the indentation.
-
For my use case, I still want the background to be visible independent of whether there is an active connection. Thus, please add a command line option for setting the background behavior. I suggest this to be an additional argument to the -b flag that indicates the desired background mode: "0": Don’t draw any background, "1": Draw background only while there’s an active connection, "2": Always draw background. Probably strings for the different modes would be better than numbers (and more in line with the audio sink selection), but I can’t come up with any short descriptive names. Let me know if you have any ideas! For the case that the user chooses to always draw the background, please move the call to video_renderer_render_background into rpiplay.cpp, to the place immediately after the video renderer is initialised. That way, it's always rpiplay.cpp's responsibility to manage the background, instead of having it spread around in rpiplay.cpp and the renderer itself. This should also allow us to remove the background argument to the renderer initialisation.
lib/raop.h
Outdated
@@ -28,19 +28,22 @@ extern "C" { | |||
|
|||
|
|||
typedef struct raop_s raop_t; | |||
typedef struct raop_conn_s raop_conn_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's that for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in new added callbacks conn_init
and conn_destory
for generic usage. In terms of drawing background, it is not necessary.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, this is just the typedef. At first glance, I thought it was a global variable. Still, just for the background rendering, I'd prefer not to expose library internals. If we need it at a later point, we can still add it back in pretty easily. So, I'd suggest to remove the raop_conn_t argument from the two new callback functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the conn
parameter from conn_init
and conn_destroy
and the conn typedef in the latest commit
@@ -117,7 +133,7 @@ int video_renderer_init_decoder(video_renderer_t *renderer) { | |||
|
|||
bcm_host_init(); | |||
|
|||
if (renderer->background) video_renderer_draw_background(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my use case, I still want the background to be drawn independent of whether there is an actual connection. Thus, please add a command line option for toggling the background mode, more details in the discussion thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the case that the user chooses to always draw the background, please move the call to video_renderer_render_background into rpiplay.cpp, to the place immediately after the video renderer is initialised. That way, it's always rpiplay.cpp's responsibility to manage the background, instead of having it spread around in rpiplay.cpp and the renderer itself. This should also allow us to remove the background argument to the renderer initialisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In latest commit, there is a new function video_renderer_update_background
will be called in video_renderer_init to support always
background drawing mode.
rpiplay.cpp
is responsable to call video_renderer_update_background
in conn_init
and conn_destroy
that seems only can be set to raop_t instance in start_server
of rpiplay.cpp
.
If there is better way to move all background details to video renderer, please tell me, I will do it.
renderers/video_renderer_rpi.c
Outdated
@@ -59,36 +59,52 @@ struct video_renderer_s { | |||
uint64_t input_frames; | |||
}; | |||
|
|||
DISPMANX_ELEMENT_HANDLE_T background = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this into the video_renderer_s struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been done in latest commit
Thanks for your review. I will take some time to make some explanations and changes these days for this PR. |
It may be that I see inconsistencies in the indentation and habitually reformat it. In future collaborations, I will keep the original format as much as possible, and only submit logic change code. By the way, we can use (EditorConfig)[https://editorconfig.org] that helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
I have refactored
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your modifications!
Before I can merge this, please also correct the indentation to match the four spaces that are used in most of the rest of the project.
EditorConfig seems like a good way to automatically maintain a coding style. If you have experience setting it up, please submit a separate PR for that. Please note that since this project includes files from various different origins, they adhere to different coding styles at the moment. I tried to streamline them all, but some make use of kind of ASCII-art formatting that would look weird if imposing a different coding style. Ideally, they'd have to manually be corrected.
rpiplay.cpp
Outdated
@@ -36,13 +36,13 @@ | |||
#define VERSION "1.2" | |||
|
|||
#define DEFAULT_NAME "RPiPlay" | |||
#define DEFAULT_SHOW_BACKGROUND true | |||
#define DEFAULT_BACKGROUND 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make it default to always/on, to keep backwards-compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been done.
Great, thanks! Please squash your commits so we don't have all these small commits cluttering the commit history and I'll happily merge it! |
auto
, hide
and always
three background drawing mode support.
The commits has been squashed and renamed the name of the PR. |
Merged into master and working fine. Thanks again for your contribution! |
is the compilation process still the same ? how to choose between the new parameters when launching ? |
@moda20 compilation process has not changed. take a look at the updated README.md usage section for new parameters |
This PR extended raop_callback_s to provide two more callbacks:
conn_init
andconn_destroy
.So we can listen the connection activity to render background when first connection connected and remove background when last connection disconnected.