| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#include "asterisk.h" |
| 44 |
#include <sys/ioctl.h> |
| 45 |
#include "asterisk/cli.h" |
| 46 |
#include "asterisk/file.h" |
| 47 |
#include "asterisk/channel.h" |
| 48 |
|
| 49 |
#include "console_video.h" |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
#if !defined(HAVE_VIDEO_CONSOLE) || !defined(HAVE_FFMPEG) |
| 124 |
|
| 125 |
int console_write_video(struct ast_channel *chan, struct ast_frame *f) |
| 126 |
{ |
| 127 |
return 0; |
| 128 |
} |
| 129 |
|
| 130 |
int console_video_cli(struct video_desc *env, const char *var, int fd) |
| 131 |
{ |
| 132 |
return 1; |
| 133 |
} |
| 134 |
|
| 135 |
int console_video_config(struct video_desc **penv, const char *var, const char *val) |
| 136 |
{ |
| 137 |
return 1; |
| 138 |
} |
| 139 |
|
| 140 |
void console_video_start(struct video_desc *env, struct ast_channel *owner) |
| 141 |
{ |
| 142 |
ast_log(LOG_NOTICE, "voice only, console video support not present\n"); |
| 143 |
} |
| 144 |
|
| 145 |
void console_video_uninit(struct video_desc *env) |
| 146 |
{ |
| 147 |
} |
| 148 |
|
| 149 |
int get_gui_startup(struct video_desc* env) |
| 150 |
{ |
| 151 |
return 0; |
| 152 |
} |
| 153 |
|
| 154 |
int console_video_formats = 0; |
| 155 |
|
| 156 |
#else |
| 157 |
|
| 158 |
|
| 159 |
int console_video_formats = |
| 160 |
AST_FORMAT_H263_PLUS | AST_FORMAT_H263 | |
| 161 |
AST_FORMAT_MP4_VIDEO | AST_FORMAT_H264 | AST_FORMAT_H261 ; |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
static void my_scale(struct fbuf_t *in, AVPicture *p_in, |
| 167 |
struct fbuf_t *out, AVPicture *p_out); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
struct video_device { |
| 175 |
char *name; |
| 176 |
|
| 177 |
struct grab_desc *grabber; |
| 178 |
void *grabber_data; |
| 179 |
struct fbuf_t *dev_buf; |
| 180 |
struct timeval last_frame; |
| 181 |
int status_index; |
| 182 |
|
| 183 |
|
| 184 |
}; |
| 185 |
|
| 186 |
struct video_codec_desc; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
struct video_out_desc { |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
int fps; |
| 208 |
int bitrate; |
| 209 |
int qmin; |
| 210 |
|
| 211 |
int sendvideo; |
| 212 |
|
| 213 |
struct fbuf_t loc_src_geometry; |
| 214 |
struct fbuf_t enc_out; |
| 215 |
|
| 216 |
struct video_codec_desc *enc; |
| 217 |
void *enc_ctx; |
| 218 |
AVCodec *codec; |
| 219 |
AVFrame *enc_in_frame; |
| 220 |
|
| 221 |
int mtu; |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
struct video_device devices[MAX_VIDEO_SOURCES]; |
| 227 |
int device_num; |
| 228 |
int device_primary; |
| 229 |
int device_secondary; |
| 230 |
|
| 231 |
int picture_in_picture; |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
int pip_x; |
| 236 |
int pip_y; |
| 237 |
}; |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
struct video_desc { |
| 246 |
char codec_name[64]; |
| 247 |
|
| 248 |
int stayopen; |
| 249 |
pthread_t vthread; |
| 250 |
ast_mutex_t dec_lock; |
| 251 |
int shutdown; |
| 252 |
struct ast_channel *owner; |
| 253 |
|
| 254 |
|
| 255 |
struct fbuf_t enc_in; |
| 256 |
|
| 257 |
char keypad_file[256]; |
| 258 |
char keypad_font[256]; |
| 259 |
|
| 260 |
char sdl_videodriver[256]; |
| 261 |
|
| 262 |
struct fbuf_t rem_dpy; |
| 263 |
struct fbuf_t loc_dpy; |
| 264 |
|
| 265 |
|
| 266 |
struct fbuf_t src_dpy[MAX_VIDEO_SOURCES]; |
| 267 |
|
| 268 |
int frame_freeze; |
| 269 |
|
| 270 |
|
| 271 |
struct gui_info *gui; |
| 272 |
struct video_dec_desc *in; |
| 273 |
struct video_out_desc out; |
| 274 |
}; |
| 275 |
|
| 276 |
static AVPicture *fill_pict(struct fbuf_t *b, AVPicture *p); |
| 277 |
|
| 278 |
void fbuf_free(struct fbuf_t *b) |
| 279 |
{ |
| 280 |
struct fbuf_t x = *b; |
| 281 |
|
| 282 |
if (b->data && b->size) |
| 283 |
ast_free(b->data); |
| 284 |
memset(b, '\0', sizeof(*b)); |
| 285 |
|
| 286 |
b->w = x.w; |
| 287 |
b->h = x.h; |
| 288 |
b->pix_fmt = x.pix_fmt; |
| 289 |
} |
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
int get_gui_startup(struct video_desc* env) |
| 295 |
{ |
| 296 |
return env ? env->stayopen : 0; |
| 297 |
} |
| 298 |
|
| 299 |
#if 0 |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
static int |
| 305 |
used_mem(const char *msg) |
| 306 |
{ |
| 307 |
char in[128]; |
| 308 |
|
| 309 |
pid_t pid = getpid(); |
| 310 |
sprintf(in, "ps -o vsz= -o rss= %d", pid); |
| 311 |
ast_log(LOG_WARNING, "used mem (vsize, rss) %s ", msg); |
| 312 |
system(in); |
| 313 |
return 0; |
| 314 |
} |
| 315 |
#endif |
| 316 |
|
| 317 |
#include "vcodecs.c" |
| 318 |
#include "console_gui.c" |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
static int grabber_open(struct video_out_desc *v) |
| 333 |
{ |
| 334 |
struct grab_desc *g; |
| 335 |
void *g_data; |
| 336 |
int i, j; |
| 337 |
|
| 338 |
|
| 339 |
for (i = 0; i < v->device_num; i++) { |
| 340 |
|
| 341 |
if (v->devices[i].grabber) |
| 342 |
continue; |
| 343 |
|
| 344 |
for (j = 0; (g = console_grabbers[j]); j++) { |
| 345 |
|
| 346 |
g_data = g->open(v->devices[i].name, &v->loc_src_geometry, v->fps); |
| 347 |
if (!g_data) |
| 348 |
continue; |
| 349 |
v->devices[i].grabber = g; |
| 350 |
v->devices[i].grabber_data = g_data; |
| 351 |
v->devices[i].status_index |= IS_ON; |
| 352 |
} |
| 353 |
} |
| 354 |
|
| 355 |
for (i = 0; i < v->device_num; i++) { |
| 356 |
if (!v->devices[i].grabber) |
| 357 |
continue; |
| 358 |
v->device_primary = i; |
| 359 |
v->device_secondary = i; |
| 360 |
return 0; |
| 361 |
} |
| 362 |
return 1; |
| 363 |
} |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
static struct fbuf_t *grabber_read(struct video_device *dev, int fps) |
| 377 |
{ |
| 378 |
struct timeval now = ast_tvnow(); |
| 379 |
|
| 380 |
if (dev->grabber == NULL) |
| 381 |
return NULL; |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
if (ast_tvdiff_ms(now, dev->last_frame) < 1000/fps) |
| 388 |
return NULL; |
| 389 |
dev->last_frame = now; |
| 390 |
return dev->grabber->read(dev->grabber_data); |
| 391 |
} |
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
static void grabber_move(struct video_device *dev, int dx, int dy) |
| 398 |
{ |
| 399 |
if (dev->grabber && dev->grabber->move) { |
| 400 |
dev->grabber->move(dev->grabber_data, dx, dy); |
| 401 |
} |
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
static struct video_codec_desc *map_config_video_format(char *name) |
| 409 |
{ |
| 410 |
int i; |
| 411 |
|
| 412 |
for (i = 0; supported_codecs[i]; i++) |
| 413 |
if (!strcasecmp(name, supported_codecs[i]->name)) |
| 414 |
break; |
| 415 |
if (supported_codecs[i] == NULL) { |
| 416 |
ast_log(LOG_WARNING, "Cannot find codec for '%s'\n", name); |
| 417 |
i = 0; |
| 418 |
strcpy(name, supported_codecs[i]->name); |
| 419 |
} |
| 420 |
ast_log(LOG_WARNING, "Using codec '%s'\n", name); |
| 421 |
return supported_codecs[i]; |
| 422 |
} |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
static int video_out_uninit(struct video_desc *env) |
| 427 |
{ |
| 428 |
struct video_out_desc *v = &env->out; |
| 429 |
int i; |
| 430 |
|
| 431 |
|
| 432 |
if (v->enc_ctx) { |
| 433 |
AVCodecContext *enc_ctx = (AVCodecContext *)v->enc_ctx; |
| 434 |
avcodec_close(enc_ctx); |
| 435 |
av_free(enc_ctx); |
| 436 |
v->enc_ctx = NULL; |
| 437 |
} |
| 438 |
if (v->enc_in_frame) { |
| 439 |
av_free(v->enc_in_frame); |
| 440 |
v->enc_in_frame = NULL; |
| 441 |
} |
| 442 |
v->codec = NULL; |
| 443 |
|
| 444 |
fbuf_free(&env->enc_in); |
| 445 |
fbuf_free(&v->enc_out); |
| 446 |
|
| 447 |
for (i = 0; i < v->device_num; i++) { |
| 448 |
if (v->devices[i].grabber){ |
| 449 |
v->devices[i].grabber_data = |
| 450 |
v->devices[i].grabber->close(v->devices[i].grabber_data); |
| 451 |
v->devices[i].grabber = NULL; |
| 452 |
|
| 453 |
v->devices[i].dev_buf = NULL; |
| 454 |
} |
| 455 |
v->devices[i].status_index = 0; |
| 456 |
} |
| 457 |
v->picture_in_picture = 0; |
| 458 |
env->frame_freeze = 0; |
| 459 |
return -1; |
| 460 |
} |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
static int video_out_init(struct video_desc *env) |
| 470 |
{ |
| 471 |
int codec; |
| 472 |
int size; |
| 473 |
struct fbuf_t *enc_in; |
| 474 |
struct video_out_desc *v = &env->out; |
| 475 |
|
| 476 |
v->enc_ctx = NULL; |
| 477 |
v->codec = NULL; |
| 478 |
v->enc_in_frame = NULL; |
| 479 |
v->enc_out.data = NULL; |
| 480 |
|
| 481 |
codec = map_video_format(v->enc->format, CM_WR); |
| 482 |
v->codec = avcodec_find_encoder(codec); |
| 483 |
if (!v->codec) { |
| 484 |
ast_log(LOG_WARNING, "Cannot find the encoder for format %d\n", |
| 485 |
codec); |
| 486 |
return -1; |
| 487 |
} |
| 488 |
|
| 489 |
v->mtu = 1400; |
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
enc_in = &env->enc_in; |
| 495 |
enc_in->pix_fmt = PIX_FMT_YUV420P; |
| 496 |
enc_in->size = (enc_in->w * enc_in->h * 3)/2; |
| 497 |
enc_in->data = ast_calloc(1, enc_in->size); |
| 498 |
if (!enc_in->data) { |
| 499 |
ast_log(LOG_WARNING, "Cannot allocate encoder input buffer\n"); |
| 500 |
return video_out_uninit(env); |
| 501 |
} |
| 502 |
|
| 503 |
v->enc_in_frame = avcodec_alloc_frame(); |
| 504 |
if (!v->enc_in_frame) { |
| 505 |
ast_log(LOG_WARNING, "Unable to allocate the encoding video frame\n"); |
| 506 |
return video_out_uninit(env); |
| 507 |
} |
| 508 |
|
| 509 |
|
| 510 |
size = enc_in->w * enc_in->h; |
| 511 |
v->enc_in_frame->data[0] = enc_in->data; |
| 512 |
v->enc_in_frame->data[1] = v->enc_in_frame->data[0] + size; |
| 513 |
v->enc_in_frame->data[2] = v->enc_in_frame->data[1] + size/4; |
| 514 |
v->enc_in_frame->linesize[0] = enc_in->w; |
| 515 |
v->enc_in_frame->linesize[1] = enc_in->w/2; |
| 516 |
v->enc_in_frame->linesize[2] = enc_in->w/2; |
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
{ |
| 522 |
AVCodecContext *enc_ctx = avcodec_alloc_context(); |
| 523 |
v->enc_ctx = enc_ctx; |
| 524 |
enc_ctx->pix_fmt = enc_in->pix_fmt; |
| 525 |
enc_ctx->width = enc_in->w; |
| 526 |
enc_ctx->height = enc_in->h; |
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
enc_ctx->rtp_mode = 1; |
| 531 |
enc_ctx->rtp_payload_size = v->mtu / 2; |
| 532 |
enc_ctx->bit_rate = v->bitrate; |
| 533 |
enc_ctx->bit_rate_tolerance = enc_ctx->bit_rate/2; |
| 534 |
enc_ctx->qmin = v->qmin; |
| 535 |
enc_ctx->time_base = (AVRational){1, v->fps}; |
| 536 |
enc_ctx->gop_size = v->fps*5; |
| 537 |
|
| 538 |
v->enc->enc_init(v->enc_ctx); |
| 539 |
|
| 540 |
if (avcodec_open(enc_ctx, v->codec) < 0) { |
| 541 |
ast_log(LOG_WARNING, "Unable to initialize the encoder %d\n", codec); |
| 542 |
av_free(enc_ctx); |
| 543 |
v->enc_ctx = NULL; |
| 544 |
return video_out_uninit(env); |
| 545 |
} |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
v->enc_out.data = ast_calloc(1, enc_in->size); |
| 552 |
v->enc_out.size = enc_in->size; |
| 553 |
v->enc_out.used = 0; |
| 554 |
|
| 555 |
return 0; |
| 556 |
} |
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
void console_video_uninit(struct video_desc *env) |
| 569 |
{ |
| 570 |
int i, t = 100; |
| 571 |
if (env->stayopen == 0) { |
| 572 |
env->shutdown = 1; |
| 573 |
for (i=0; env->shutdown && i < 10; i++) { |
| 574 |
if (env->owner) |
| 575 |
ast_channel_unlock(env->owner); |
| 576 |
usleep(t); |
| 577 |
t = 1000000; |
| 578 |
if (env->owner) |
| 579 |
ast_channel_lock(env->owner); |
| 580 |
} |
| 581 |
env->vthread = NULL; |
| 582 |
} |
| 583 |
env->owner = NULL; |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
static AVPicture *fill_pict(struct fbuf_t *b, AVPicture *p) |
| 592 |
{ |
| 593 |
|
| 594 |
int l4 = b->w * b->h/4; |
| 595 |
int len = b->w; |
| 596 |
int luv = b->w/2; |
| 597 |
int sample_size = 1; |
| 598 |
|
| 599 |
memset(p, '\0', sizeof(*p)); |
| 600 |
switch (b->pix_fmt) { |
| 601 |
case PIX_FMT_RGB555: |
| 602 |
case PIX_FMT_RGB565: |
| 603 |
sample_size = 2; |
| 604 |
luv = 0; |
| 605 |
break; |
| 606 |
case PIX_FMT_RGBA32: |
| 607 |
sample_size = 4; |
| 608 |
luv = 0; |
| 609 |
break; |
| 610 |
case PIX_FMT_YUYV422: |
| 611 |
sample_size = 2; |
| 612 |
luv = 0; |
| 613 |
break; |
| 614 |
} |
| 615 |
len *= sample_size; |
| 616 |
|
| 617 |
p->data[0] = b->data; |
| 618 |
p->linesize[0] = len; |
| 619 |
|
| 620 |
p->data[1] = luv ? b->data + 4*l4 : b->data+len; |
| 621 |
p->data[2] = luv ? b->data + 5*l4 : b->data+len; |
| 622 |
p->linesize[1] = luv; |
| 623 |
p->linesize[2] = luv; |
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
p->data[0] += len*b->win_y + b->win_x*sample_size; |
| 628 |
if (luv) { |
| 629 |
p->data[1] += luv*(b->win_y/2) + (b->win_x/2) * sample_size; |
| 630 |
p->data[2] += luv*(b->win_y/2) + (b->win_x/2) * sample_size; |
| 631 |
} |
| 632 |
return p; |
| 633 |
} |
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
static void my_scale(struct fbuf_t *in, AVPicture *p_in, |
| 640 |
struct fbuf_t *out, AVPicture *p_out) |
| 641 |
{ |
| 642 |
AVPicture my_p_in, my_p_out; |
| 643 |
int eff_w=out->w, eff_h=out->h; |
| 644 |
|
| 645 |
if (p_in == NULL) |
| 646 |
p_in = fill_pict(in, &my_p_in); |
| 647 |
if (p_out == NULL) |
| 648 |
p_out = fill_pict(out, &my_p_out); |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
if (out->win_w) { |
| 654 |
eff_w=out->win_w; |
| 655 |
eff_h=out->win_h; |
| 656 |
} |
| 657 |
#ifdef OLD_FFMPEG |
| 658 |
|
| 659 |
img_convert(p_out, out->pix_fmt, |
| 660 |
p_in, in->pix_fmt, in->w, in->h); |
| 661 |
#else |
| 662 |
{ |
| 663 |
struct SwsContext *convert_ctx; |
| 664 |
|
| 665 |
convert_ctx = sws_getContext(in->w, in->h, in->pix_fmt, |
| 666 |
eff_w, eff_h, out->pix_fmt, |
| 667 |
SWS_BICUBIC, NULL, NULL, NULL); |
| 668 |
if (convert_ctx == NULL) { |
| 669 |
ast_log(LOG_ERROR, "FFMPEG::convert_cmodel : swscale context initialization failed\n"); |
| 670 |
return; |
| 671 |
} |
| 672 |
if (0) |
| 673 |
ast_log(LOG_WARNING, "in %d %dx%d out %d %dx%d\n", |
| 674 |
in->pix_fmt, in->w, in->h, out->pix_fmt, eff_w, eff_h); |
| 675 |
sws_scale(convert_ctx, |
| 676 |
p_in->data, p_in->linesize, |
| 677 |
in->w, in->h, |
| 678 |
p_out->data, p_out->linesize); |
| 679 |
|
| 680 |
sws_freeContext(convert_ctx); |
| 681 |
} |
| 682 |
#endif |
| 683 |
} |
| 684 |
|
| 685 |
struct video_desc *get_video_desc(struct ast_channel *c); |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
int console_write_video(struct ast_channel *chan, struct ast_frame *f); |
| 698 |
int console_write_video(struct ast_channel *chan, struct ast_frame *f) |
| 699 |
{ |
| 700 |
struct video_desc *env = get_video_desc(chan); |
| 701 |
struct video_dec_desc *v = env->in; |
| 702 |
|
| 703 |
if (!env->gui) |
| 704 |
return 0; |
| 705 |
if (v == NULL) |
| 706 |
env->in = v = dec_init(f->subclass & ~1); |
| 707 |
if (v == NULL) { |
| 708 |
|
| 709 |
ast_log(LOG_WARNING, "Cannot initialize input decoder\n"); |
| 710 |
return 0; |
| 711 |
} |
| 712 |
|
| 713 |
if (v->dec_in_cur == NULL) |
| 714 |
return 0; |
| 715 |
#if defined(DROP_PACKETS) && DROP_PACKETS > 0 |
| 716 |
|
| 717 |
if ((random() % 10000) <= 100*DROP_PACKETS) { |
| 718 |
ast_log(LOG_NOTICE, "Packet lost [%d]\n", f->seqno); |
| 719 |
return 0; |
| 720 |
} |
| 721 |
#endif |
| 722 |
if (v->discard) { |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
if (f->subclass & 0x01) { |
| 731 |
v->dec_in_cur->used = 0; |
| 732 |
v->dec_in_cur->ebit = 0; |
| 733 |
v->next_seq = f->seqno + 1; |
| 734 |
v->discard = 0; |
| 735 |
ast_log(LOG_WARNING, "out of discard mode, frame %d\n", f->seqno); |
| 736 |
} |
| 737 |
return 0; |
| 738 |
} |
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
if (v->next_seq != f->seqno) { |
| 746 |
ast_log(LOG_WARNING, "discarding frame out of order, %d %d\n", |
| 747 |
v->next_seq, f->seqno); |
| 748 |
v->discard = 1; |
| 749 |
return 0; |
| 750 |
} |
| 751 |
v->next_seq++; |
| 752 |
|
| 753 |
if (f->data.ptr == NULL || f->datalen < 2) { |
| 754 |
ast_log(LOG_WARNING, "empty video frame, discard\n"); |
| 755 |
return 0; |
| 756 |
} |
| 757 |
if (v->d_callbacks->dec_decap(v->dec_in_cur, f->data.ptr, f->datalen)) { |
| 758 |
ast_log(LOG_WARNING, "error in dec_decap, enter discard\n"); |
| 759 |
v->discard = 1; |
| 760 |
} |
| 761 |
if (f->subclass & 0x01) { |
| 762 |
|
| 763 |
struct fbuf_t *tmp = v->dec_in_cur; |
| 764 |
ast_mutex_lock(&env->dec_lock); |
| 765 |
if (++v->dec_in_cur == &v->dec_in[N_DEC_IN]) |
| 766 |
v->dec_in_cur = &v->dec_in[0]; |
| 767 |
if (v->dec_in_dpy == NULL) { |
| 768 |
v->dec_in_dpy = tmp; |
| 769 |
} else if (v->dec_in_dpy == v->dec_in_cur) { |
| 770 |
v->dec_in_cur = NULL; |
| 771 |
} |
| 772 |
ast_mutex_unlock(&env->dec_lock); |
| 773 |
} |
| 774 |
return 0; |
| 775 |
} |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
static struct ast_frame *get_video_frames(struct video_desc *env, struct ast_frame **tail) |
| 791 |
{ |
| 792 |
struct video_out_desc *v = &env->out; |
| 793 |
struct ast_frame *dummy; |
| 794 |
struct fbuf_t *loc_src_primary = NULL, *p_read; |
| 795 |
int i; |
| 796 |
|
| 797 |
if (!env->out.device_num) |
| 798 |
return NULL; |
| 799 |
|
| 800 |
|
| 801 |
for (i = 0; i < env->out.device_num; i++) { |
| 802 |
p_read = grabber_read(&env->out.devices[i], env->out.fps); |
| 803 |
|
| 804 |
if (p_read) |
| 805 |
env->out.devices[i].dev_buf = p_read; |
| 806 |
} |
| 807 |
|
| 808 |
loc_src_primary = env->out.devices[env->out.device_primary].dev_buf; |
| 809 |
|
| 810 |
|
| 811 |
if (loc_src_primary) { |
| 812 |
|
| 813 |
|
| 814 |
my_scale(loc_src_primary, NULL, &env->enc_in, NULL); |
| 815 |
} |
| 816 |
if (env->out.picture_in_picture) { |
| 817 |
struct fbuf_t *loc_src_secondary; |
| 818 |
|
| 819 |
loc_src_secondary = env->out.devices[env->out.device_secondary].dev_buf; |
| 820 |
if (loc_src_secondary) { |
| 821 |
env->enc_in.win_x = env->out.pip_x; |
| 822 |
env->enc_in.win_y = env->out.pip_y; |
| 823 |
env->enc_in.win_w = env->enc_in.w/3; |
| 824 |
env->enc_in.win_h = env->enc_in.h/3; |
| 825 |
|
| 826 |
|
| 827 |
my_scale(loc_src_secondary, NULL, &env->enc_in, NULL); |
| 828 |
|
| 829 |
env->enc_in.win_x = 0; |
| 830 |
env->enc_in.win_y = 0; |
| 831 |
env->enc_in.win_w = 0; |
| 832 |
env->enc_in.win_h = 0; |
| 833 |
} |
| 834 |
else { |
| 835 |
|
| 836 |
|
| 837 |
env->out.picture_in_picture = 0; |
| 838 |
} |
| 839 |
} |
| 840 |
show_frame(env, WIN_LOCAL); |
| 841 |
for (i = 0; i < env->out.device_num; i++) |
| 842 |
show_frame(env, i+WIN_SRC1); |
| 843 |
if (tail == NULL) |
| 844 |
tail = &dummy; |
| 845 |
*tail = NULL; |
| 846 |
|
| 847 |
if (!env->owner || !loc_src_primary || !v->sendvideo) |
| 848 |
return NULL; |
| 849 |
if (v->enc_out.data == NULL) { |
| 850 |
static volatile int a = 0; |
| 851 |
if (a++ < 2) |
| 852 |
ast_log(LOG_WARNING, "fail, no encoder output buffer\n"); |
| 853 |
return NULL; |
| 854 |
} |
| 855 |
v->enc->enc_run(v); |
| 856 |
return v->enc->enc_encap(&v->enc_out, v->mtu, tail); |
| 857 |
} |
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
static void *video_thread(void *arg) |
| 866 |
{ |
| 867 |
struct video_desc *env = arg; |
| 868 |
int count = 0; |
| 869 |
char save_display[128] = ""; |
| 870 |
int i; |
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
if (!ast_strlen_zero(env->sdl_videodriver)) { |
| 877 |
const char *s = getenv("DISPLAY"); |
| 878 |
setenv("SDL_VIDEODRIVER", env->sdl_videodriver, 1); |
| 879 |
if (s && !strcasecmp(env->sdl_videodriver, "aalib-console")) { |
| 880 |
ast_copy_string(save_display, s, sizeof(save_display)); |
| 881 |
unsetenv("DISPLAY"); |
| 882 |
} |
| 883 |
} |
| 884 |
sdl_setup(env); |
| 885 |
if (!ast_strlen_zero(save_display)) { |
| 886 |
setenv("DISPLAY", save_display, 1); |
| 887 |
} |
| 888 |
|
| 889 |
ast_mutex_init(&env->dec_lock); |
| 890 |
|
| 891 |
if (grabber_open(&env->out)) { |
| 892 |
ast_log(LOG_WARNING, "cannot open local video source\n"); |
| 893 |
} |
| 894 |
|
| 895 |
if (env->out.device_num) { |
| 896 |
env->out.devices[env->out.device_primary].status_index |= IS_PRIMARY | IS_SECONDARY; |
| 897 |
} |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
video_out_init(env); |
| 904 |
|
| 905 |
|
| 906 |
if (env->gui) { |
| 907 |
for (i = 0; i < env->out.device_num; i++) { |
| 908 |
print_message(env->gui->thumb_bd_array[i].board, |
| 909 |
src_msgs[env->out.devices[i].status_index]); |
| 910 |
} |
| 911 |
} |
| 912 |
|
| 913 |
for (;;) { |
| 914 |
struct timespec t = { 0, 50000000 }; |
| 915 |
struct ast_frame *p, *f; |
| 916 |
struct ast_channel *chan; |
| 917 |
int fd; |
| 918 |
char *caption = NULL, buf[160]; |
| 919 |
|
| 920 |
|
| 921 |
if (count++ % 10 == 0) { |
| 922 |
if (env->out.sendvideo && env->out.devices) { |
| 923 |
snprintf(buf, sizeof(buf), "%s %s %dx%d @@ %dfps %dkbps", |
| 924 |
env->out.devices[env->out.device_primary].name, env->codec_name, |
| 925 |
env->enc_in.w, env->enc_in.h, |
| 926 |
env->out.fps, env->out.bitrate / 1000); |
| 927 |
} else { |
| 928 |
sprintf(buf, "hold"); |
| 929 |
} |
| 930 |
caption = buf; |
| 931 |
} |
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
if (env->gui) |
| 937 |
eventhandler(env, caption); |
| 938 |
|
| 939 |
|
| 940 |
nanosleep(&t, NULL); |
| 941 |
|
| 942 |
if (env->in) { |
| 943 |
struct video_dec_desc *v = env->in; |
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
while (v->dec_in_dpy) { |
| 950 |
struct fbuf_t *tmp = v->dec_in_dpy; |
| 951 |
|
| 952 |
|
| 953 |
if (v->d_callbacks->dec_run(v, tmp) && !env->frame_freeze) |
| 954 |
show_frame(env, WIN_REMOTE); |
| 955 |
tmp->used = 0; |
| 956 |
tmp->ebit = 0; |
| 957 |
ast_mutex_lock(&env->dec_lock); |
| 958 |
if (++v->dec_in_dpy == &v->dec_in[N_DEC_IN]) |
| 959 |
v->dec_in_dpy = &v->dec_in[0]; |
| 960 |
|
| 961 |
if (v->dec_in_cur == NULL) |
| 962 |
v->dec_in_cur = tmp; |
| 963 |
else if (v->dec_in_dpy == v->dec_in_cur) |
| 964 |
v->dec_in_dpy = NULL; |
| 965 |
ast_mutex_unlock(&env->dec_lock); |
| 966 |
} |
| 967 |
} |
| 968 |
|
| 969 |
if (env->shutdown) |
| 970 |
break; |
| 971 |
f = get_video_frames(env, &p); |
| 972 |
if (!f) |
| 973 |
continue; |
| 974 |
chan = env->owner; |
| 975 |
if (chan == NULL) { |
| 976 |
|
| 977 |
while (f) { |
| 978 |
struct ast_frame *g = AST_LIST_NEXT(f, frame_list); |
| 979 |
ast_frfree(f); |
| 980 |
f = g; |
| 981 |
} |
| 982 |
continue; |
| 983 |
} |
| 984 |
ast_channel_lock(chan); |
| 985 |
|
| 986 |
|
| 987 |
if (ast_channel_readq(chan).first == NULL) { |
| 988 |
ast_channel_readq(chan).first = f; |
| 989 |
} else { |
| 990 |
ast_channel_readq(chan).last->frame_list.next = f; |
| 991 |
} |
| 992 |
ast_channel_readq(chan).last = p; |
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
if (ast_channel_alertable(chan)) { |
| 998 |
for (p = f; p; p = AST_LIST_NEXT(p, frame_list)) { |
| 999 |
if (ast_channel_alert(chan)) { |
| 1000 |
ast_log(LOG_WARNING, "Unable to write to alert pipe on %s, frametype/subclass %d/%d: %s!\n", |
| 1001 |
ast_channel_name(chan), f->frametype, f->subclass, strerror(errno)); |
| 1002 |
} |
| 1003 |
} |
| 1004 |
ast_channel_unlock(chan); |
| 1005 |
} |
| 1006 |
|
| 1007 |
|
| 1008 |
env->in = dec_uninit(env->in); |
| 1009 |
video_out_uninit(env); |
| 1010 |
|
| 1011 |
if (env->gui) |
| 1012 |
env->gui = cleanup_sdl(env->gui, env->out.device_num); |
| 1013 |
ast_mutex_destroy(&env->dec_lock); |
| 1014 |
env->shutdown = 0; |
| 1015 |
return NULL; |
| 1016 |
} |
| 1017 |
|
| 1018 |
static void copy_geometry(struct fbuf_t *src, struct fbuf_t *dst) |
| 1019 |
{ |
| 1020 |
if (dst->w == 0) |
| 1021 |
dst->w = src->w; |
| 1022 |
if (dst->h == 0) |
| 1023 |
dst->h = src->h; |
| 1024 |
} |
| 1025 |
|
| 1026 |
|
| 1027 |
|
| 1028 |
|
| 1029 |
|
| 1030 |
static void init_env(struct video_desc *env) |
| 1031 |
{ |
| 1032 |
struct fbuf_t *c = &(env->out.loc_src_geometry); |
| 1033 |
struct fbuf_t *ei = &(env->enc_in); |
| 1034 |
struct fbuf_t *ld = &(env->loc_dpy); |
| 1035 |
struct fbuf_t *rd = &(env->rem_dpy); |
| 1036 |
int i; |
| 1037 |
|
| 1038 |
c->pix_fmt = PIX_FMT_YUV420P; |
| 1039 |
ei->pix_fmt = PIX_FMT_YUV420P; |
| 1040 |
if (ei->w == 0 || ei->h == 0) { |
| 1041 |
ei->w = 352; |
| 1042 |
ei->h = 288; |
| 1043 |
} |
| 1044 |
ld->pix_fmt = rd->pix_fmt = PIX_FMT_YUV420P; |
| 1045 |
|
| 1046 |
copy_geometry(ei, c); |
| 1047 |
copy_geometry(ei, rd); |
| 1048 |
copy_geometry(rd, ld); |
| 1049 |
|
| 1050 |
|
| 1051 |
for (i = 0; i < env->out.device_num; i++) { |
| 1052 |
env->src_dpy[i].pix_fmt = PIX_FMT_YUV420P; |
| 1053 |
env->src_dpy[i].w = SRC_WIN_W; |
| 1054 |
env->src_dpy[i].h = SRC_WIN_H; |
| 1055 |
} |
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
env->out.pip_x = ei->w - ei->w/3; |
| 1060 |
env->out.pip_y = ei->h - ei->h/3; |
| 1061 |
} |
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
void console_video_start(struct video_desc *env, struct ast_channel *owner) |
| 1071 |
{ |
| 1072 |
ast_log(LOG_WARNING, "env %p chan %p\n", env, owner); |
| 1073 |
if (env == NULL) |
| 1074 |
return; |
| 1075 |
env->owner = owner; |
| 1076 |
if (env->vthread) |
| 1077 |
return; |
| 1078 |
init_env(env); |
| 1079 |
env->out.enc = map_config_video_format(env->codec_name); |
| 1080 |
|
| 1081 |
ast_log(LOG_WARNING, "start video out %s %dx%d\n", |
| 1082 |
env->codec_name, env->enc_in.w, env->enc_in.h); |
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
avcodec_init(); |
| 1089 |
avcodec_register_all(); |
| 1090 |
av_log_set_level(AV_LOG_ERROR); |
| 1091 |
|
| 1092 |
if (env->out.fps == 0) { |
| 1093 |
env->out.fps = 15; |
| 1094 |
ast_log(LOG_WARNING, "fps unset, forcing to %d\n", env->out.fps); |
| 1095 |
} |
| 1096 |
if (env->out.bitrate == 0) { |
| 1097 |
env->out.bitrate = 65000; |
| 1098 |
ast_log(LOG_WARNING, "bitrate unset, forcing to %d\n", env->out.bitrate); |
| 1099 |
} |
| 1100 |
|
| 1101 |
ast_pthread_create_detached_background(&env->vthread, |
| 1102 |
NULL, video_thread, env); |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
static int video_geom(struct fbuf_t *b, const char *s) |
| 1112 |
{ |
| 1113 |
int w = 0, h = 0; |
| 1114 |
|
| 1115 |
static struct { |
| 1116 |
const char *s; int w; int h; |
| 1117 |
} *fp, formats[] = { |
| 1118 |
{"16cif", 1408, 1152 }, |
| 1119 |
{"xga", 1024, 768 }, |
| 1120 |
{"4cif", 704, 576 }, |
| 1121 |
{"vga", 640, 480 }, |
| 1122 |
{"cif", 352, 288 }, |
| 1123 |
{"qvga", 320, 240 }, |
| 1124 |
{"qcif", 176, 144 }, |
| 1125 |
{"sqcif", 128, 96 }, |
| 1126 |
{NULL, 0, 0 }, |
| 1127 |
}; |
| 1128 |
if (*s == '<' || *s == '>') |
| 1129 |
sscanf(s+1,"%dx%d", &w, &h); |
| 1130 |
for (fp = formats; fp->s; fp++) { |
| 1131 |
if (*s == '>') { |
| 1132 |
if (fp->w <= w) { |
| 1133 |
if (fp > formats) |
| 1134 |
fp--; |
| 1135 |
break; |
| 1136 |
} |
| 1137 |
} else if (*s == '<') { |
| 1138 |
if (fp->w < w) |
| 1139 |
break; |
| 1140 |
} else if (!strcasecmp(s, fp->s)) { |
| 1141 |
break; |
| 1142 |
} |
| 1143 |
} |
| 1144 |
if (*s == '<' && fp->s == NULL) |
| 1145 |
fp--; |
| 1146 |
if (fp->s) { |
| 1147 |
b->w = fp->w; |
| 1148 |
b->h = fp->h; |
| 1149 |
} else if (sscanf(s, "%dx%d", &b->w, &b->h) != 2) { |
| 1150 |
ast_log(LOG_WARNING, "Invalid video_size %s, using 352x288\n", s); |
| 1151 |
b->w = 352; |
| 1152 |
b->h = 288; |
| 1153 |
} |
| 1154 |
return 0; |
| 1155 |
} |
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
static int device_table_fill(struct video_device *devices, int *device_num_p, const char *s) |
| 1174 |
{ |
| 1175 |
int i; |
| 1176 |
struct video_device *p; |
| 1177 |
|
| 1178 |
|
| 1179 |
if (*device_num_p >= 9) |
| 1180 |
return 0; |
| 1181 |
|
| 1182 |
for (i = 0; i < *device_num_p; i++) { |
| 1183 |
if (!strcmp(devices[i].name, s)) |
| 1184 |
return 0; |
| 1185 |
} |
| 1186 |
|
| 1187 |
p = &devices[*device_num_p]; |
| 1188 |
|
| 1189 |
|
| 1190 |
p->name = ast_strdup(s); |
| 1191 |
|
| 1192 |
p->grabber = NULL; |
| 1193 |
p->grabber_data = NULL; |
| 1194 |
p->dev_buf = NULL; |
| 1195 |
p->last_frame = ast_tvnow(); |
| 1196 |
p->status_index = 0; |
| 1197 |
(*device_num_p)++; |
| 1198 |
return 0; |
| 1199 |
} |
| 1200 |
|
| 1201 |
|
| 1202 |
int console_video_cli(struct video_desc *env, const char *var, int fd) |
| 1203 |
{ |
| 1204 |
if (env == NULL) |
| 1205 |
return 1; |
| 1206 |
|
| 1207 |
if (!strcasecmp(var, "videodevice")) { |
| 1208 |
ast_cli(fd, "videodevice is [%s]\n", env->out.devices[env->out.device_primary].name); |
| 1209 |
} else if (!strcasecmp(var, "videocodec")) { |
| 1210 |
ast_cli(fd, "videocodec is [%s]\n", env->codec_name); |
| 1211 |
} else if (!strcasecmp(var, "sendvideo")) { |
| 1212 |
ast_cli(fd, "sendvideo is [%s]\n", env->out.sendvideo ? "on" : "off"); |
| 1213 |
} else if (!strcasecmp(var, "video_size")) { |
| 1214 |
int in_w = 0, in_h = 0; |
| 1215 |
if (env->in) { |
| 1216 |
in_w = env->in->dec_out.w; |
| 1217 |
in_h = env->in->dec_out.h; |
| 1218 |
} |
| 1219 |
ast_cli(fd, "sizes: video %dx%d camera %dx%d local %dx%d remote %dx%d in %dx%d\n", |
| 1220 |
env->enc_in.w, env->enc_in.h, |
| 1221 |
env->out.loc_src_geometry.w, env->out.loc_src_geometry.h, |
| 1222 |
env->loc_dpy.w, env->loc_dpy.h, |
| 1223 |
env->rem_dpy.w, env->rem_dpy.h, |
| 1224 |
in_w, in_h); |
| 1225 |
} else if (!strcasecmp(var, "bitrate")) { |
| 1226 |
ast_cli(fd, "bitrate is [%d]\n", env->out.bitrate); |
| 1227 |
} else if (!strcasecmp(var, "qmin")) { |
| 1228 |
ast_cli(fd, "qmin is [%d]\n", env->out.qmin); |
| 1229 |
} else if (!strcasecmp(var, "fps")) { |
| 1230 |
ast_cli(fd, "fps is [%d]\n", env->out.fps); |
| 1231 |
} else if (!strcasecmp(var, "startgui")) { |
| 1232 |
env->stayopen = 1; |
| 1233 |
console_video_start(env, NULL); |
| 1234 |
} else if (!strcasecmp(var, "stopgui") && env->stayopen != 0) { |
| 1235 |
env->stayopen = 0; |
| 1236 |
if (env->gui && env->owner) |
| 1237 |
ast_cli_command(-1, "console hangup"); |
| 1238 |
else |
| 1239 |
console_video_uninit(env); |
| 1240 |
} else { |
| 1241 |
return 1; |
| 1242 |
} |
| 1243 |
return 0; |
| 1244 |
} |
| 1245 |
|
| 1246 |
|
| 1247 |
int console_video_config(struct video_desc **penv, |
| 1248 |
const char *var, const char *val) |
| 1249 |
{ |
| 1250 |
struct video_desc *env; |
| 1251 |
|
| 1252 |
if (penv == NULL) { |
| 1253 |
ast_log(LOG_WARNING, "bad argument penv=NULL\n"); |
| 1254 |
return 1; |
| 1255 |
} |
| 1256 |
|
| 1257 |
env = *penv; |
| 1258 |
if (env == NULL) { |
| 1259 |
env = *penv = ast_calloc(1, sizeof(struct video_desc)); |
| 1260 |
if (env == NULL) { |
| 1261 |
ast_log(LOG_WARNING, "fail to allocate video_desc\n"); |
| 1262 |
return 1; |
| 1263 |
|
| 1264 |
} |
| 1265 |
|
| 1266 |
env->out.device_primary = 0; |
| 1267 |
env->out.device_secondary = 0; |
| 1268 |
env->out.fps = 5; |
| 1269 |
env->out.bitrate = 65000; |
| 1270 |
env->out.sendvideo = 1; |
| 1271 |
env->out.qmin = 3; |
| 1272 |
env->out.device_num = 0; |
| 1273 |
} |
| 1274 |
CV_START(var, val); |
| 1275 |
CV_F("videodevice", device_table_fill(env->out.devices, &env->out.device_num, val)); |
| 1276 |
CV_BOOL("sendvideo", env->out.sendvideo); |
| 1277 |
CV_F("video_size", video_geom(&env->enc_in, val)); |
| 1278 |
CV_F("camera_size", video_geom(&env->out.loc_src_geometry, val)); |
| 1279 |
CV_F("local_size", video_geom(&env->loc_dpy, val)); |
| 1280 |
CV_F("remote_size", video_geom(&env->rem_dpy, val)); |
| 1281 |
CV_STR("keypad", env->keypad_file); |
| 1282 |
CV_F("region", keypad_cfg_read(env->gui, val)); |
| 1283 |
CV_UINT("startgui", env->stayopen); |
| 1284 |
CV_STR("keypad_font", env->keypad_font); |
| 1285 |
CV_STR("sdl_videodriver", env->sdl_videodriver); |
| 1286 |
CV_UINT("fps", env->out.fps); |
| 1287 |
CV_UINT("bitrate", env->out.bitrate); |
| 1288 |
CV_UINT("qmin", env->out.qmin); |
| 1289 |
CV_STR("videocodec", env->codec_name); |
| 1290 |
return 1; |
| 1291 |
|
| 1292 |
CV_END; |
| 1293 |
return 0; |
| 1294 |
} |
| 1295 |
|
| 1296 |
#endif |