Skip to content
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

Create MediaSource from FileDescriptor #3757

Closed
jmgirven opened this issue Jan 26, 2018 · 3 comments
Closed

Create MediaSource from FileDescriptor #3757

jmgirven opened this issue Jan 26, 2018 · 3 comments
Assignees
Labels

Comments

@jmgirven
Copy link

I have an Android box which allows a HDMI input. I have been given some code that grabs the data stream from the HDMI input and writes an MPEG TS stream to a FileDescriptor. I wondered if I could pass this FileDescriptor into ExoPlayer as a MediaSource for playback? I couldn't see a way to do that in the current API. Old questions reference a FrameworkSampleSource that seems long since removed.

@jmgirven
Copy link
Author

jmgirven commented Feb 7, 2018

Sorry to bug you guys, but I wondered if you had any idea on this?

@AquilesCanta
Copy link
Contributor

Since the content is TransportStream, the media source will be an ExtractorMediaSource. Your issue is going to be the DataSource which you pass to the media source.

As far as I know, there is no way to create a DataSource from a FileDescriptor directly. However, you might be able to emulate what the AssetDataSource does, which uses an InputStream to read the assets' data. So, you could create a FileInputStream and use that in a similar way to create a FileDescriptorDataSource (or equivalent). Note: we already count with a FileDataSource, but it uses a RandomAccessFile. I don't know whether synchronization is going to be an issue for you. Or maybe there is a simpler solution, but it is not possible to know with the provided information. Let us know if you manage to give it a try.

@rraallvv
Copy link

I have a similar use case, I have the file contents (only MP3 and MP4) in a non-seekable InputStream extracted on-the-fly from a compressed container. Has anyone managed to create a custom AssetDataSource-like wrapper for the InputStream?

@google google locked and limited conversation to collaborators Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants