view src/mediastreamer/msvideosource.c @ 12125:3c1bac709234

[gaim-migrate @ 14425] Change /core/savedstatus/current and /core/savedstatus/idleaway to ints (they used to be strings, where the value was the title of a GaimSavedStatus). The value is now equal to the "creation" timestamp of a saved_status. The creation timestamp is used as the unique key. The primary reason for this is to allow for saved statuses to have NULL titles. NULL titles are needed for transient statuses. I also added a "last_used" timestamp. This all paves the way for keeping track of recently used statuses committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Nov 2005 07:23:29 +0000
parents e67993da8a22
children
line wrap: on
line source

/*
  The mediastreamer library aims at providing modular media processing and I/O
	for linphone, but also for any telephony application.
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
  										
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#include "msvideosource.h"
#include "mediastream.h"
#include "msv4l.h"
#ifdef HAVE_LIBDC1394
#include "msdc1394.h"
#endif

/* register all statically linked codecs */
void ms_video_source_register_all()
{
	ms_filter_register(&v4l_info);
#ifdef HAVE_LIBDC1394
	ms_filter_register(MS_FILTER_INFO(&dc1394_info));
#endif
}

void ms_video_source_class_init(MSVideoSourceClass *klass)
{
	/* init base class first*/
	ms_filter_class_init(MS_FILTER_CLASS(klass));
	/* then init videosource specific things*/
	MS_FILTER_CLASS(klass)->max_qoutputs=MSVIDEOSOURCE_MAX_OUTPUTS;
	ms_filter_class_set_attr(MS_FILTER_CLASS(klass),FILTER_IS_SOURCE|FILTER_HAS_QUEUES);
}

void ms_video_source_init(MSVideoSource *obj)
{
	ms_filter_init(MS_FILTER(obj));
	MS_FILTER(obj)->outqueues=obj->outputs;
	obj->width = VIDEO_SIZE_CIF_W;
	obj->height = VIDEO_SIZE_CIF_H;
}

void ms_video_source_start(MSVideoSource *f)
{
	MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->start(f);
}

void ms_video_source_stop(MSVideoSource *f)
{
	MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->stop(f);
}

int ms_video_source_set_device(MSVideoSource *f, const gchar *device)
{
	return MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_device(f,device);
}

gchar* ms_video_source_get_device_name(MSVideoSource *f)
{
	return f->dev_name;
}

void ms_video_source_set_size(MSVideoSource *f, gint width, gint height)
{
	if (MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_size)
		MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_size(f, width, height);
}

void ms_video_source_set_frame_rate(MSVideoSource *f, gint frame_rate, gint frame_rate_base)
{
	if (MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_frame_rate)
		MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_frame_rate(f, frame_rate, frame_rate_base);
	else{
		f->frame_rate=frame_rate;
		f->frame_rate_base=frame_rate_base;
	}
}

gchar* ms_video_source_get_format(MSVideoSource *f)
{
	return f->format;
}