0

I have been through many posts and installed libmms library in my project but i'm getting errors when i compile my project.

Does anyone have steps to install libmms library in iphone project? Does anyone have sample code to call libmms functions?

Thanks

Nick Weaver
  • 47,228
  • 12
  • 98
  • 108

2 Answers2

2

You need to compile the Libmms source code using xCode that will give you the Libmms libraries. For this you need the source code that has already been modified for the iPhone.

Since Libmms is Open Source, there are some projects on the Internet that includes Libmms and will give you this iPhone version that you will compile. You can take a look at WunderRadio, because they have the xCode Project that includes Libmms.

One very important thing, that was giving me problems when I first tried compile Libmms, is to put the headers in your Path or some other place, and point this path on xCode. If you are using xCode 4, just click on Targets, choose Build Settings and search for Header Search Paths. And don't forget to check the Recursive option.

You'll need to compile one Product version for the iPhone Simulator and another for armv6/armv7, to run Libmms on the iPhone also. So, it's a two steps process. Build for the Simulator and when it's done build for the iPhone.

Once you have everything setup just Build, don't Run the project. The Products will be two compiled libraries. Just Right click each one and choose Show in Finder and you'll know where xCode has put them. These two libraries you'll have to put in your xCode Project. And again, don't forget to include the headers path for Libmms in your Project, otherwise when you choose Run the compiler will complain because it can't find the headers for Libmms.

I hope that helps.

To establish a connection you must #include "mmsx.h" in your Application header file. You need to use the functions in your .m file, like so:

Use a pointer to mmsx_connect, with these parameters: mmsx_connect (mms_io_t *io, void *data, const char *url,const char *host, const char * uri, const char *query,int port,char *scheme,int bandwidth)

To read the file, use mmsx_read (mms_io_t *io, mmsx_t *instance, char *data, int len);

To close the connection use mmsx_close (mmsx_t *instance).

And if you need more functions, just take a look at mmsx.h and the functions there are self explanatory on how to use them.

neowinston
  • 7,584
  • 10
  • 52
  • 83
0

I guess you'll be using FFmpeg for decoding the audio streams. But did you know that you can also use FFmpeg for connecting to mms streams?

const char *url = "mmst://somemmsurlhere.com";
avformat_open_input(formatCtx, url, NULL, NULL);

With just one line of code you can connect to mms streams. If connection over tcp fails you can also try with the mmsh:// scheme which will try to connect to port 80.

Once you're connected you can use the av_read_frame fucnction of FFmpeg which will read the mms audio packets and pass the audio packets to the avcodec_decode_audio3 for decoding.

Kemal Taskin
  • 481
  • 4
  • 10