aboutsummaryrefslogtreecommitdiffstats
path: root/dvb-t/sk-BanskaBystrica
blob: 1f8b0de6ac0b6554275de646e4d9c68041d501d9 (plain)
1
2
3
4
5
6
7
8
9
# DVB-T Banska Bystrica (Banska Bystrica, Slovak Republic)
# Created from http://www.dvbt.towercom.sk/odbornici.php
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy

# 2.st multiplex (commercial) - on channel 51
T 714000000 8MHz 2/3 NONE QAM64 8k 1/4 NONE

# 3.st multiplex (public) - on channel 33
T 570000000 8MHz 2/3 NONE QAM64 8k 1/4 NONE
9' href='#n199'>199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
/* 
 * test_av.c - Test for audio and video MPEG decoder API.
 *
 * Copyright (C) 2000 - 2002 convergence GmbH
 * Ralph Metzler <rjkm@convergence.de>
 * Marcus Metzler <mocm@convergence.de>
 *
 * This program 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 program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>

#include <linux/dvb/audio.h>
#include <linux/dvb/video.h>

int audioStop(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, AUDIO_STOP) == -1)
		perror("AUDIO_STOP");
	return 0;
}

int audioPlay(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, AUDIO_PLAY)  == -1)
		perror("AUDIO_PLAY");
	return 0;
}

int audioPause(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, AUDIO_PAUSE) == -1)
		perror("AUDIO_PAUSE");
	return 0;
}


int audioContinue(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, AUDIO_CONTINUE) == -1)
		perror("AUDIO_CONTINUE");
	return 0;
}

int audioSelectSource(int fd, char *arg)
{
	int source;
	if (!arg)
		return -1;
	source = atoi(arg);
	if (ioctl(fd, AUDIO_SELECT_SOURCE, source) == -1)
		perror("AUDIO_SELECT_SOURCE");
	return 0;
}

int audioSetMute(int fd, char *arg)
{
	int mute;
	if (!arg)
		return -1;
	mute = atoi(arg);
	if (ioctl(fd, AUDIO_SET_MUTE, mute) == -1)
		perror("AUDIO_SET_MUTE");
	return 0;
}

int audioSetAVSync(int fd, char *arg)
{
	int sync;
	if (!arg)
		return -1;
	sync = atoi(arg);
	if (ioctl(fd, AUDIO_SET_AV_SYNC, sync) == -1)
		perror("AUDIO_SET_AV_SYNC");
	return 0;
}

int audioSetBypassMode(int fd, char *arg)
{
	int byp;
	if (!arg)
		return -1;
	byp = atoi(arg);
	if (ioctl(fd, AUDIO_SET_BYPASS_MODE, byp) == -1)
		perror("AUDIO_SET_BYPASS_MODE");
	return 0;
}

int audioChannelSelect(int fd, char *arg)
{
	int chan;
	if (!arg)
		return -1;
	chan = atoi(arg);
	if (ioctl(fd, AUDIO_CHANNEL_SELECT, chan) == -1)
		perror("AUDIO_CHANNEL_SELECT");
	return 0;
}

int audioGetStatus(int fd, char *arg)
{
	struct audio_status stat;

	if (arg)
		return -1;
	if (ioctl(fd, AUDIO_GET_STATUS, &stat) == -1) {
		perror("AUDIO_GET_STATUS");
		return 0;
	}

	printf("Audio Status:\n");
	printf("  Sync State          : %s\n",
	       (stat.AV_sync_state ? "SYNC" : "NO SYNC"));
	printf("  Mute State          : %s\n",
	       (stat.mute_state ? "muted" : "not muted"));
	printf("  Play State          : ");
	switch ((int)stat.play_state){
	case AUDIO_STOPPED:
		printf("STOPPED (%d)\n",stat.play_state);
		break;
	case AUDIO_PLAYING:
		printf("PLAYING (%d)\n",stat.play_state);
		break;
	case AUDIO_PAUSED:
		printf("PAUSED (%d)\n",stat.play_state);
		break;
	default:
		printf("unknown (%d)\n",stat.play_state);
		break;
	}

	printf("  Stream Source       : ");
	switch((int)stat.stream_source){
	case AUDIO_SOURCE_DEMUX:
		printf("DEMUX (%d)\n",stat.stream_source);
		break;
	case AUDIO_SOURCE_MEMORY:
		printf("MEMORY (%d)\n",stat.stream_source);
		break;
	default:
		printf("unknown (%d)\n",stat.stream_source);
		break;
	}

	printf("  Channel Select      : ");
	switch((int)stat.channel_select){
	case AUDIO_STEREO:
		printf("Stereo (%d)\n",stat.channel_select);
		break;
	case AUDIO_MONO_LEFT:
		printf("Mono left(%d)\n",stat.channel_select);
		break;
	case AUDIO_MONO_RIGHT:
		printf("Mono right (%d)\n",stat.channel_select);
		break;
	default:
		printf("unknown (%d)\n",stat.channel_select);
		break;
	}
	printf("  Bypass Mode         : %s\n",
	       (stat.bypass_mode ? "ON" : "OFF"));

	return 0;

}

int videoStop(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_STOP) == -1)
		perror("VIDEO_STOP");
	return 0;
}

int videoPlay(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_PLAY) == -1)
		perror("VIDEO_PLAY");
	return 0;
}


int videoFreeze(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_FREEZE) == -1)
		perror("VIDEO_FREEZE");
	return 0;
}


int videoContinue(int fd, char *arg)
{
	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_CONTINUE) == -1)
		perror("VIDEO_CONTINUE");
	return 0;
}

int videoFormat(int fd, char *arg)
{
	int format;
	if (!arg)
		return -1;
	format = atoi(arg);
	if (ioctl(fd, VIDEO_SET_FORMAT, format) == -1)
		perror("VIDEO_SET_FORMAT");
	return 0;
}

int videoDisplayFormat(int fd, char *arg)
{
	int format;
	if (!arg)
		return -1;
	format = atoi(arg);
	if (ioctl(fd, VIDEO_SET_DISPLAY_FORMAT, format) == -1)
		perror("VIDEO_SET_DISPLAY_FORMAT");
	return 0;
}

int videoSelectSource(int fd, char *arg)
{
	int source;
	if (!arg)
		return -1;
	source = atoi(arg);
	if (ioctl(fd, VIDEO_SELECT_SOURCE, source) == -1)
		perror("VIDEO_SELECT_SOURCE");
	return 0;
}



int videoSetBlank(int fd, char *arg)
{
	int blank;
	if (!arg)
		return -1;
	blank = atoi(arg);
	if (ioctl(fd, VIDEO_SET_BLANK, blank) == -1)
		perror("VIDEO_SET_BLANK");
	return 0;
}

int videoFastForward(int fd, char *arg)
{
	int frames;
	if (!arg)
		return -1;
	frames = atoi(arg);
	if (ioctl(fd, VIDEO_FAST_FORWARD, frames) == -1)
		perror("VIDEO_FAST_FORWARD");
	return 0;
}

int videoSlowMotion(int fd, char *arg)
{
	int frames;
	if (!arg)
		return -1;
	frames = atoi(arg);
	if (ioctl(fd, VIDEO_SLOWMOTION, frames) == -1)
		perror("VIDEO_SLOWMOTION");
	return 0;
}

int videoGetStatus(int fd, char *arg)
{
	struct video_status stat;

	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_GET_STATUS, &stat) == -1){
		perror("VIDEO_GET_STATUS");
		return 0;
	}

	printf("Video Status:\n");
	printf("  Blank State          : %s\n",
	       (stat.video_blank ? "BLANK" : "STILL"));
	printf("  Play State           : ");
	switch ((int)stat.play_state){
	case VIDEO_STOPPED:
		printf("STOPPED (%d)\n",stat.play_state);
		break;
	case VIDEO_PLAYING:
		printf("PLAYING (%d)\n",stat.play_state);
		break;
	case VIDEO_FREEZED:
		printf("FREEZED (%d)\n",stat.play_state);
		break;
	default:
		printf("unknown (%d)\n",stat.play_state);
		break;
	}

	printf("  Stream Source        : ");
	switch((int)stat.stream_source){
	case VIDEO_SOURCE_DEMUX:
		printf("DEMUX (%d)\n",stat.stream_source);
		break;
	case VIDEO_SOURCE_MEMORY:
		printf("MEMORY (%d)\n",stat.stream_source);
		break;
	default:
		printf("unknown (%d)\n",stat.stream_source);
		break;
	}

	printf("  Format (Aspect Ratio): ");
	switch((int)stat.video_format){
	case VIDEO_FORMAT_4_3:
		printf("4:3 (%d)\n",stat.video_format);
		break;
	case VIDEO_FORMAT_16_9:
		printf("16:9 (%d)\n",stat.video_format);
		break;
	case VIDEO_FORMAT_221_1:
		printf("2.21:1 (%d)\n",stat.video_format);
		break;
	default:
		printf("unknown (%d)\n",stat.video_format);
		break;
	}

	printf("  Display Format       : ");
	switch((int)stat.display_format){
	case VIDEO_PAN_SCAN:
		printf("Pan&Scan (%d)\n",stat.display_format);
		break;
	case VIDEO_LETTER_BOX:
		printf("Letterbox (%d)\n",stat.display_format);
		break;
	case VIDEO_CENTER_CUT_OUT:
		printf("Center cutout (%d)\n",stat.display_format);
		break;
	default:
		printf("unknown (%d)\n",stat.display_format);
		break;
	}
	return 0;
}

int videoGetSize(int fd, char *arg)
{
	video_size_t size;

	if (arg)
		return -1;
	if (ioctl(fd, VIDEO_GET_SIZE, &size) == -1){
		perror("VIDEO_GET_SIZE");
		return 0;
	}

	printf("Video Size: %ux%u ", size.w, size.h);
	switch (size.aspect_ratio) {
	case VIDEO_FORMAT_4_3:
		printf("4:3 (%d)\n", size.aspect_ratio);
		break;
	case VIDEO_FORMAT_16_9:
		printf("16:9 (%d)\n", size.aspect_ratio);
		break;
	case VIDEO_FORMAT_221_1:
		printf("2.21:1 (%d)\n", size.aspect_ratio);
		break;
	default:
		printf("unknown aspect ratio (%d)\n", size.aspect_ratio);
		break;
	}
	return 0;
}

int videoStillPicture(int fd, char *arg)
{
	int sifd;
	struct stat st;
	struct video_still_picture sp;

	if (!arg)
		return -1;
	sifd = open(arg, O_RDONLY);
	if (sifd == -1) {
		perror("open stillimage file");
		printf("(%s)\n", arg);
		return 0;
	}
	fstat(sifd, &st);

	sp.iFrame = (char *) malloc(st.st_size);
	sp.size = st.st_size;
	printf("I-frame size: %d\n", sp.size);

	if(!sp.iFrame) {
		printf("No memory for I-Frame\n");
		return 0;
	}

	printf("read: %d bytes\n",read(sifd,sp.iFrame,sp.size));
	if (ioctl(fd, VIDEO_STILLPICTURE, &sp) == -1)
		perror("VIDEO_STILLPICTURE");
	return 0;
}

typedef int (* cmd_func_t)(int fd, char *args);
typedef struct {
	char *cmd;
	char *param_help;
	cmd_func_t cmd_func;
} cmd_t;
cmd_t audio_cmds[] =
{
	{ "stop", "", audioStop },
	{ "play", "", audioPlay },
	{ "pause", "", audioPause },
	{ "continue", "", audioContinue },
	{ "source", "n: 0 demux, 1 memory", audioSelectSource },
	{ "mute", "n: 0 unmute, 1 mute", audioSetMute },
	{ "avsync", "n: 0 unsync, 1 sync", audioSetAVSync },
	{ "bypass", "n: 0 normal, 1 bypass", audioSetBypassMode },
	{ "channel", "n: 0 stereo, 1 left, 2 right", audioChannelSelect },
	{ "status", "", audioGetStatus },
	{ NULL, NULL, NULL }
};
cmd_t video_cmds[] =
{
	{ "stop", "", videoStop },
	{ "play", "", videoPlay },
	{ "freeze", "", videoFreeze },
	{ "continue", "", videoContinue },
	{ "source", "n: 0 demux, 1 memory", videoSelectSource },
	{ "blank", "n: 0 normal, 1 blank", videoSetBlank },
	{ "ff", "n: number of frames", videoFastForward },
	{ "slow", "n: number of frames", videoSlowMotion },
	{ "status", "", videoGetStatus },
	{ "size", "", videoGetSize },
	{ "stillpic", "filename", videoStillPicture},
	{ "format", "n: 0 4:3, 1 16:9", videoFormat},
	{ "dispformat", "n: 0 pan&scan, 1 letter box, 2 center cut out", videoDisplayFormat},
	{ NULL, NULL, NULL }
};
int usage(void)
{
	int i;
	printf ("commands begin with a for audio and v for video:\n\n"
	        "q : quit\n");
	for (i=0; audio_cmds[i].cmd; i++)
		printf("a %s %s\n", audio_cmds[i].cmd, audio_cmds[i].param_help);
	for (i=0; video_cmds[i].cmd; i++)
		printf("v %s %s\n", video_cmds[i].cmd, video_cmds[i].param_help);
	printf("\n");
	return 0;
}

int syntax_error(void)
{
	fprintf(stderr, "syntax error\n");
	return 0;
}

int process_kbd_input(int vfd, int afd)
{
	char buf[256], *cmd;
	int i;

	if (!fgets(buf, sizeof(buf), stdin))
		return -1;
	cmd = strtok(buf, " \n\t");
	if (!cmd) {
		printf("enter command or h + enter for help\n");
		return 0;
	}
	if (cmd[0] == 'q' || !strcmp(cmd, "quit"))
		return -1;
	if (cmd[0] == 'h' || !strcmp(cmd, "help"))
		return usage();
	if (cmd[0] == 'a' || !strcmp(cmd, "audio")) {
		cmd = strtok(NULL, " \n\t");
		if (!cmd)
			return syntax_error();
		for (i=0; audio_cmds[i].cmd; i++) {
			if (!strcmp(cmd, audio_cmds[i].cmd)) {
				cmd = strtok(NULL, " \n\t");
				printf("calling '%s', arg '%s'\n", audio_cmds[i].cmd, cmd);
				if (audio_cmds[i].cmd_func(afd, cmd))
					syntax_error();
				return 0;
			}
		}
		return syntax_error();
	} else if (buf[0] == 'v') {
		cmd = strtok(NULL, " \n\t");
		if (!cmd)
			return usage();
		for (i=0; video_cmds[i].cmd; i++) {
			if (!strcmp(cmd, video_cmds[i].cmd)) {
				cmd = strtok(NULL, " \n\t");
				printf("calling '%s', arg '%s'\n", video_cmds[i].cmd, cmd);
				if (video_cmds[i].cmd_func(vfd, cmd))
					syntax_error();
				return 0;
			}
		}
		return syntax_error();
	} else
		return syntax_error();
	return 0;
}

int main(void)
{
	int vfd, afd;
	char *videodev = "/dev/dvb/adapter0/video0";
	char *audiodev = "/dev/dvb/adapter0/audio0";

	if (getenv("VIDEO"))
		videodev = getenv("VIDEO");
	if (getenv("AUDIO"))
		videodev = getenv("AUDIO");

	printf("using video device '%s'\n", videodev);
	printf("using audio device '%s'\n", audiodev);
	printf("enter command or h + enter for help\n");

	if((vfd = open(videodev, O_RDWR | O_NONBLOCK)) < 0) {
		perror("open video device");
		return 1;
	}
	if((afd = open(audiodev, O_RDWR | O_NONBLOCK)) < 0) {
		perror("open audio device");
		return 1;
	}

	while (process_kbd_input(vfd, afd) == 0)
		;

	close(vfd);
	close(afd);
	return 0;
}