comparison pcm-br/record_ctrl.c @ 35:499d065ee591

new program itt-pcm-br (PCM bridge)
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Aug 2024 05:00:38 +0000
parents pcm/record_ctrl.c@631f2db08538
children
comparison
equal deleted inserted replaced
34:f0b026615f3b 35:499d065ee591
1 /*
2 * Here we implement stdin commands that control recording of E1 timeslot
3 * read stream.
4 */
5
6 #include <stdint.h>
7 #include <stdbool.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10
11 #include <osmocom/core/select.h>
12
13 #include "globals.h"
14
15 void cmd_record_a_start(int argc, char **argv)
16 {
17 if (argc != 2) {
18 printf("error: record-a command needs 1 argument\n");
19 return;
20 }
21 if (rec_file_a) {
22 printf("error: recording of ts A already in progress\n");
23 return;
24 }
25 rec_file_a = fopen(argv[1], "w");
26 if (!rec_file_a)
27 perror(argv[1]);
28 }
29
30 void cmd_record_a_stop(int argc, char **argv)
31 {
32 if (!rec_file_a) {
33 printf("error: no recording of ts A in progress\n");
34 return;
35 }
36 fclose(rec_file_a);
37 rec_file_a = NULL;
38 }
39
40 void cmd_record_b_start(int argc, char **argv)
41 {
42 if (argc != 2) {
43 printf("error: record-b command needs 1 argument\n");
44 return;
45 }
46 if (rec_file_b) {
47 printf("error: recording of ts B already in progress\n");
48 return;
49 }
50 rec_file_b = fopen(argv[1], "w");
51 if (!rec_file_b)
52 perror(argv[1]);
53 }
54
55 void cmd_record_b_stop(int argc, char **argv)
56 {
57 if (!rec_file_b) {
58 printf("error: no recording of ts B in progress\n");
59 return;
60 }
61 fclose(rec_file_b);
62 rec_file_b = NULL;
63 }