4
Fork 0
This commit is contained in:
Artem Prilutskiy 2017-05-26 13:47:42 +03:00
parent 14fe868ded
commit 322f562fe8
2 changed files with 15 additions and 11 deletions

View file

@ -54,7 +54,7 @@ int main(int argc, char* argv[])
{ "client-number", required_argument, NULL, 'c' }, { "client-number", required_argument, NULL, 'c' },
{ "server-address", required_argument, NULL, 's' }, { "server-address", required_argument, NULL, 's' },
{ "server-port", required_argument, NULL, 'p' }, { "server-port", required_argument, NULL, 'p' },
{ "source-id", required_argument, NULL, 'i' }, { "source-id", required_argument, NULL, 'u' },
{ "group-id", required_argument, NULL, 'g' }, { "group-id", required_argument, NULL, 'g' },
{ "talker-alias", required_argument, NULL, 't' }, { "talker-alias", required_argument, NULL, 't' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
@ -64,7 +64,7 @@ int main(int argc, char* argv[])
int control = 0; int control = 0;
int selection = 0; int selection = 0;
while ((selection = getopt_long(argc, argv, "w:c:s:p:i:g:t:", options, NULL)) != EOF) while ((selection = getopt_long(argc, argv, "w:c:s:p:u:g:t:", options, NULL)) != EOF)
switch (selection) switch (selection)
{ {
case 'w': case 'w':
@ -86,7 +86,7 @@ int main(int argc, char* argv[])
control |= 0b00100; control |= 0b00100;
break; break;
case 'i': case 'u':
value = strtol(optarg, NULL, 10); value = strtol(optarg, NULL, 10);
if (value > 0) if (value > 0)
{ {
@ -187,18 +187,22 @@ int main(int argc, char* argv[])
uint64_t mark; uint64_t mark;
size_t count = 0; size_t count = 0;
uint8_t* pointer;
uint8_t* limit = buffer + 3 * DSD_AMBE_CHUNK_SIZE;
// Wait for timer event (60 milliseconds) // Wait for timer event (60 milliseconds)
while (read(handle, &mark, sizeof(uint64_t)) > 0) while (read(handle, &mark, sizeof(uint64_t)) > 0)
{ {
// Read AMBE chunks of DSD format // Read AMBE chunks in DSD format
ssize_t length1 = read(STDIN_FILENO, buffer + 0 * DSD_AMBE_CHUNK_SIZE, DSD_AMBE_CHUNK_SIZE); pointer = buffer;
ssize_t length2 = read(STDIN_FILENO, buffer + 1 * DSD_AMBE_CHUNK_SIZE, DSD_AMBE_CHUNK_SIZE); while ((pointer < limit) &&
ssize_t length3 = read(STDIN_FILENO, buffer + 2 * DSD_AMBE_CHUNK_SIZE, DSD_AMBE_CHUNK_SIZE); (read(STDIN_FILENO, pointer, DSD_AMBE_CHUNK_SIZE) == DSD_AMBE_CHUNK_SIZE))
{
pointer += DSD_AMBE_CHUNK_SIZE;
}
if ((length1 != DSD_AMBE_CHUNK_SIZE) || if (pointer < limit)
(length2 != DSD_AMBE_CHUNK_SIZE) ||
(length3 != DSD_AMBE_CHUNK_SIZE))
{ {
printf("Input data stream stopped\n"); printf("Input data stream stopped\n");
break; break;

View file

@ -109,7 +109,7 @@ struct RewindContext* CreateRewindContext(uint32_t number, const char* verion)
return NULL; return NULL;
} }
// Create supplimentary data // Create supplementary data
uname(&name); uname(&name);