Using libmms from Objective-C
I want to use libmms in an objective-c project. I've taken the project from here - http://www.tunein-radio.com/lgpl.html - and included the libmms library in my own project. This avoids me having to compile libmms myself. Initially I just want to see if it works and hopefully output some audio.
Here's what I have so far in my header file:
#import <UIKit/UIKit.h>
#import "mmsio.h"
#import "mms.h"
#define streamURL @"path/to/stream"
@interface radiotestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
struct mms_t_io *io;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
I'm not really sure where to go from here but think I need to use t开发者_开发技巧his method from mms.h:
mms_t* mms_connect (mms_io_t *io, void *data, const char *url, int bandwidth);
However, I'm not well versed enough in C to unravel the libmms code. Can anyone offer any advice? I'd be happy to pay for some tuition but want to understand this myself.
What frameworks should I be using to read the mms_t response type from the above method?
Thanks,
I never used libmms but when looking into the source code the interface seems to be very simple:
- You connect with
mms_connect
and receive a connection instance. - You read from the stream using the opened connection using
mms_read
. - You close the connection using
mms_close
.
For advanced functionality you have the other mms_*
functions.
The IO (mms_io_t) can be null
. In this case a default implementation will be used for I/O.
BTW I wonder how you would program in Objective-C without being versed enough to understand C code (the libmms code seems straight forward and easy to understand).
Update:
I cannot see where the libmms does any video decoding. There are some methods for seeking and getting header/packet information. I don't have any knowledge about video decoding - so I cannot say if you have to decode the stream data prior to playing it or if the iPhone can handle it directly.
精彩评论