havlenapetr / FFMpeg

this is port of ffmpeg for android (this is app, but in future i will do android lib from it and then system will be able to convert videos automatically)
881 stars 419 forks source link

How to play audio only (e.g. wma)? #29

Open misol101 opened 13 years ago

misol101 commented 13 years ago

When I tried to open a wma file with the browser (after removing the extension check in java code), it failed to play, after prepareVideo fails (not surprisingly).

So I modified the mediaplayer.cpp file to not call prepareVideo, only audio. Unfortunately prepareAudio fails too. It finds an audio stream and reaches the point where Output::AudioDriver_set is called, but this call unfortunately fails.

Can you help out?

misol101 commented 13 years ago

Ok, scratch that. It actually does play, it is my quickly made AudioPlayerActivity which does nothing but create FFMPeg and then setDataSource and start which seems to cause it. I don't see the difference, but it must be there :)

misol101 commented 13 years ago

Oh, the difference was that the original FFmpgMovieView class actually calls setDisplay, which my activity didn't. If this is not called, then prepareAudio fails. I guess this could be considered a bug, since the documentation states "This call is optional. Not calling it when playing back a video will result in only the audio track being played." ?