Commit 3bc14cdb authored by jehan's avatar jehan

ios video integration in linphone

parent 3428fc9d
......@@ -150,7 +150,7 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
[session release];
session = nil;
}
if (input) {
/* if (input) {
[input release];
input = nil;
}
......@@ -158,6 +158,7 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
[output release];
output = nil;
}
*/
flushq(&rq,0);
ms_mutex_destroy(&mutex);
[super dealloc];
......
......@@ -44,6 +44,11 @@
static void iosdisplay_init(MSFilter *f){
f->data = [[IOSDisplay alloc] init] ;
}
-(void) release {
[super release];
[imageView release];
imageView = nil;
}
static void iosdisplay_process(MSFilter *f){
IOSDisplay* thiz=(IOSDisplay*)f->data;
......@@ -95,7 +100,7 @@ static void iosdisplay_process(MSFilter *f){
UIImage *image = [[UIImage alloc ]initWithCGImage:quartzImage] ;
[thiz performSelectorOnMainThread:@selector(updateImage:) withObject:image waitUntilDone:NO];
//[thiz updateImage:image];
// Release the Quartz image
CGImageRelease(quartzImage);
CVPixelBufferRelease(imageBuffer);
......@@ -114,13 +119,14 @@ static void iosdisplay_unit(MSFilter *f){
static int iosdisplay_set_native_window(MSFilter *f, void *arg) {
IOSDisplay* thiz=(IOSDisplay*)f->data;
thiz->imageView = (UIImageView*)arg;
thiz->imageView = *(UIImageView**)(arg);
[thiz->imageView retain];
return 0;
}
static int iosdisplay_get_native_window(MSFilter *f, void *arg) {
IOSDisplay* thiz=(IOSDisplay*)f->data;
arg = thiz->imageView;
arg = &thiz->imageView;
return 0;
}
......
......@@ -34,5 +34,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationExitsOnSuspend</key>
<true/>
</dict>
</plist>
......@@ -8,13 +8,14 @@
#import "mediastreamViewController.h"
#include "mediastream.h"
static VideoStream* sVideoStream=0;
static UIImageView* sImageView=0;
void ms_set_video_stream(VideoStream* video) {
sVideoStream = video;
}
@implementation mediastreamViewController
@synthesize imageView;
void ms_set_video_stream(VideoStream* video) {
ms_filter_call_method(video->output,MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID,&sImageView);
}
- (void)dealloc
{
......@@ -36,7 +37,8 @@ void ms_set_video_stream(VideoStream* video) {
- (void)viewDidLoad
{
[super viewDidLoad];
ms_filter_call_method(sVideoStream->output,MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID,imageView);
sImageView=imageView;
}
......
......@@ -183,7 +183,38 @@ const char *usage="mediastream --local <port> --remote <ip:port> --payload <payl
"[ --el-transmit-thres <(float) [0-1]> (TO BE DOCUMENTED) ]\n";
#ifndef __APPLE__
int main(int argc, char * argv[])
#else /*Main thread is blocked by cocoa UI framework*/
int g_argc;
char** g_argv;
static int __main(int argc, char * argv[]);
static void* apple_main(void* data) {
__main(g_argc,g_argv);
return NULL;
}
int main(int argc, char * argv[]) {
pthread_t main_thread;
g_argc=argc;
g_argv=argv;
pthread_create(&main_thread,NULL,apple_main,NULL);
#ifdef TARGET_OS_MACOSX
CFRunLoopRun();
return 0;
#elif TARGET_OS_IPHONE
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int value = UIApplicationMain(0, nil, nil, nil);
[pool release];
return value;
#endif
cond=0;
pthread_join(main_thread,NULL);
}
static int __main(int argc, char * argv[])
#endif
{
int i;
int localport=0,remoteport=0,payload=0;
......@@ -317,6 +348,7 @@ int main(int argc, char * argv[])
return 0;
}
static void run_media_streams(int localport, const char *remote_ip, int remoteport, int payload, const char *fmtp,
int jitter, int bitrate, MSVideoSize vs, bool_t ec, bool_t agc, bool_t eq)
{
......@@ -329,9 +361,7 @@ static void run_media_streams(int localport, const char *remote_ip, int remotepo
PayloadType *pt;
RtpProfile *profile=rtp_profile_clone_full(&av_profile);
OrtpEvQueue *q=ortp_ev_queue_new();
#ifdef TARGET_OS_IPHONE
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
ms_init();
signal(SIGINT,stop_handler);
pt=rtp_profile_get_payload(profile,payload);
......@@ -454,13 +484,10 @@ static void run_media_streams(int localport, const char *remote_ip, int remotepo
}else{ /* no interactive stuff - continuous debug output */
rtp_session_register_event_queue(session,q);
#ifdef TARGET_OS_MACOSX
CFRunLoopRun();
#elif TARGET_OS_IPHONE
ms_set_video_stream(video);
int retVal = UIApplicationMain(0, nil, nil, nil);
[pool release];
#else
#ifdef TARGET_OS_IPHONE
ms_set_video_stream(video); /*for IOS*/
#endif
while(cond)
{
int n;
......@@ -490,7 +517,6 @@ static void run_media_streams(int localport, const char *remote_ip, int remotepo
parse_events(session,q);
}
}
#endif // target MAC
}
printf("stopping all...\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment