kiall / android-tvheadend

Android + TV Headend + TV Input Framework
Apache License 2.0
191 stars 61 forks source link

Radio Stations need a background #161

Closed mihailescu2m closed 6 years ago

mihailescu2m commented 7 years ago

Radio transmitted over DVB play correctly (you can hear the sound) but the image, after initially being black when the stream connection is set up, changes to the last frame of a previous TV channel. It would be useful that either the background remains black, or a predefined image is shown while radio is playing.

kiall commented 7 years ago

Makes sense, I'll see what I can do to fill the BG black and possibly list the channel name in the middle or something.

girlpunk commented 7 years ago

Ideally this would pull and render the MGEG stream that's used for low-bandwidth graphics like radio channels and off-air messages. Unfortunately that's not supported by TvHeadend yet (waiting for this, which is due in 4.6).

In the mean time, showing the channel logo if it's available would be nice, and we could probably pull some information about the current program from the EPG if it's available.

girlpunk commented 7 years ago

Did some digging into this, looks like we would need to send the background through ExoPlayer as a stream, which means we'd need a custom StreamReader implementation to send the image in a format that ExoPlayer supports. This would probably also need some fudging with HtspExtractor to get the reader's consume() function called, as it wouldn't happen by default without HTS sending any packets for it. From there, we might also need something in Player.onTracksChanged() to use the extra track if there's no default video track available.

kiall commented 7 years ago

I wonder if we can use a MergingMediaSource to merge the HtspChannelDataSource with a SingleSampleMediaSource containing the background image?

I'm not sure we know to do this "early" enough though. So, I'm really only posting it here in case it triggers an idea rather than suggesting it as a solution :)

https://github.com/google/ExoPlayer/blob/release-v2/library/core/src/main/java/com/google/android/exoplayer2/source/MergingMediaSource.java

https://github.com/google/ExoPlayer/blob/release-v2/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java

girlpunk commented 7 years ago

That might work, but wouldn't the URL for the SingleSampleMediaSource still need to be in a format that ExoPlayer can handle? ExoPlayer can deal with anything that Android can, which includes PNGs.
I think the merge would need to be handled in Player.buildHtspMediaSource()?