Commit b97421a1 authored by Simon Morlat's avatar Simon Morlat

x11 fixes and allow seperate windows for remote and local video

parent 8868e7ce
......@@ -187,6 +187,7 @@ struct _VideoStream
MSFilter *rtpsend;
MSFilter *tee2;
MSFilter *jpegwriter;
MSFilter *output2;
OrtpEvQueue *evq;
MSVideoSize sent_vsize;
int corner; /*for selfview*/
......
......@@ -61,6 +61,8 @@ void video_stream_free (VideoStream * stream)
ms_filter_destroy(stream->tee2);
if (stream->jpegwriter!=NULL)
ms_filter_destroy(stream->jpegwriter);
if (stream->output2!=NULL)
ms_filter_destroy(stream->output2);
if (stream->ticker != NULL)
ms_ticker_destroy (stream->ticker);
if (stream->evq!=NULL)
......@@ -330,6 +332,12 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
if (pt->send_fmtp){
ms_filter_call_method(stream->encoder,MS_FILTER_ADD_FMTP,pt->send_fmtp);
}
if (stream->use_preview_window){
if (stream->rendercb==NULL){
stream->output2=ms_filter_new_from_name (stream->display_name);
}
}
configure_video_source (stream);
/* and then connect all */
ms_filter_link (stream->source, 0, stream->pixconv, 0);
......@@ -337,6 +345,12 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
ms_filter_link (stream->sizeconv, 0, stream->tee, 0);
ms_filter_link (stream->tee, 0 ,stream->encoder, 0 );
ms_filter_link (stream->encoder,0, stream->rtpsend,0);
if (stream->output2){
if (stream->window_id!=0){
ms_filter_call_method(stream->output2, MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID,&stream->preview_window_id);
}
ms_filter_link(stream->tee,1,stream->output2,0);
}
}
if (stream->dir==VideoStreamSendRecv || stream->dir==VideoStreamRecvOnly){
MSConnectionHelper ch;
......@@ -392,7 +406,7 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
}
ms_connection_helper_link (&ch,stream->output,0,-1);
/* the video source must be send for preview , if it exists*/
if (stream->tee!=NULL)
if (stream->tee!=NULL && stream->output2==NULL)
ms_filter_link(stream->tee,1,stream->output,1);
}
......@@ -452,6 +466,9 @@ video_stream_stop (VideoStream * stream)
ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0);
ms_filter_unlink(stream->tee,0,stream->encoder,0);
ms_filter_unlink(stream->encoder, 0, stream->rtpsend,0);
if (stream->output2){
ms_filter_unlink(stream->tee,1,stream->output2,0);
}
}
if (stream->rtprecv){
MSConnectionHelper h;
......@@ -463,7 +480,7 @@ video_stream_stop (VideoStream * stream)
ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
}
ms_connection_helper_unlink (&h,stream->output,0,-1);
if (stream->tee)
if (stream->tee && stream->output2==NULL)
ms_filter_unlink(stream->tee,1,stream->output,1);
}
}
......
......@@ -373,24 +373,23 @@ static void x11video_process(MSFilter *f){
}
if (obj->autofit){
MSVideoSize qvga_size;
MSVideoSize new_window_size;
qvga_size.width=MS_VIDEO_SIZE_QVGA_W;
qvga_size.height=MS_VIDEO_SIZE_QVGA_H;
ms_message("received size is %ix%i",newsize.width,newsize.height);
/*don't resize less than QVGA, it is too small*/
if (ms_video_size_greater_than(qvga_size,newsize)){
newsize.width=MS_VIDEO_SIZE_QVGA_W;
newsize.height=MS_VIDEO_SIZE_QVGA_H;
}
if (!ms_video_size_equal(newsize,obj->vsize)){
obj->vsize=newsize;
ms_message("autofit: new size is %ix%i",newsize.width,newsize.height);
XResizeWindow(obj->display,obj->window_id,newsize.width,newsize.height);
XSync(obj->display,FALSE);
x11video_unprepare(f);
x11video_prepare(f);
if (!obj->ready) goto end;
}else obj->vsize=newsize;
new_window_size.width=MS_VIDEO_SIZE_QVGA_W;
new_window_size.height=MS_VIDEO_SIZE_QVGA_H;
}else new_window_size=newsize;
obj->vsize=newsize;
ms_message("autofit: new window size is %ix%i",new_window_size.width,new_window_size.height);
XResizeWindow(obj->display,obj->window_id,new_window_size.width,new_window_size.height);
XSync(obj->display,FALSE);
x11video_unprepare(f);
x11video_prepare(f);
if (!obj->ready) goto end;
}
}
}
......
......@@ -47,6 +47,7 @@ static const char * capture_card=NULL;
static const char * playback_card=NULL;
static float ng_threshold=-1;
static bool_t use_ng=FALSE;
static bool_t two_windows=FALSE;
/* starting values echo canceller */
static int ec_len_ms=0, ec_delay_ms=250, ec_framesize;
......@@ -160,6 +161,7 @@ int main(int argc, char * argv[])
bool_t ec=FALSE;
bool_t agc=FALSE;
bool_t eq=FALSE;
/*create the rtp session */
ortp_init();
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
......@@ -229,6 +231,8 @@ int main(int argc, char * argv[])
}else if (strcmp(argv[i],"--ng-threshold")==0){
i++;
ng_threshold=atof(argv[i]);
}else if (strcmp(argv[i],"--two-windows")==0){
two_windows=TRUE;
}
}
......@@ -287,6 +291,7 @@ static void run_media_streams(int localport, const char *remote_ip, int remotepo
printf("Starting video stream.\n");
video=video_stream_new(localport, ms_is_ipv6(remote_ip));
video_stream_set_sent_video_size(video,vs);
video_stream_use_preview_video_window(video,two_windows);
video_stream_start(video,profile,
remote_ip,
remoteport,remoteport+1,
......
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