- formatting code using astyle

Conflicts:
	libarmbox/dmx.cpp
	libgeneric-pc/video_lib.h
	libspark/dmx.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-05-17 23:47:39 +02:00
committed by Thilo Graf
parent 42264ba4af
commit 7e5b1fc5d2
161 changed files with 13043 additions and 11396 deletions

View File

@@ -134,17 +134,21 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num
bool found;
unsigned short pid;
hal_info("%s\n", __func__);
if (!dmx) {
if (!dmx)
{
hal_info("%s: DMX = NULL\n", __func__);
return false;
}
pids = dmx->pesfds;
/* the first PID is the video pid, so start with the second PID... */
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) {
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i)
{
found = false;
pid = (*i).pid;
for (j = 0; j < numapids; j++) {
if (pid == apids[j]) {
for (j = 0; j < numapids; j++)
{
if (pid == apids[j])
{
found = true;
break;
}
@@ -152,10 +156,13 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num
if (!found)
dmx->removePid(pid);
}
for (j = 0; j < numapids; j++) {
for (j = 0; j < numapids; j++)
{
found = false;
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) {
if ((*i).pid == apids[j]) {
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i)
{
if ((*i).pid == apids[j])
{
found = true;
break;
}
@@ -170,12 +177,14 @@ bool cRecord::AddPid(unsigned short pid)
{
std::vector<pes_pids> pids;
hal_info("%s: \n", __func__);
if (!dmx) {
if (!dmx)
{
hal_info("%s: DMX = NULL\n", __func__);
return false;
}
pids = dmx->pesfds;
for (std::vector<pes_pids>::const_iterator i = pids.begin(); i != pids.end(); ++i) {
for (std::vector<pes_pids>::const_iterator i = pids.begin(); i != pids.end(); ++i)
{
if ((*i).pid == pid)
return true; /* or is it an error to try to add the same PID twice? */
}
@@ -187,14 +196,16 @@ void cRecord::WriterThread()
char threadname[17];
strncpy(threadname, "WriterThread", sizeof(threadname));
threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname);
prctl(PR_SET_NAME, (unsigned long)&threadname);
unsigned int chunk = 0;
while (!sem_wait(&sem)) {
while (!sem_wait(&sem))
{
if (!io_len[chunk]) // empty, assume end of recording
return;
unsigned char *p_buf = io_buf[chunk];
size_t p_len = io_len[chunk];
while (p_len) {
while (p_len)
{
ssize_t written = write(file_fd, p_buf, p_len);
if (written < 0)
break;
@@ -214,7 +225,7 @@ void cRecord::RecordThread()
char threadname[17];
strncpy(threadname, "RecordThread", sizeof(threadname));
threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname);
prctl(PR_SET_NAME, (unsigned long)&threadname);
int readsize = bufsize / 16;
int buf_pos = 0;
int count = 0;
@@ -235,7 +246,7 @@ void cRecord::RecordThread()
}
int val = fcntl(file_fd, F_GETFL);
if (fcntl(file_fd, F_SETFL, val|O_APPEND))
if (fcntl(file_fd, F_SETFL, val | O_APPEND))
hal_info("%s: O_APPEND? (%m)\n", __func__);
memset(&a, 0, sizeof(a));
@@ -250,7 +261,8 @@ void cRecord::RecordThread()
{
if (buf_pos < bufsize)
{
if (overflow_count) {
if (overflow_count)
{
hal_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count);
overflow_count = 0;
}
@@ -259,7 +271,7 @@ void cRecord::RecordThread()
toread = readsize;
ssize_t s = dmx->Read(buf + buf_pos, toread, 50);
hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__,
buf_pos, (int)s, bufsize - buf_pos);
buf_pos, (int)s, bufsize - buf_pos);
if (s < 0)
{
if (errno != EAGAIN && (errno != EOVERFLOW || !overflow))
@@ -362,9 +374,9 @@ void cRecord::RecordThread()
eventServer.registerEvent2(NeutrinoMessages::EVT_RECORDING_ENDED, CEventServer::INITID_NEUTRINO, "/tmp/neutrino.sock");
stream2file_status2_t s;
s.status = exit_flag;
strncpy(s.filename,basename(myfilename),512);
strncpy(s.filename, basename(myfilename), 512);
s.filename[511] = '\0';
strncpy(s.dir,dirname(myfilename),100);
strncpy(s.dir, dirname(myfilename), 100);
s.dir[99] = '\0';
eventServer.sendEvent(NeutrinoMessages::EVT_RECORDING_ENDED, CEventServer::INITID_NEUTRINO, &s, sizeof(s));
printf("[stream2file]: pthreads exit code: %i, dir: '%s', filename: '%s' myfilename: '%s'\n", exit_flag, s.dir, s.filename, myfilename);