0

These days, I was researching the software architechture for iPhone Streaming (Base on MMS protocol).

As we know, in order to playback MMS audio stream, we should call libMMS to read wma stream data from remote media server, and then call FFmpeg to decode the stream data from wma format into PCM data buffer, and finally, enqueue the PCM data buffer into iPhone’s audioqueue to generate real sound.

The introduction above just describe the working process of iPhone streaming. If we only need to implement this simple functionality, that is not difficult. Just follow the introduction above to call libMMS, FFMpeg and audioqueue step by step, we can achieve the streaming function. Actually, I have implemented the code last week.

But, what I need is not only a simple streaming function! I need a software architechture makes FFmpeg accessing libMMS just like accessing local filesystem!

Does anybody know how to hook the libMMS interfaces like mms_read/mms_seek onto FFmpeg filesystem interfaces like av_read_frame/av_seek_frame?

Xie Xingwei
  • 81
  • 1
  • 7

1 Answers1

1

I think I have to answer my own question again this time……

After several weeks reseach and debuging, I got the truth finally.

Actually, we don’t need to “hook” libMMS onto FFMpeg. Why? Because the FFMpeg already has its native mms protocol process module “mms_protocol” (see in mms_protocol.c in FFMpeg).

All we need to do is just configuring the FFMpeg to enable the mms module like this (see in config.h in FFMpeg):

#define ENABLE_MMS_PROTOCOL 1
#define CONFIG_MMS_PROTOCOL 1

After this configuration, FFMpeg will add mms protocol into its protocol list. (Actually, the protocol list has already contained “local file system protocol”). As result, the FFMpeg could be able to treat the “mms://hostserver/abc” media file like local media file. Therefore, we can still open and read the mms media file using:

av_open_input_file();
av_read_frame();

like we did on local media file before!

By the way, in my ffmpeg version, there are still many bugs in libAVFormat module for proccessing mms protocol. It took one week for me to debug it, however, I think it will be much shorter for the guy as smart as you:-)

Xie Xingwei
  • 81
  • 1
  • 7