Debian Codegraph @

Xpjproject/pjsip-apps/src/3rdparty_media_sample/alt_pjsua_vid.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #include <pjsua-lib/pjsua.h>
19 #include <pjsua-lib/pjsua_internal.h>
20
21 #if defined(PJSUA_MEDIA_HAS_PJMEDIA) && PJSUA_MEDIA_HAS_PJMEDIA != 0
22 # error The PJSUA_MEDIA_HAS_PJMEDIA should be declared as zero
23 #endif
24
25 #if PJSUA_HAS_VIDEO
26
27 #define THIS_FILE "alt_pjsua_vid.c"
28 #define UNIMPLEMENTED(func) PJ_LOG(2,(THIS_FILE, "*** Call to unimplemented function %s ***", #func));
29
30 /*****************************************************************************
31 * Our video codec descriptors
32 */
33 struct alt_codec_desc
34 {
35 /* Predefined info */
36 pjmedia_vid_codec_info info;
37 pjmedia_format_id base_fmt_id;
38 pj_uint32_t avg_bps;
39 pj_uint32_t max_bps;
40 pjmedia_codec_fmtp dec_fmtp;
41 } alt_vid_codecs[] =
42 {
43 /* H.263+ */
44 {
45 {PJMEDIA_FORMAT_H263P, PJMEDIA_RTP_PT_H263P, {"H263-1998",9},
46 {"H.263 codec", 11}, 90000, PJMEDIA_DIR_ENCODING_DECODING,
47 0, {PJMEDIA_FORMAT_RGB24}, PJMEDIA_VID_PACKING_PACKETS
48 },
49 PJMEDIA_FORMAT_H263, 256000, 512000,
50 {2, { {{"CIF",3}, {"1",1}},
51 {{"QCIF",4}, {"1",1}}, } },
52 }
53 };
54
55 static const struct alt_codec_desc* find_codec_desc_by_info(const pjmedia_vid_codec_info *info)
56 {
57 unsigned i;
58 for (i=0; i<PJ_ARRAY_SIZE(alt_vid_codecs); ++i) {
59 struct alt_codec_desc *desc = &alt_vid_codecs[i];
60 if ((desc->info.fmt_id == info->fmt_id) &&
61 ((desc->info.dir & info->dir) == info->dir) &&
62 (desc->info.pt == info->pt) &&
63 (desc->info.packings & info->packings))
64 {
65 return desc;
66 }
67 }
68
69 return NULL;
70 }
71
72 static pj_status_t alt_vid_codec_test_alloc( pjmedia_vid_codec_factory *factory,
73 const pjmedia_vid_codec_info *id )
74 {
75 const struct alt_codec_desc *desc = find_codec_desc_by_info(id);
76 return desc? PJ_SUCCESS : PJMEDIA_CODEC_EUNSUP;
77 }
78
79 static pj_status_t alt_vid_codec_default_attr( pjmedia_vid_codec_factory *factory,
80 const pjmedia_vid_codec_info *info,
81 pjmedia_vid_codec_param *attr )
82 {
83 const struct alt_codec_desc *desc = find_codec_desc_by_info(info);
84 unsigned i;
85
86 if (!desc)
87 return PJMEDIA_CODEC_EUNSUP;
88
89 pj_bzero(attr, sizeof(pjmedia_vid_codec_param));
90
91 /* Scan the requested packings and use the lowest number */
92 attr->packing = 0;
93 for (i=0; i<15; ++i) {
94 unsigned packing = (1 << i);
95 if ((desc->info.packings & info->packings) & packing) {
96 attr->packing = (pjmedia_vid_packing)packing;
97 break;
98 }
99 }
100 if (attr->packing == 0) {
101 /* No supported packing in info */
102 return PJMEDIA_CODEC_EUNSUP;
103 }
104
105 /* Direction */
106 attr->dir = desc->info.dir;
107
108 /* Encoded format */
109 pjmedia_format_init_video(&attr->enc_fmt, desc->info.fmt_id,
110 720, 480, 30000, 1001);
111
112 /* Decoded format */
113 pjmedia_format_init_video(&attr->dec_fmt, desc->info.dec_fmt_id[0],
114 //352, 288, 30000, 1001);
115 720, 576, 30000, 1001);
116
117 /* Decoding fmtp */
118 attr->dec_fmtp = desc->dec_fmtp;
119
120 /* Bitrate */
121 attr->enc_fmt.det.vid.avg_bps = desc->avg_bps;
122 attr->enc_fmt.det.vid.max_bps = desc->max_bps;
123
124 /* MTU */
125 attr->enc_mtu = PJMEDIA_MAX_MTU;
126
127 return PJ_SUCCESS;
128 }
129
130
131 static pj_status_t alt_vid_codec_enum_codecs( pjmedia_vid_codec_factory *factory,
132 unsigned *count,
133 pjmedia_vid_codec_info codecs[])
134 {
135 unsigned i, max_cnt;
136
137 PJ_ASSERT_RETURN(codecs && *count > 0, PJ_EINVAL);
138
139 max_cnt = PJ_MIN(*count, PJ_ARRAY_SIZE(alt_vid_codecs));
140 *count = 0;
141
142 for (i=0; i<max_cnt; ++i) {
143 pj_memcpy(&codecs[*count], &alt_vid_codecs[i].info,
144 sizeof(pjmedia_vid_codec_info));
145 (*count)++;
146 }
147
148 return PJ_SUCCESS;
149 }
150
151
152 static pj_status_t alt_vid_codec_alloc_codec( pjmedia_vid_codec_factory *factory,
153 const pjmedia_vid_codec_info *info,
154 pjmedia_vid_codec **p_codec)
155 {
156 /* This will never get called since we won't be using this codec */
157 UNIMPLEMENTED(alt_vid_codec_alloc_codec)
158 return PJ_ENOTSUP;
159 }
160
161
162 static pj_status_t alt_vid_codec_dealloc_codec( pjmedia_vid_codec_factory *factory,
163 pjmedia_vid_codec *codec )
164 {
165 /* This will never get called since we won't be using this codec */
166 UNIMPLEMENTED(alt_vid_codec_dealloc_codec)
167 return PJ_ENOTSUP;
168 }
169
170 static pjmedia_vid_codec_factory_op alt_vid_codec_factory_op =
171 {
172 &alt_vid_codec_test_alloc,
173 &alt_vid_codec_default_attr,
174 &alt_vid_codec_enum_codecs,
175 &alt_vid_codec_alloc_codec,
176 &alt_vid_codec_dealloc_codec
177 };
178
179 static struct alt_vid_codec_factory {
180 pjmedia_vid_codec_factory base;
181 } alt_vid_codec_factory;
182
183 /*****************************************************************************
184 * Video API implementation
185 */
186
187 /* Initialize the video library */
188 pj_status_t pjsua_vid_subsys_init(void)
189 {
190 pjmedia_vid_codec_mgr *mgr;
191 pj_status_t status;
192
193 /* Format manager singleton is needed */
194 status = pjmedia_video_format_mgr_create(pjsua_var.pool, 64, 0, NULL);
195 if (status != PJ_SUCCESS) {
196 PJ_PERROR(1,(THIS_FILE, status,
197 "Error creating PJMEDIA video format manager"));
198 return status;
199 }
200
201 /* Create video codec manager singleton */
202 status = pjmedia_vid_codec_mgr_create(pjsua_var.pool, &mgr);
203 if (status != PJ_SUCCESS) {
204 PJ_PERROR(1,(THIS_FILE, status,
205 "Error creating PJMEDIA video codec manager"));
206 return status;
207 }
208
209 /* Register our codecs */
210 alt_vid_codec_factory.base.op = &alt_vid_codec_factory_op;
211 alt_vid_codec_factory.base.factory_data = NULL;
212
213 status = pjmedia_vid_codec_mgr_register_factory(mgr, &alt_vid_codec_factory.base);
214 if (status != PJ_SUCCESS)
215 return status;
216
217 /*
218 * TODO: put your 3rd party library initialization routine here
219 */
220
221 return PJ_SUCCESS;
222 }
223
224 /* Start the video library */
225 pj_status_t pjsua_vid_subsys_start(void)
226 {
227 /*
228 * TODO: put your 3rd party library startup routine here
229 */
230 return PJ_SUCCESS;
231 }
232
233 /* Cleanup and deinitialize the video library */
234 pj_status_t pjsua_vid_subsys_destroy(void)
235 {
236 if (pjmedia_vid_codec_mgr_instance())
237 pjmedia_vid_codec_mgr_destroy(NULL);
238
239 if (pjmedia_video_format_mgr_instance())
240 pjmedia_video_format_mgr_destroy(NULL);
241
242 /*
243 * TODO: put your 3rd party library cleanup routine here
244 */
245 return PJ_SUCCESS;
246 }
247
248 /* Initialize video call media */
249 pj_status_t pjsua_vid_channel_init(pjsua_call_media *call_med)
250 {
251 /*
252 * TODO: put call media initialization
253 */
254 return PJ_SUCCESS;
255 }
256
257 /* Internal function to stop video stream */
258 void pjsua_vid_stop_stream(pjsua_call_media *call_med)
259 {
260 PJ_LOG(4,(THIS_FILE, "Stopping video stream.."));
261
262 if (call_med->tp) {
263 pjmedia_transport_detach(call_med->tp, call_med);
264 }
265
266 /*
267 * TODO:
268 * - stop your video stream here
269 */
270
271 }
272
273 /* Our callback to receive incoming RTP packets */
274 static void vid_rtp_cb(void *user_data, void *pkt, pj_ssize_t size)
275 {
276 pjsua_call_media *call_med = (pjsua_call_media*) user_data;
277
278 /* TODO: Do something with the packet */
279 PJ_LOG(4,(THIS_FILE, "RX %d bytes video RTP packet", (int)size));
280 }
281
282 /* Our callback to receive RTCP packets */
283 static void vid_rtcp_cb(void *user_data, void *pkt, pj_ssize_t size)
284 {
285 pjsua_call_media *call_med = (pjsua_call_media*) user_data;
286
287 /* TODO: Do something with the packet here */
288 PJ_LOG(4,(THIS_FILE, "RX %d bytes video RTCP packet", (int)size));
289 }
290
291 /* A demo function to send dummy "RTP" packets periodically. You would not
292 * need to have this function in the real app!
293 */
294 static void timer_to_send_vid_rtp(void *user_data)
295 {
296 pjsua_call_media *call_med = (pjsua_call_media*) user_data;
297 const char *pkt = "Not RTP packet";
298
299 if (!call_med->call || !call_med->call->inv || !call_med->tp) {
300 /* Call has been disconnected. There is race condition here as
301 * this cb may be called sometime after call has been disconnected */
302 return;
303 }
304
305 pjmedia_transport_send_rtp(call_med->tp, pkt, strlen(pkt));
306
307 pjsua_schedule_timer2(&timer_to_send_vid_rtp, call_med, 2000);
308 }
309
310 static void timer_to_send_vid_rtcp(void *user_data)
311 {
312 pjsua_call_media *call_med = (pjsua_call_media*) user_data;
313 const char *pkt = "Not RTCP packet";
314
315 if (!call_med->call || !call_med->call->inv || !call_med->tp) {
316 /* Call has been disconnected. There is race condition here as
317 * this cb may be called sometime after call has been disconnected */
318 return;
319 }
320
321 pjmedia_transport_send_rtcp(call_med->tp, pkt, strlen(pkt));
322
323 pjsua_schedule_timer2(&timer_to_send_vid_rtcp, call_med, 5000);
324 }
325
326 /* update video channel after SDP negotiation */
327 pj_status_t pjsua_vid_channel_update(pjsua_call_media *call_med,
328 pj_pool_t *tmp_pool,
329 pjmedia_vid_stream_info *si,
330 const pjmedia_sdp_session *local_sdp,
331 const pjmedia_sdp_session *remote_sdp)
332 {
333 pj_status_t status;
334
335 PJ_LOG(4,(THIS_FILE, "Video channel update.."));
336 pj_log_push_indent();
337
338 /* Check if no media is active */
339 if (si->dir != PJMEDIA_DIR_NONE) {
340 /* Attach our RTP and RTCP callbacks to the media transport */
341 status = pjmedia_transport_attach(call_med->tp, call_med,
342 &si->rem_addr, &si->rem_rtcp,
343 pj_sockaddr_get_len(&si->rem_addr),
344 &vid_rtp_cb, &vid_rtcp_cb);
345 /*
346 * TODO:
347 * - Create and start your video stream based on the parameters
348 * in si
349 */
350
351 /* For a demonstration, let's use a timer to send "RTP" packet
352 * periodically.
353 */
354 pjsua_schedule_timer2(&timer_to_send_vid_rtp, call_med, 1000);
355 pjsua_schedule_timer2(&timer_to_send_vid_rtcp, call_med, 3500);
356 }
357
358 pj_log_pop_indent();
359 return PJ_SUCCESS;
360 }
361
362
363 /*****************************************************************************
364 * Preview
365 */
366
367 PJ_DEF(void)
368 pjsua_call_vid_strm_op_param_default(pjsua_call_vid_strm_op_param *param)
369 {
370 pj_bzero(param, sizeof(*param));
371 param->med_idx = -1;
372 param->dir = PJMEDIA_DIR_ENCODING_DECODING;
373 param->cap_dev = PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
374 }
375
376 PJ_DEF(void) pjsua_vid_preview_param_default(pjsua_vid_preview_param *p)
377 {
378 p->rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV;
379 p->show = PJ_TRUE;
380 }
381
382 PJ_DEF(pjsua_vid_win_id) pjsua_vid_preview_get_win(pjmedia_vid_dev_index id)
383 {
384 UNIMPLEMENTED(pjsua_vid_preview_get_win)
385 return PJSUA_INVALID_ID;
386 }
387
388 /* Get video conference slot ID of the specified capture device. */
389 PJ_DEF(pjsua_conf_port_id) pjsua_vid_preview_get_vid_conf_port(
390 pjmedia_vid_dev_index id)
391 {
392 UNIMPLEMENTED(pjsua_vid_preview_get_vid_conf_port)
393 return PJSUA_INVALID_ID;
394 }
395
396 /* Reset internal window structure. Not sure if this is needed?. */
397 PJ_DEF(void) pjsua_vid_win_reset(pjsua_vid_win_id wid)
398 {
399 pjsua_vid_win *w = &pjsua_var.win[wid];
400 pj_pool_t *pool = w->pool;
401
402 pj_bzero(w, sizeof(*w));
403 if (pool) pj_pool_reset(pool);
404 w->ref_cnt = 0;
405 w->pool = pool;
406 w->preview_cap_id = PJMEDIA_VID_INVALID_DEV;
407 }
408
409 /* Does it have built-in preview support. */
410 PJ_DEF(pj_bool_t) pjsua_vid_preview_has_native(pjmedia_vid_dev_index id)
411 {
412 UNIMPLEMENTED(pjsua_vid_preview_has_native)
413 return PJ_FALSE;
414 }
415
416 /* Start video preview window for the specified capture device. */
417 PJ_DEF(pj_status_t) pjsua_vid_preview_start(pjmedia_vid_dev_index id,
418 const pjsua_vid_preview_param *prm)
419 {
420 UNIMPLEMENTED(pjsua_vid_preview_start)
421 return PJ_ENOTSUP;
422 }
423
424 /* Stop video preview. */
425 PJ_DEF(pj_status_t) pjsua_vid_preview_stop(pjmedia_vid_dev_index id)
426 {
427 UNIMPLEMENTED(pjsua_vid_preview_stop)
428 return PJ_ENOTSUP;
429 }
430
431
432 /*****************************************************************************
433 * Devices.
434 */
435
436 /* Get the number of video devices installed in the system. */
437 PJ_DEF(unsigned) pjsua_vid_dev_count(void)
438 {
439 UNIMPLEMENTED(pjsua_vid_dev_count)
440 return 0;
441 }
442
443 /* Retrieve the video device info for the specified device index. */
444 PJ_DEF(pj_status_t) pjsua_vid_dev_get_info(pjmedia_vid_dev_index id,
445 pjmedia_vid_dev_info *vdi)
446 {
447 UNIMPLEMENTED(pjsua_vid_dev_get_info)
448 return PJ_ENOTSUP;
449 }
450
451 /* Enum all video devices installed in the system. */
452 PJ_DEF(pj_status_t) pjsua_vid_enum_devs(pjmedia_vid_dev_info info[],
453 unsigned *count)
454 {
455 UNIMPLEMENTED(pjsua_vid_enum_devs)
456 return PJ_ENOTSUP;
457 }
458
459 /* Check whether the video device is currently active. */
460 PJ_DEF(pj_bool_t) pjsua_vid_dev_is_active(pjmedia_vid_dev_index id)
461 {
462 UNIMPLEMENTED(pjsua_vid_dev_is_active)
463 return PJ_FALSE;
464 }
465
466 /* Set the capability of the video device. */
467 PJ_DEF(pj_status_t) pjsua_vid_dev_set_setting( pjmedia_vid_dev_index id,
468 pjmedia_vid_dev_cap cap,
469 const void *pval,
470 pj_bool_t keep)
471 {
472 UNIMPLEMENTED(pjsua_vid_dev_set_setting)
473 return PJ_ENOTSUP;
474 }
475
476 /* Get the value of the video device capability. */
477 PJ_DEF(pj_status_t) pjsua_vid_dev_get_setting( pjmedia_vid_dev_index id,
478 pjmedia_vid_dev_cap cap,
479 void *pval)
480 {
481 UNIMPLEMENTED(pjsua_vid_dev_get_setting)
482 return PJ_ENOTSUP;
483 }
484
485 /*****************************************************************************
486 * Codecs.
487 */
488
489 /* Enum all supported video codecs in the system. */
490 PJ_DEF(pj_status_t) pjsua_vid_enum_codecs( pjsua_codec_info id[],
491 unsigned *p_count )
492 {
493 pjmedia_vid_codec_info info[32];
494 unsigned i, j, count, prio[32];
495 pj_status_t status;
496
497 count = PJ_ARRAY_SIZE(info);
498 status = pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, prio);
499 if (status != PJ_SUCCESS) {
500 *p_count = 0;
501 return status;
502 }
503 for (i=0, j=0; i<count && j<*p_count; ++i) {
504 if (info[i].packings & PJMEDIA_VID_PACKING_PACKETS) {
505 pj_bzero(&id[j], sizeof(pjsua_codec_info));
506
507 pjmedia_vid_codec_info_to_id(&info[i], id[j].buf_, sizeof(id[j].buf_));
508 id[j].codec_id = pj_str(id[j].buf_);
509 id[j].priority = (pj_uint8_t) prio[i];
510
511 if (id[j].codec_id.slen < sizeof(id[j].buf_)) {
512 id[j].desc.ptr = id[j].codec_id.ptr + id[j].codec_id.slen + 1;
513 pj_strncpy(&id[j].desc, &info[i].encoding_desc,
514 sizeof(id[j].buf_) - id[j].codec_id.slen - 1);
515 }
516
517 ++j;
518 }
519 }
520
521 *p_count = j;
522 return PJ_SUCCESS;
523 }
524
525 /* Change video codec priority. */
526 PJ_DEF(pj_status_t) pjsua_vid_codec_set_priority( const pj_str_t *codec_id,
527 pj_uint8_t priority )
528 {
529 UNIMPLEMENTED(pjsua_vid_codec_set_priority)
530 return PJ_ENOTSUP;
531 }
532
533 /* Get video codec parameters. */
534 PJ_DEF(pj_status_t) pjsua_vid_codec_get_param(
535 const pj_str_t *codec_id,
536 pjmedia_vid_codec_param *param)
537 {
538 UNIMPLEMENTED(pjsua_vid_codec_get_param)
539 return PJ_ENOTSUP;
540 }
541
542 /* Set video codec parameters. */
543 PJ_DEF(pj_status_t) pjsua_vid_codec_set_param(
544 const pj_str_t *codec_id,
545 const pjmedia_vid_codec_param *param)
546 {
547 UNIMPLEMENTED(pjsua_vid_codec_set_param)
548 return PJ_ENOTSUP;
549 }
550
551
552 /*****************************************************************************
553 * Window
554 */
555
556 /* Enumerates all video windows. */
557 PJ_DEF(pj_status_t) pjsua_vid_enum_wins( pjsua_vid_win_id wids[],
558 unsigned *count)
559 {
560 UNIMPLEMENTED(pjsua_vid_enum_wins)
561 return PJ_ENOTSUP;
562 }
563
564 /* Get window info. */
565 PJ_DEF(pj_status_t) pjsua_vid_win_get_info( pjsua_vid_win_id wid,
566 pjsua_vid_win_info *wi)
567 {
568 UNIMPLEMENTED(pjsua_vid_win_get_info)
569 return PJ_ENOTSUP;
570 }
571
572 /* Show or hide window. */
573 PJ_DEF(pj_status_t) pjsua_vid_win_set_show( pjsua_vid_win_id wid,
574 pj_bool_t show)
575 {
576 UNIMPLEMENTED(pjsua_vid_win_set_show)
577 return PJ_ENOTSUP;
578 }
579
580 /* Set video window position. */
581 PJ_DEF(pj_status_t) pjsua_vid_win_set_pos( pjsua_vid_win_id wid,
582 const pjmedia_coord *pos)
583 {
584 UNIMPLEMENTED(pjsua_vid_win_set_pos)
585 return PJ_ENOTSUP;
586 }
587
588 /* Resize window. */
589 PJ_DEF(pj_status_t) pjsua_vid_win_set_size( pjsua_vid_win_id wid,
590 const pjmedia_rect_size *size)
591 {
592 UNIMPLEMENTED(pjsua_vid_win_set_size)
593 return PJ_ENOTSUP;
594 }
595
596 /* Set video window fullscreen. */
597 PJ_DEF(pj_status_t) pjsua_vid_win_set_fullscreen(
598 pjsua_vid_win_id wid,
599 pjmedia_vid_dev_fullscreen_flag mode)
600 {
601 UNIMPLEMENTED(pjsua_vid_win_set_fullscreen)
602 return PJ_ENOTSUP;
603 }
604
605 /* Set output window. */
606 PJ_DEF(pj_status_t) pjsua_vid_win_set_win( pjsua_vid_win_id wid,
607 const pjmedia_vid_dev_hwnd *win)
608 {
609 UNIMPLEMENTED(pjsua_vid_win_set_win)
610 return PJ_ENOTSUP;
611 }
612
613 /* Set video orientation. */
614 PJ_DEF(pj_status_t) pjsua_vid_win_rotate( pjsua_vid_win_id wid,
615 int angle)
616 {
617 UNIMPLEMENTED(pjsua_vid_win_rotate)
618 return PJ_ENOTSUP;
619 }
620
621 /* Start, stop, and/or manipulate video transmission for the specified call. */
622 PJ_DEF(pj_status_t) pjsua_call_set_vid_strm (
623 pjsua_call_id call_id,
624 pjsua_call_vid_strm_op op,
625 const pjsua_call_vid_strm_op_param *param)
626 {
627 UNIMPLEMENTED(pjsua_call_set_vid_strm)
628 return PJ_ENOTSUP;
629 }
630
631
632 /* Get the media stream index of the default video stream in the call. */
633 PJ_DEF(int) pjsua_call_get_vid_stream_idx(pjsua_call_id call_id)
634 {
635 UNIMPLEMENTED(pjsua_call_get_vid_stream_idx)
636 return -1;
637 }
638
639 /* Determine if video stream for the specified call is currently running
640 * for the specified direction.
641 */
642 PJ_DEF(pj_bool_t) pjsua_call_vid_stream_is_running( pjsua_call_id call_id,
643 int med_idx,
644 pjmedia_dir dir)
645 {
646 UNIMPLEMENTED(pjsua_call_vid_stream_is_running)
647 return PJ_FALSE;
648 }
649
650 /* Enumerate all video conference ports. */
651 PJ_DEF(pj_status_t) pjsua_vid_conf_enum_ports( pjsua_conf_port_id id[],
652 unsigned *count)
653 {
654 UNIMPLEMENTED(pjsua_vid_conf_enum_ports)
655 return PJ_ENOTSUP;
656 }
657
658 /* Get information about the specified video conference port. */
659 PJ_DEF(pj_status_t) pjsua_vid_conf_get_port_info(
660 pjsua_conf_port_id port_id,
661 pjsua_vid_conf_port_info *info)
662 {
663 UNIMPLEMENTED(pjsua_vid_conf_get_port_info)
664 return PJ_ENOTSUP;
665 }
666
667 /* Establish unidirectional video flow from souce to sink. */
668 PJ_DEF(pj_status_t) pjsua_vid_conf_connect( pjsua_conf_port_id source,
669 pjsua_conf_port_id sink,
670 const void *param)
671 {
672 UNIMPLEMENTED(pjsua_vid_conf_connect)
673 return PJ_ENOTSUP;
674 }
675
676 /* Disconnect video flow from the source to destination port. */
677 PJ_DEF(pj_status_t) pjsua_vid_conf_disconnect(pjsua_conf_port_id source,
678 pjsua_conf_port_id sink)
679 {
680 UNIMPLEMENTED(pjsua_vid_conf_disconnect)
681 return PJ_ENOTSUP;
682 }
683
684 /* Add arbitrary video media port to PJSUA's video conference bridge. */
685 PJ_DEF(pj_status_t) pjsua_vid_conf_add_port( pj_pool_t *pool,
686 pjmedia_port *port,
687 const void *param,
688 pjsua_conf_port_id *p_id)
689 {
690 UNIMPLEMENTED(pjsua_vid_conf_add_port)
691 return PJ_ENOTSUP;
692 }
693
694 /* Remove arbitrary slot from the video conference bridge. */
695 PJ_DEF(pj_status_t) pjsua_vid_conf_remove_port(pjsua_conf_port_id id)
696 {
697 UNIMPLEMENTED(pjsua_vid_conf_remove_port)
698 return PJ_ENOTSUP;
699 }
700
701 /* Update or refresh port states from video port info. */
702 PJ_DEF(pj_status_t) pjsua_vid_conf_update_port(pjsua_conf_port_id id)
703 {
704 UNIMPLEMENTED(pjsua_vid_conf_update_port)
705 return PJ_ENOTSUP;
706 }
707
708 /* Get video conference port id of a call stream. */
709 PJ_DEF(pjsua_conf_port_id) pjsua_call_get_vid_conf_port(
710 pjsua_call_id call_id,
711 pjmedia_dir dir)
712 {
713 PJ_UNUSED_ARG(call_id);
714 PJ_UNUSED_ARG(dir);
715 UNIMPLEMENTED(pjsua_call_get_vid_conf_port)
716 return PJSUA_INVALID_ID;
717 }
718
719 /* Reset AVI player data (internal, called from pjsua_core). */
720 void pjsua_reset_avi_player_data(pjsua_avi_player_id id)
721 {
722 PJ_UNUSED_ARG(id);
723 }
724
725 /* Reset AVI recorder data (internal, called from pjsua_core). */
726 void pjsua_reset_avi_recorder_data(pjsua_avi_rec_id id)
727 {
728 PJ_UNUSED_ARG(id);
729 }
730
731 /* Create AVI player. */
732 PJ_DEF(pj_status_t) pjsua_avi_player_create(const pj_str_t *filename,
733 pjsua_avi_player_id *id)
734 {
735 PJ_UNUSED_ARG(filename);
736 PJ_UNUSED_ARG(id);
737 UNIMPLEMENTED(pjsua_avi_player_create)
738 return PJ_ENOTSUP;
739 }
740
741 /* Destroy AVI player. */
742 PJ_DEF(pj_status_t) pjsua_avi_player_destroy(pjsua_avi_player_id id)
743 {
744 PJ_UNUSED_ARG(id);
745 UNIMPLEMENTED(pjsua_avi_player_destroy)
746 return PJ_ENOTSUP;
747 }
748
749 /* Get audio conference port of AVI player. */
750 PJ_DEF(pjsua_conf_port_id) pjsua_avi_player_get_conf_port(
751 pjsua_avi_player_id id,
752 pjmedia_type strm_type,
753 unsigned strm_idx)
754 {
755 PJ_UNUSED_ARG(id);
756 PJ_UNUSED_ARG(strm_type);
757 PJ_UNUSED_ARG(strm_idx);
758 UNIMPLEMENTED(pjsua_avi_player_get_conf_port)
759 return PJSUA_INVALID_ID;
760 }
761
762 /* Get video device index of AVI player. */
763 PJ_DEF(pjmedia_vid_dev_index) pjsua_avi_player_get_vid_dev(
764 pjsua_avi_player_id id)
765 {
766 PJ_UNUSED_ARG(id);
767 UNIMPLEMENTED(pjsua_avi_player_get_vid_dev)
768 return PJMEDIA_VID_INVALID_DEV;
769 }
770
771 /* Create AVI recorder. */
772 PJ_DEF(pj_status_t) pjsua_avi_recorder_create(const pj_str_t *filename,
773 pj_ssize_t max_size,
774 const pjmedia_format *vid_fmt,
775 const pjmedia_format *aud_fmt,
776 unsigned options,
777 pjsua_avi_rec_id *id)
778 {
779 PJ_UNUSED_ARG(filename);
780 PJ_UNUSED_ARG(max_size);
781 PJ_UNUSED_ARG(vid_fmt);
782 PJ_UNUSED_ARG(aud_fmt);
783 PJ_UNUSED_ARG(options);
784 PJ_UNUSED_ARG(id);
785 UNIMPLEMENTED(pjsua_avi_recorder_create)
786 return PJ_ENOTSUP;
787 }
788
789 /* Destroy AVI recorder. */
790 PJ_DEF(pj_status_t) pjsua_avi_recorder_destroy(pjsua_avi_rec_id id)
791 {
792 PJ_UNUSED_ARG(id);
793 UNIMPLEMENTED(pjsua_avi_recorder_destroy)
794 return PJ_ENOTSUP;
795 }
796
797 /* Get audio conference port of AVI recorder. */
798 PJ_DEF(pjsua_conf_port_id) pjsua_avi_recorder_get_conf_port(
799 pjsua_avi_rec_id id,
800 unsigned strm_idx)
801 {
802 PJ_UNUSED_ARG(id);
803 PJ_UNUSED_ARG(strm_idx);
804 UNIMPLEMENTED(pjsua_avi_recorder_get_conf_port)
805 return PJSUA_INVALID_ID;
806 }
807
808 /* Set AVI recorder callback. */
809 PJ_DEF(pj_status_t) pjsua_avi_recorder_set_cb(
810 pjsua_avi_rec_id id,
811 void *user_data,
812 void(*cb)(pjsua_avi_rec_id rec_id,
813 void *usr_data))
814 {
815 PJ_UNUSED_ARG(id);
816 PJ_UNUSED_ARG(user_data);
817 PJ_UNUSED_ARG(cb);
818 UNIMPLEMENTED(pjsua_avi_recorder_set_cb)
819 return PJ_ENOTSUP;
820 }
821
822 #endif /* PJSUA_HAS_VIDEO */
823