I searched several days on the Internet for tutorials or examples of how to use libmms. It seems that there is not one that is strange for lib, which seems to be widely used.
LibMMS is a common library for parsing mms: // and mmsh: // the type of network streams. http://sourceforge.net/projects/libmms/files/libmms/0.6.2/libmms-0.6.2.tar.gz/download
The only sample code I found was from another post on stackoverflow.
What will be shown below.
mms_connect(NULL, NULL, g_tcUrl.av_val, g_hostname.av_val, g_playpath.av_val, "", g_port, 128*1024)
Note:
NSString* strTemp; strTemp = @"mms://123.30.49.85/htv2"; // strTemp = @"mms://212.58.251.92/wms/bbc_ami/radio1/radio1_bb_live_int_eq1_sl0"; g_tcUrl.av_val = new char[[strTemp length] + 1]; [strTemp getCString:g_tcUrl.av_val maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; g_tcUrl.av_len = strlen(g_tcUrl.av_val); //strTemp = @"212.58.251.92"; strTemp = @"123.30.49.85"; g_hostname.av_val = new char[[strTemp length]+1]; [strTemp getCString:g_hostname.av_val maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; g_hostname.av_len = strlen(g_hostname.av_val); //strTemp = @"/wms/bbc_ami/radio1/radio1_bb_live_int_eq1_sl0"; strTemp = @"/htv2"; g_playpath.av_val = new char[[strTemp length] + 1]; [strTemp getCString:g_playpath.av_val maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; g_playpath.av_len = strlen(g_playpath.av_val); g_port = 1755;
This is not objective C, but shows what needs to be passed to the mms_connect method.
So, I created a new project, included all the necessary libmms files and built it. Compiled fine.
The next step was to turn on
#import "mms.h" #import "mms_config.h"
and declare
mms_t *mms = 0;
No problem so far.
The next thing I wanted to try is to call the mms_connect method, and this is where I got stuck.
I'm not a C programmer, so it might look FUBAR, but it was the best attempt. I can not use
char *g_tcUrl = new char[[strTemp length] + 1];
because the new one is not recognized in lens c in the way it is used here. What should I use to achieve the same effect in Objective-C?
mms_t *mms = 0; NSString* strTemp; strTemp = @"mms://123.30.49.85/htv2"; char *g_tcUrl = new char[[strTemp length] + 1]; [strTemp getCString:g_tcUrl maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; strTemp = @"123.30.49.85"; char *g_hostname = new char[[strTemp length]+1]; [strTemp getCString:g_hostname maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; strTemp = @"/htv2"; char * g_playpath = new char[[strTemp length] + 1]; [strTemp getCString:g_playpath maxLength:([strTemp length]+1) encoding:NSUTF8StringEncoding]; int g_port = 1755;
Now I am trying to mix C code inside objective-c files. This code was inside my viewDidLoad when I try to check and figure out exactly how to use libmms.
Guys, I would appreciate all the advice and help you can offer in my searches to get libmms to work in my application.
code