void toggle_video_button_callback(GtkWidget *check_button_video,
gpointer data) {
if (tryb_wysylania == 0) {
if (video_running == FALSE) {
video_start();
/* wywołuje funkcję audio_receive z opóźnieniem w milisekundach */
//g_timeout_add(100, audio_receive, NULL);
video_running = TRUE;
} else {
video_stop();
video_running = FALSE;
}
}
if (tryb_wysylania == 1) {
if (video_running == FALSE) {
// PhoneUAV - enable camera
//wyslij_dwustan_TCP(12, 1);
video_running = TRUE;
//FIXME
//push_item(statusbar, GINT_TO_POINTER(context_id), "podgląd włączony");
} else {
// PhoneUAV - disable camera
//wyslij_dwustan_TCP(12, 0);
video_running = FALSE;
//FIXME
//push_item(statusbar, GINT_TO_POINTER(context_id), "podgląd wyłączony");
}
}
}
Exemplo n.º 2
0
/* 'pos' parameter is in milliseconds. */
int video_seek(int pos, int flags)
{
	gint64 len, cur;
	GstFormat fmt = GST_FORMAT_TIME;
	GstElement *sink = get_sink();

	if (!sink) return VIDEO_ERROR;
	
	if (!(gst_element_query(sink, GST_QUERY_POSITION, &fmt, &cur) &&
		  gst_element_query(sink, GST_QUERY_TOTAL, &fmt, &len))) 
		return VIDEO_ERROR;

	if (flags & VIDEO_SEEK_RELATIVE)
		cur += pos * GST_SECOND;
	else
		cur = pos * GST_SECOND;

	if (cur >= len) return video_stop();
	if (cur <= 0) cur = 0;
	
	if (!gst_element_seek(
			sink,
			GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH | GST_FORMAT_TIME,
			cur))
		return VIDEO_ERROR;

	return VIDEO_OK;
}
Exemplo n.º 3
0
static void call_stream_stop(struct call *call)
{
	if (!call)
		return;

	call->time_stop = time(NULL);

	/* Audio */
	audio_stop(call->audio);

	/* Video */
#ifdef USE_VIDEO
	video_stop(call->video);
#endif

	tmr_cancel(&call->tmr_inv);
}
Exemplo n.º 4
0
int dtvideo_stop (void *video_priv)
{
    int ret;
    dtvideo_context_t *vctx = (dtvideo_context_t *) video_priv;
    if (!vctx)
    {
        dt_error (TAG, "[%s:%d] dt video context == NULL\n", __FUNCTION__, __LINE__);
        ret = -1;
        goto ERR0;
    }
    ret = video_stop (vctx);
    if (ret < 0)
    {
        dt_error (TAG, "[%s:%d] DTVIDEO STOP FAILED\n", __FUNCTION__, __LINE__);
        ret = -1;
        goto ERR0;
    }
    free (video_priv);
    video_priv = NULL;
    return ret;
  ERR0:
    return ret;

}
Exemplo n.º 5
0
/* End of stream callback */
static void cb_eos(GstElement *thread, gpointer data) 
{
	video_stop();
}