mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
- 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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C)
|
||||
* (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -150,17 +150,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;
|
||||
}
|
||||
@@ -168,10 +172,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;
|
||||
}
|
||||
@@ -186,12 +193,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? */
|
||||
}
|
||||
@@ -203,14 +212,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;
|
||||
@@ -230,7 +241,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;
|
||||
@@ -251,7 +262,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));
|
||||
@@ -266,7 +277,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;
|
||||
}
|
||||
@@ -275,7 +287,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))
|
||||
@@ -378,9 +390,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);
|
||||
|
Reference in New Issue
Block a user