/*this function must be called from the MSTicker thread: it replaces one filter by another one. This is a dirty hack that works anyway. It would be interesting to have something that does the job simplier within the MSTicker api */ void video_stream_change_decoder(VideoStream *stream, int payload){ RtpSession *session=stream->session; RtpProfile *prof=rtp_session_get_profile(session); PayloadType *pt=rtp_profile_get_payload(prof,payload); if (pt!=NULL){ MSFilter *dec=ms_filter_create_decoder(pt->mime_type); if (dec!=NULL){ ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0); ms_filter_unlink(stream->decoder,0,stream->output,0); ms_filter_postprocess(stream->decoder); ms_filter_destroy(stream->decoder); stream->decoder=dec; if (pt->recv_fmtp!=NULL) ms_filter_call_method(stream->decoder,MS_FILTER_ADD_FMTP,(void*)pt->recv_fmtp); ms_filter_link (stream->rtprecv, 0, stream->decoder, 0); ms_filter_link (stream->decoder,0 , stream->output, 0); ms_filter_preprocess(stream->decoder,stream->ticker); }else{ ms_warning("No decoder found for %s",pt->mime_type); } }else{ ms_warning("No payload defined with number %i",payload); } }
void video_preview_stop(VideoStream *stream){ ms_ticker_detach(stream->ticker, stream->source); ms_filter_unlink(stream->source,0,stream->pixconv,0); ms_filter_unlink(stream->pixconv,0,stream->output,0); video_stream_free(stream); }
static void cut_audio_stream_graph(MSAudioEndpoint *ep, bool_t is_remote){ AudioStream *st=ep->st; /*stop the audio graph*/ ms_ticker_detach(st->ms.ticker,st->soundread); if (!st->ec) ms_ticker_detach(st->ms.ticker,st->soundwrite); ep->in_cut_point_prev.pin=0; if (is_remote){ /*we would like to keep the volrecv (MSVolume filter) in the graph to measure the output level*/ ep->in_cut_point_prev.filter=st->volrecv; }else{ ep->in_cut_point_prev.filter=st->ms.decoder; } ep->in_cut_point=just_after(ep->in_cut_point_prev.filter); ms_filter_unlink(ep->in_cut_point_prev.filter,ep->in_cut_point_prev.pin,ep->in_cut_point.filter, ep->in_cut_point.pin); ep->out_cut_point=just_before(st->ms.encoder); ms_filter_unlink(ep->out_cut_point.filter,ep->out_cut_point.pin,st->ms.encoder,0); ms_filter_call_method(st->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&ep->samplerate); if (is_remote){ ep->mixer_in.filter=ep->in_cut_point_prev.filter; ep->mixer_in.pin=ep->in_cut_point_prev.pin; ep->mixer_out.filter=st->ms.encoder; ep->mixer_out.pin=0; }else{ ep->mixer_in=ep->out_cut_point; ep->mixer_out=ep->in_cut_point; } }
void video_stream_change_camera(VideoStream *stream, MSWebCam *cam){ if (stream->ticker && stream->source){ #ifdef ENABLE_UDT if (stream->udt) ms_ticker_detach (stream->ticker, stream->udt); #endif // ENABLE_UDT ms_ticker_detach(stream->ticker,stream->source); /*unlink source filters and subsequent post processin filters */ ms_filter_unlink (stream->source, 0, stream->pixconv, 0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0); /*destroy the filters */ ms_filter_destroy(stream->source); ms_filter_destroy(stream->pixconv); ms_filter_destroy(stream->sizeconv); /*re create new ones and configure them*/ stream->source = ms_web_cam_create_reader(cam); configure_video_source(stream); ms_filter_link (stream->source, 0, stream->pixconv, 0); ms_filter_link (stream->pixconv, 0, stream->sizeconv, 0); ms_filter_link (stream->sizeconv, 0, stream->tee, 0); ms_ticker_attach(stream->ticker,stream->source); } }
void audio_stream_stop(AudioStream * stream) { if (stream->ticker){ MSConnectionHelper h; #ifdef ENABLE_UDT if (stream->udt) ms_ticker_detach (stream->ticker, stream->udt); #endif // ENABLE_UDT ms_ticker_detach(stream->ticker,stream->soundread); ms_ticker_detach(stream->ticker,stream->rtprecv); rtp_stats_display(rtp_session_get_stats(stream->session),"Audio session's RTP statistics"); /*dismantle the outgoing graph*/ ms_connection_helper_start(&h); ms_connection_helper_unlink(&h,stream->soundread,-1,0); if (stream->read_resampler!=NULL) ms_connection_helper_unlink(&h,stream->read_resampler,0,0); #ifndef ENABLED_MCU_MEDIA_SERVER if (stream->ec!=NULL) ms_connection_helper_unlink(&h,stream->ec,1,1); if (stream->volsend!=NULL) ms_connection_helper_unlink(&h,stream->volsend,0,0); #endif // ENABLED_MCU_MEDIA_SERVER if (stream->dtmfgen_rtp) ms_connection_helper_unlink(&h,stream->dtmfgen_rtp,0,0); ms_connection_helper_unlink(&h,stream->encoder,0,0); ms_connection_helper_unlink(&h,stream->rtpsend,0,-1); /*dismantle the receiving graph*/ ms_connection_helper_start(&h); ms_connection_helper_unlink(&h,stream->rtprecv,-1,0); ms_connection_helper_unlink(&h,stream->decoder,0,0); ms_connection_helper_unlink(&h,stream->dtmfgen,0,0); #ifndef ENABLED_MCU_MEDIA_SERVER if (stream->equalizer) ms_connection_helper_unlink(&h,stream->equalizer,0,0); if (stream->volrecv!=NULL) ms_connection_helper_unlink(&h,stream->volrecv,0,0); if (stream->ec!=NULL) ms_connection_helper_unlink(&h,stream->ec,0,0); #endif // ENABLED_MCU_MEDIA_SERVER if (stream->write_resampler!=NULL) ms_connection_helper_unlink(&h,stream->write_resampler,0,0); if(stream->mic_tee && stream->recordmixer) ms_filter_unlink(stream->spk_tee,1,stream->recordmixer,1); if(stream->spk_tee) ms_connection_helper_unlink(&h,stream->spk_tee,0,0); if (stream->tee2){ ms_connection_helper_unlink(&h,stream->tee2,0,0); if(stream->audio_record) ms_filter_unlink(stream->tee2,1,stream->audio_record,0); } ms_connection_helper_unlink(&h,stream->soundwrite,0,-1); } audio_stream_free(stream); }
static void unplumb_from_conf(MSAudioEndpoint *ep){ MSAudioConference *conf=ep->conference; ms_filter_unlink(ep->mixer_in.filter,ep->mixer_in.pin,ep->in_resampler,0); ms_filter_unlink(ep->in_resampler,0,conf->mixer,ep->pin); ms_filter_unlink(conf->mixer,ep->pin,ep->out_resampler,0); ms_filter_unlink(ep->out_resampler,0,ep->mixer_out.filter,ep->mixer_out.pin); }
void video_stream_recv_only_stop (VideoStream * stream){ if (stream->ticker!=NULL){ ms_ticker_detach(stream->ticker, stream->rtprecv); rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics"); ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0); ms_filter_unlink(stream->decoder,0,stream->output,0); } video_stream_free (stream); }
void video_stream_send_only_stop(VideoStream *stream){ if (stream->ticker){ ms_ticker_detach (stream->ticker, stream->source); ms_filter_unlink(stream->source,0,stream->pixconv,0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); ms_filter_unlink (stream->sizeconv, 0, stream->encoder, 0); ms_filter_unlink(stream->encoder,0,stream->rtpsend,0); } video_stream_free(stream); }
void local_sound_card_stop(ConfSoundCard *sndcard) { if (sndcard->ticker){ ms_ticker_detach(sndcard->ticker,sndcard->capture_card); ms_ticker_detach(sndcard->ticker,sndcard->itc_source); ms_filter_unlink(sndcard->capture_card,0,sndcard->itc_sink,0); ms_filter_unlink(sndcard->itc_source,0,sndcard->playback_card,0); } snd_card_free(sndcard); }
static void stop_preload_graph(AudioStream *stream){ ms_ticker_detach(stream->ms.ticker,stream->dummy); if (stream->soundwrite) { ms_filter_unlink(stream->dummy,0,stream->soundwrite,0); } if (stream->ms.voidsink) { ms_filter_unlink(stream->dummy,0,stream->ms.voidsink,0); ms_filter_destroy(stream->ms.voidsink); stream->ms.voidsink=NULL; } ms_filter_destroy(stream->dummy); stream->dummy=NULL; }
void local_webcam_stop(ConfWebCam *localcam){ if(localcam->ticker!=NULL) { ms_ticker_detach(localcam->ticker,localcam->webcam); ms_filter_unlink(localcam->webcam,0,localcam->pixconv,0); ms_filter_unlink(localcam->pixconv,0,localcam->sizeconv,0); ms_filter_unlink(localcam->sizeconv,0,localcam->itc_sink,0); } webcam_free(localcam); }
void audio_stream_stop(AudioStream * stream) { if (stream->ticker){ MSConnectionHelper h; if(stream->record_enabled) audio_stream_record_stop(stream); ms_ticker_detach(stream->ticker,stream->soundread); ms_ticker_detach(stream->ticker,stream->rtprecv); rtp_stats_display(rtp_session_get_stats(stream->session),"Audio session's RTP statistics"); /*dismantle the outgoing graph*/ ms_connection_helper_start(&h); ms_connection_helper_unlink(&h,stream->soundread,-1,0); if (stream->read_resampler!=NULL) ms_connection_helper_unlink(&h,stream->read_resampler,0,0); if (stream->ec!=NULL) ms_connection_helper_unlink(&h,stream->ec,1,1); if (stream->volsend!=NULL) ms_connection_helper_unlink(&h,stream->volsend,0,0); if(stream->mic_tee && stream->recordmixer) ms_filter_unlink(stream->mic_tee,1,stream->recordmixer,0); if(stream->mic_tee) ms_connection_helper_unlink(&h,stream->mic_tee,0,0); ms_connection_helper_unlink(&h,stream->encoder,0,0); ms_connection_helper_unlink(&h,stream->rtpsend,0,-1); /*dismantle the receiving graph*/ ms_connection_helper_start(&h); ms_connection_helper_unlink(&h,stream->rtprecv,-1,0); ms_connection_helper_unlink(&h,stream->decoder,0,0); ms_connection_helper_unlink(&h,stream->dtmfgen,0,0); if (stream->equalizer) ms_connection_helper_unlink(&h,stream->equalizer,0,0); if (stream->volrecv!=NULL) ms_connection_helper_unlink(&h,stream->volrecv,0,0); if (stream->ec!=NULL) ms_connection_helper_unlink(&h,stream->ec,0,0); if (stream->write_resampler!=NULL) ms_connection_helper_unlink(&h,stream->write_resampler,0,0); if(stream->mic_tee && stream->recordmixer) ms_filter_unlink(stream->spk_tee,1,stream->recordmixer,1); if(stream->spk_tee) ms_connection_helper_unlink(&h,stream->spk_tee,0,0); ms_connection_helper_unlink(&h,stream->soundwrite,0,-1); } audio_stream_free(stream); }
void video_stream_change_camera(VideoStream *stream, MSWebCam *cam){ bool_t keep_source=(cam==stream->cam); bool_t encoder_has_builtin_converter = (!stream->pixconv && !stream->sizeconv); if (stream->ms.ticker && stream->source){ ms_ticker_detach(stream->ms.ticker,stream->source); /*unlink source filters and subsequent post processin filters */ if (encoder_has_builtin_converter || (stream->source_performs_encoding == TRUE)) { ms_filter_unlink(stream->source, 0, stream->tee, 0); } else { ms_filter_unlink (stream->source, 0, stream->pixconv, 0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0); } /*destroy the filters */ if (!keep_source) ms_filter_destroy(stream->source); if (!encoder_has_builtin_converter && (stream->source_performs_encoding == FALSE)) { ms_filter_destroy(stream->pixconv); ms_filter_destroy(stream->sizeconv); } /*re create new ones and configure them*/ if (!keep_source) stream->source = ms_web_cam_create_reader(cam); stream->cam=cam; /* update orientation */ if (stream->source){ ms_filter_call_method(stream->source,MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION,&stream->device_orientation); if (!stream->display_filter_auto_rotate_enabled) ms_filter_call_method(stream->source,MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION,&stream->device_orientation); } if (stream->output && stream->display_filter_auto_rotate_enabled) { ms_filter_call_method(stream->output,MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION,&stream->device_orientation); } configure_video_source(stream); if (encoder_has_builtin_converter || (stream->source_performs_encoding == TRUE)) { ms_filter_link (stream->source, 0, stream->tee, 0); } else { ms_filter_link (stream->source, 0, stream->pixconv, 0); ms_filter_link (stream->pixconv, 0, stream->sizeconv, 0); ms_filter_link (stream->sizeconv, 0, stream->tee, 0); } ms_ticker_attach(stream->ms.ticker,stream->source); } }
int main(int argc, char *argv[]){ MSFilter *f1,*f2; MSSndCard *card; MSTicker *ticker; char *card_id=NULL; ms_init(); signal(SIGINT,stop); if (argc>1) card_id=argv[1]; if (card_id!=NULL) card=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),card_id); else card=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()); if (card==NULL){ ms_error("No card."); return -1; } f1=ms_snd_card_create_reader(card); f2=ms_snd_card_create_writer(card); ticker=ms_ticker_new(); ms_filter_link(f1,0,f2,0); ms_ticker_attach(ticker,f1); while(run) sleep(1); ms_ticker_detach(ticker,f1); ms_ticker_destroy(ticker); ms_filter_unlink(f1,0,f2,0); ms_filter_destroy(f1); ms_filter_destroy(f2); return 0; }
static void stop_preload_graph(TextStream *stream){ ms_ticker_detach(stream->ms.sessions.ticker, stream->ms.rtprecv); ms_filter_unlink(stream->ms.rtprecv, 0, stream->ms.voidsink, 0); ms_filter_destroy(stream->ms.voidsink); ms_filter_destroy(stream->ms.rtprecv); stream->ms.voidsink = stream->ms.rtprecv = NULL; }
static void stop_preload_graph(VideoStream *stream){ ms_ticker_detach(stream->ticker,stream->rtprecv); ms_filter_unlink(stream->rtprecv,0,stream->voidsink,0); ms_filter_destroy(stream->voidsink); ms_filter_destroy(stream->rtprecv); stream->voidsink=stream->rtprecv=NULL; }
void ring_stop(RingStream *stream){ ms_ticker_detach(stream->ticker,stream->source); ms_filter_unlink(stream->source,0,stream->sndwrite,0); ms_ticker_destroy(stream->ticker); ms_filter_destroy(stream->source); ms_filter_destroy(stream->sndwrite); ms_free(stream); }
static void stop_preload_graph(VideoStream *stream){ ms_ticker_detach(stream->ms.ticker,stream->ms.rtprecv); ms_filter_unlink(stream->ms.rtprecv,0,stream->ms.voidsink,0); ms_filter_destroy(stream->ms.voidsink); ms_filter_destroy(stream->ms.rtprecv); stream->ms.voidsink=stream->ms.rtprecv=NULL; stream->prepare_ongoing = FALSE; }
/** * This function must be called from the MSTicker thread: * it replaces one filter by another one. * This is a dirty hack that works anyway. * It would be interesting to have something that does the job * more easily within the MSTicker API. */ static void media_stream_change_decoder(MediaStream *stream, int payload) { RtpSession *session = stream->sessions.rtp_session; RtpProfile *prof = rtp_session_get_profile(session); PayloadType *pt = rtp_profile_get_payload(prof, payload); if (stream->decoder == NULL){ ms_message("media_stream_change_decoder(): ignored, no decoder."); return; } if (pt != NULL){ MSFilter *dec; if (stream->type == VideoStreamType){ /* Q: why only video ? this optimization seems relevant for audio too.*/ if ((stream->decoder != NULL) && (stream->decoder->desc->enc_fmt != NULL) && (strcasecmp(pt->mime_type, stream->decoder->desc->enc_fmt) == 0)) { /* Same formats behind different numbers, nothing to do. */ return; } } dec = ms_filter_create_decoder(pt->mime_type); if (dec != NULL) { MSFilter *nextFilter = stream->decoder->outputs[0]->next.filter; ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0); ms_filter_unlink(stream->decoder, 0, nextFilter, 0); ms_filter_postprocess(stream->decoder); ms_filter_destroy(stream->decoder); stream->decoder = dec; if (pt->recv_fmtp != NULL) ms_filter_call_method(stream->decoder, MS_FILTER_ADD_FMTP, (void *)pt->recv_fmtp); ms_filter_link(stream->rtprecv, 0, stream->decoder, 0); ms_filter_link(stream->decoder, 0, nextFilter, 0); ms_filter_preprocess(stream->decoder,stream->sessions.ticker); } else { ms_warning("No decoder found for %s", pt->mime_type); } } else { ms_warning("No payload defined with number %i", payload); } }
void ring_stop(RingStream *stream){ ms_ticker_detach(stream->ticker,stream->source); ms_filter_unlink(stream->source,0,stream->sndwrite,0); ms_ticker_destroy(stream->ticker); ms_filter_destroy(stream->source); ms_filter_destroy(stream->sndwrite); ms_free(stream); #ifdef _WIN32_WCE ms_warning("Sleeping a bit after closing the audio device..."); ms_sleep(1); #endif }
static void ecc_deinit_filters(EcCalibrator *ecc){ ms_ticker_detach(ecc->ticker,ecc->play); ms_ticker_detach(ecc->ticker,ecc->sndread); ms_filter_unlink(ecc->play,0,ecc->gen,0); ms_filter_unlink(ecc->gen,0,ecc->resampler,0); ms_filter_unlink(ecc->resampler,0,ecc->sndwrite,0); ms_filter_unlink(ecc->sndread,0,ecc->det,0); ms_filter_unlink(ecc->det,0,ecc->rec,0); ms_filter_destroy(ecc->sndread); ms_filter_destroy(ecc->det); ms_filter_destroy(ecc->rec); ms_filter_destroy(ecc->play); ms_filter_destroy(ecc->gen); ms_filter_destroy(ecc->resampler); ms_filter_destroy(ecc->sndwrite); ms_ticker_destroy(ecc->ticker); }
static void ecc_deinit_filters(EcCalibrator *ecc) { if (ecc->audio_uninit_cb != NULL) { (*ecc->audio_uninit_cb)(ecc->cb_data); } ms_ticker_detach(ecc->ticker,ecc->sndread); ms_ticker_detach(ecc->ticker,ecc->play); ms_filter_unlink(ecc->play,0,ecc->gen,0); ms_filter_unlink(ecc->gen,0,ecc->write_resampler,0); ms_filter_unlink(ecc->write_resampler,0,ecc->sndwrite,0); ms_filter_unlink(ecc->sndread,0,ecc->read_resampler,0); ms_filter_unlink(ecc->read_resampler,0,ecc->det,0); ms_filter_unlink(ecc->det,0,ecc->rec,0); ms_filter_destroy(ecc->sndread); ms_filter_destroy(ecc->det); ms_filter_destroy(ecc->rec); ms_filter_destroy(ecc->play); ms_filter_destroy(ecc->gen); ms_filter_destroy(ecc->read_resampler); ms_filter_destroy(ecc->write_resampler); ms_filter_destroy(ecc->sndwrite); ms_ticker_destroy(ecc->ticker); }
static int uninit_bench(struct bench_config *bench) { MSList *it; for(it=bench->tsessions;it!=NULL;it=bench->tsessions){ struct test_session *ts = (struct test_session *)it->data; bench->tsessions = ms_list_remove_link(bench->tsessions, it); ms_ticker_detach(bench->ticker,ts->fplayer); ms_ticker_detach(bench->ticker,ts->rtprecv); ms_filter_call_method_noarg(ts->frecorder,MS_FILE_REC_CLOSE); if (strstr(bench->wavfile, ".au")==NULL) { ms_filter_unlink(ts->fplayer,0,ts->encoder,0); ms_filter_unlink(ts->encoder,0,ts->rtpsend,0); } else { ms_filter_unlink(ts->fplayer,0,ts->rtpsend,0); } ms_filter_unlink(ts->rtprecv,0,ts->decoder,0); ms_filter_unlink(ts->decoder,0,ts->frecorder,0); if (ts->fplayer) ms_filter_destroy(ts->fplayer); if (ts->encoder) ms_filter_destroy(ts->encoder); if (ts->rtpsend) ms_filter_destroy(ts->rtpsend); if (ts->rtprecv) ms_filter_destroy(ts->rtprecv); if (ts->decoder) ms_filter_destroy(ts->decoder); if (ts->frecorder) ms_filter_destroy(ts->frecorder); ortp_free(ts); } ms_ticker_destroy(bench->ticker); return 0; }
bool myAudioStream::unlink_filters() { /* Unlink filters */ if (filtersLinked) { ms_message("Unlinking filters"); if (ms_filter_unlink(stream->dtmfgen,0,stream->soundwrite,0) != 0) { ms_error("Failed to unlink dtmfgen --> soundwrite"); return false; } if (ms_filter_unlink(stream->decoder,0,stream->dtmfgen,0) != 0) { ms_error("Failed to unlink decoder --> dtmfgen"); return false; } if (ms_filter_unlink(stream->rtprecv,0,stream->decoder,0) != 0) { ms_error("Failed to unlink rtprecv --> decoder"); return false; } filtersLinked = false; } return true; }
/*this function must be called from the MSTicker thread: it replaces one filter by another one. This is a dirty hack that works anyway. It would be interesting to have something that does the job simplier within the MSTicker api */ void video_stream_change_decoder(VideoStream *stream, int payload){ RtpSession *session=stream->session; RtpProfile *prof=rtp_session_get_profile(session); PayloadType *pt=rtp_profile_get_payload(prof,payload); if (pt!=NULL){ MSFilter *dec; if (stream->decoder!=NULL && stream->decoder->desc->enc_fmt!=NULL && strcasecmp(pt->mime_type,stream->decoder->desc->enc_fmt)==0){ /* same formats behind different numbers, nothing to do */ return; } dec=ms_filter_create_decoder(pt->mime_type); if (dec!=NULL){ ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0); if (stream->tee2) ms_filter_unlink(stream->decoder,0,stream->tee2,0); else if(stream->output) ms_filter_unlink(stream->decoder,0,stream->output,0); ms_filter_postprocess(stream->decoder); ms_filter_destroy(stream->decoder); stream->decoder=dec; if (pt->recv_fmtp!=NULL) ms_filter_call_method(stream->decoder,MS_FILTER_ADD_FMTP,(void*)pt->recv_fmtp); ms_filter_link (stream->rtprecv, 0, stream->decoder, 0); if (stream->tee2) ms_filter_link(stream->decoder,0,stream->tee2,0); else if(stream->output) ms_filter_link (stream->decoder,0 , stream->output, 0); ms_filter_preprocess(stream->decoder,stream->ticker); ms_filter_set_notify_callback(dec, event_cb, stream); }else{ ms_warning("No decoder found for %s",pt->mime_type); } }else{ ms_warning("No payload defined with number %i",payload); } }
void video_stream_stop (VideoStream * stream) { stream->eventcb = NULL; stream->event_pointer = NULL; if (stream->ticker){ if (stream->voidsink) { stop_preload_graph(stream); } else { if (stream->source) ms_ticker_detach(stream->ticker,stream->source); if (stream->rtprecv) ms_ticker_detach(stream->ticker,stream->rtprecv); if (stream->ice_check_list != NULL) { ice_check_list_print_route(stream->ice_check_list, "Video session's route"); stream->ice_check_list = NULL; } rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics"); if (stream->source){ ms_filter_unlink(stream->source,0,stream->pixconv,0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); 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; ms_connection_helper_start (&h); ms_connection_helper_unlink (&h,stream->rtprecv,-1,0); ms_connection_helper_unlink (&h,stream->decoder,0,0); if (stream->tee2){ ms_connection_helper_unlink (&h,stream->tee2,0,0); ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0); } if(stream->output) ms_connection_helper_unlink (&h,stream->output,0,-1); if (stream->tee && stream->output && stream->output2==NULL) ms_filter_unlink(stream->tee,1,stream->output,1); } } } video_stream_free (stream); }
int ms_connection_helper_unlink(MSConnectionHelper *h, MSFilter *f, int inpin, int outpin) { int err=0; if (h->last.filter==NULL) { h->last.filter=f; h->last.pin=outpin; } else { err=ms_filter_unlink(h->last.filter,h->last.pin,f,inpin); if (err==0) { h->last.filter=f; h->last.pin=outpin; } } return err; }
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj){ int i; MSConnectionPoint mp; ms_ticker_detach(obj->ticker,obj->soundout); mp.filter=obj->mixer; for(i=0;i<MAX_BRANCHES;++i){ mp.pin=i; if (i!=0) linphone_sound_daemon_release_player(obj,&obj->branches[i]); lsd_player_uninit (&obj->branches[i],mp); } ms_filter_unlink(obj->mixer,0,obj->soundout,0); ms_ticker_destroy(obj->ticker); ms_filter_destroy(obj->soundout); ms_filter_destroy(obj->mixer); }
void video_mail_record_stop(VideoMailRecord *vp) { MSConnectionHelper h; VideoRecoder *os= vp->os; if(vp->ticker) { if(vp->snd_read!=NULL && vp->snd_sink!=NULL){ ms_ticker_detach(vp->ticker,vp->snd_read); ms_filter_unlink(vp->snd_read,0,vp->snd_sink,0); } if(vp->video_source!=NULL && vp->video_output!=NULL){ ms_ticker_detach(vp->ticker,vp->video_source); ms_connection_helper_start(&h); ms_connection_helper_unlink(&h,vp->video_source,-1,0); ms_connection_helper_unlink(&h,vp->pixconv,0,0); ms_connection_helper_unlink(&h,vp->sizeconv,0,0); ms_connection_helper_unlink(&h,vp->video_tee,0,0); ms_filter_unlink(vp->video_tee,1,vp->video_output,0); ms_connection_helper_unlink(&h,vp->video_sink,0,-1); } } if(vp->os) { video_recoder_stop(os); video_recoder_destory(os); } video_mail_record_free(vp); }
void video_stream_stop (VideoStream * stream) { if (stream->ticker){ if (stream->source) ms_ticker_detach(stream->ticker,stream->source); if (stream->rtprecv) ms_ticker_detach(stream->ticker,stream->rtprecv); rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics"); if (stream->source){ ms_filter_unlink(stream->source,0,stream->pixconv,0); ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0); 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; ms_connection_helper_start (&h); ms_connection_helper_unlink (&h,stream->rtprecv,-1,0); ms_connection_helper_unlink (&h,stream->decoder,0,0); if (stream->tee2){ ms_connection_helper_unlink (&h,stream->tee2,0,0); ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0); if(stream->video_record) ms_filter_unlink(stream->tee2,2,stream->video_record,0); } ms_connection_helper_unlink (&h,stream->output,0,-1); if (stream->tee && stream->output2==NULL && ms_filter_get_id(stream->output)!=MS_CONF_ITC_SINK_ID) ms_filter_unlink(stream->tee,1,stream->output,1); } } video_stream_free (stream); }