12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Lesser General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2.1 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Lesser General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Lesser General Public
|
|
17 License along with this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21
|
|
22 #include "msvideosource.h"
|
|
23 #include "mediastream.h"
|
|
24 #include "msv4l.h"
|
|
25 #ifdef HAVE_LIBDC1394
|
|
26 #include "msdc1394.h"
|
|
27 #endif
|
|
28
|
|
29 /* register all statically linked codecs */
|
|
30 void ms_video_source_register_all()
|
|
31 {
|
|
32 ms_filter_register(&v4l_info);
|
|
33 #ifdef HAVE_LIBDC1394
|
|
34 ms_filter_register(MS_FILTER_INFO(&dc1394_info));
|
|
35 #endif
|
|
36 }
|
|
37
|
|
38 void ms_video_source_class_init(MSVideoSourceClass *klass)
|
|
39 {
|
|
40 /* init base class first*/
|
|
41 ms_filter_class_init(MS_FILTER_CLASS(klass));
|
|
42 /* then init videosource specific things*/
|
|
43 MS_FILTER_CLASS(klass)->max_qoutputs=MSVIDEOSOURCE_MAX_OUTPUTS;
|
|
44 ms_filter_class_set_attr(MS_FILTER_CLASS(klass),FILTER_IS_SOURCE|FILTER_HAS_QUEUES);
|
|
45 }
|
|
46
|
|
47 void ms_video_source_init(MSVideoSource *obj)
|
|
48 {
|
|
49 ms_filter_init(MS_FILTER(obj));
|
|
50 MS_FILTER(obj)->outqueues=obj->outputs;
|
|
51 obj->width = VIDEO_SIZE_CIF_W;
|
|
52 obj->height = VIDEO_SIZE_CIF_H;
|
|
53 }
|
|
54
|
|
55 void ms_video_source_start(MSVideoSource *f)
|
|
56 {
|
|
57 MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->start(f);
|
|
58 }
|
|
59
|
|
60 void ms_video_source_stop(MSVideoSource *f)
|
|
61 {
|
|
62 MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->stop(f);
|
|
63 }
|
|
64
|
|
65 int ms_video_source_set_device(MSVideoSource *f, const gchar *device)
|
|
66 {
|
|
67 return MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_device(f,device);
|
|
68 }
|
|
69
|
|
70 gchar* ms_video_source_get_device_name(MSVideoSource *f)
|
|
71 {
|
|
72 return f->dev_name;
|
|
73 }
|
|
74
|
|
75 void ms_video_source_set_size(MSVideoSource *f, gint width, gint height)
|
|
76 {
|
|
77 if (MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_size)
|
|
78 MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_size(f, width, height);
|
|
79 }
|
|
80
|
|
81 void ms_video_source_set_frame_rate(MSVideoSource *f, gint frame_rate, gint frame_rate_base)
|
|
82 {
|
|
83 if (MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_frame_rate)
|
|
84 MS_VIDEO_SOURCE_CLASS(MS_FILTER(f)->klass)->set_frame_rate(f, frame_rate, frame_rate_base);
|
|
85 else{
|
|
86 f->frame_rate=frame_rate;
|
|
87 f->frame_rate_base=frame_rate_base;
|
|
88 }
|
|
89 }
|
|
90
|
|
91 gchar* ms_video_source_get_format(MSVideoSource *f)
|
|
92 {
|
|
93 return f->format;
|
|
94 }
|