Skip to content

Commit 6f4cc67

Browse files
committed
DEE 2.0.3 Plugins update license text. Fix formating. max_scene_frames=240 in the x265 example.
1 parent e5eb4d8 commit 6f4cc67

File tree

7 files changed

+499
-308
lines changed

7 files changed

+499
-308
lines changed

plugins/code/common/PipingManager/PipingManager.cpp

Lines changed: 86 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2018, Dolby Laboratories
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* * Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* * Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from
19+
* this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
133
#include <thread>
234
#include <chrono>
335
#include <map>
@@ -13,7 +45,7 @@
1345
#include <signal.h>
1446
#include <sys/stat.h>
1547
#include <fcntl.h>
16-
#include <unistd.h>
48+
#include <unistd.h>
1749
#include <string.h>
1850
#include <errno.h>
1951
#endif
@@ -86,15 +118,15 @@ class CircularFifo
86118
}
87119
int PopFront(char* buffer, size_t size)
88120
{
89-
if (PeekFront(buffer, size) != 0)
121+
if (PeekFront(buffer, size) != 0)
90122
return -1;
91123
mStart = (mStart + size) % mSize;
92124
mFree += size;
93125
return 0;
94126
}
95127
int PopFront(size_t size)
96128
{
97-
if (size > Taken())
129+
if (size > Taken())
98130
return -1;
99131
mStart = (mStart + size) % mSize;
100132
mFree += size;
@@ -156,7 +188,7 @@ int get_flag(pipe_type_t type)
156188
else if (type == OUTPUT_PIPE)
157189
{
158190
return O_RDONLY;
159-
}
191+
}
160192
else
161193
{
162194
return O_RDWR;
@@ -186,9 +218,9 @@ int pipe_write_func(PipeData* data)
186218
int bytes_written = write(data->mHandle, data->mTempBuf.data(), data_size);
187219
if (bytes_written < 0)
188220
{
189-
if (errno != EAGAIN)
190-
status = PIPE_MGR_WRITE_ERROR;
191-
bytes_written = 0;
221+
if (errno != EAGAIN)
222+
status = PIPE_MGR_WRITE_ERROR;
223+
bytes_written = 0;
192224
}
193225
#endif
194226

@@ -212,7 +244,7 @@ static
212244
int pipe_read_func(PipeData* data)
213245
{
214246
piping_status_t status = PIPE_MGR_OK;
215-
size_t outBufSize = data->mOutBuf.Free();
247+
size_t outBufSize = data->mOutBuf.Free();
216248

217249
if (outBufSize == 0) return 0;
218250

@@ -232,9 +264,9 @@ int pipe_read_func(PipeData* data)
232264
int bytes_read = read(data->mHandle, data->mTempBuf.data(), outBufSize);
233265
if (bytes_read < 0)
234266
{
235-
if (errno != EAGAIN)
236-
status = PIPE_MGR_READ_ERROR;
237-
bytes_read = 0;
267+
if (errno != EAGAIN)
268+
status = PIPE_MGR_READ_ERROR;
269+
bytes_read = 0;
238270
}
239271
#endif
240272

@@ -259,28 +291,28 @@ void pipe_thread_func(PipeData* data)
259291
data->mThreadRunning = true;
260292

261293
// connect the pipe
262-
#ifdef WIN32
294+
#ifdef WIN32
263295
if (ConnectNamedPipe(data->mHandle, NULL) == NULL)
264296
{
265297
DWORD last_error = GetLastError();
266298
data->mErrorString = std::to_string(last_error);
267299
data->mStatus = PIPE_MGR_CONNECT_ERROR;
268300
}
269301
#else
270-
signal(SIGPIPE, SIG_IGN); // ignore sigpipe, we handle errors in another way
271-
while ((data->mHandle = open(data->mName.c_str(), get_flag(data->mType) | O_NONBLOCK )) == -1)
272-
{
273-
if (errno != ENXIO) // ENXIO means the other end of the pipe is not ready and we need to try again
274-
{
275-
data->mStatus = PIPE_MGR_CONNECT_ERROR;
276-
break;
277-
}
278-
if (data->mStop == true)
279-
{
280-
data->mStatus = PIPE_MGR_CONNECT_ERROR;
281-
break;
282-
}
283-
}
302+
signal(SIGPIPE, SIG_IGN); // ignore sigpipe, we handle errors in another way
303+
while ((data->mHandle = open(data->mName.c_str(), get_flag(data->mType) | O_NONBLOCK )) == -1)
304+
{
305+
if (errno != ENXIO) // ENXIO means the other end of the pipe is not ready and we need to try again
306+
{
307+
data->mStatus = PIPE_MGR_CONNECT_ERROR;
308+
break;
309+
}
310+
if (data->mStop == true)
311+
{
312+
data->mStatus = PIPE_MGR_CONNECT_ERROR;
313+
break;
314+
}
315+
}
284316
#endif
285317

286318
if (data->mStatus != PIPE_MGR_OK)
@@ -294,37 +326,37 @@ void pipe_thread_func(PipeData* data)
294326
{
295327
if ((data->mType == INPUT_PIPE || data->mType == DUPLEX_PIPE) && data->mInBuf.Taken() > 0)
296328
{
297-
int written_bytes = pipe_write_func(data);
298-
if (written_bytes < 0)
329+
int written_bytes = pipe_write_func(data);
330+
if (written_bytes < 0)
299331
{
300332
break;
301333
}
302-
else if (written_bytes > 0)
334+
else if (written_bytes > 0)
303335
data->mKillTimer = 0;
304336
}
305337
if ((data->mType == OUTPUT_PIPE || data->mType == DUPLEX_PIPE) && data->mOutBuf.Free() > 0)
306338
{
307-
int read_bytes = pipe_read_func(data);
339+
int read_bytes = pipe_read_func(data);
308340
if (read_bytes < 0)
309341
{
310342
break;
311343
}
312-
else if (read_bytes > 0)
344+
else if (read_bytes > 0)
313345
data->mKillTimer = 0;
314346
}
315-
347+
316348
if (data->mCloseIfEmpty && data->mInBuf.Taken() == 0 && data->mOutBuf.Taken() == 0)
317349
{
318-
break;
319-
}
350+
break;
351+
}
320352
}
321-
353+
322354
#ifdef WIN32
323355
CloseHandle(data->mHandle);
324356
#else
325357
close(data->mHandle);
326358
#endif
327-
359+
328360
data->mStatus = PIPE_MGR_PIPE_CLOSED;
329361
data->mThreadRunning = false;
330362
}
@@ -452,11 +484,11 @@ void piping_manager_thread_func(PipingManagerData* data)
452484
for (it = data->mPipes.begin(); it != data->mPipes.end(); ++it)
453485
{
454486
PipeData* pipe = it->second;
455-
if (pipe->mStatus != PIPE_MGR_OK)
456-
{
457-
continue;
458-
}
459-
pipe->mKillTimer = pipe->mKillTimer + timeDiff.count();
487+
if (pipe->mStatus != PIPE_MGR_OK)
488+
{
489+
continue;
490+
}
491+
pipe->mKillTimer = pipe->mKillTimer + timeDiff.count();
460492
if (pipe->mKillTimer >= data->mPipeTimeout && data->mGlobalTimeout == false && pipe->mStatus != PIPE_MGR_PIPE_CLOSED)
461493
{
462494
pipe->closeThread();
@@ -529,7 +561,7 @@ piping_status_t PipingManager::destroyNamedPipe(int pipe_id)
529561

530562
piping_status_t PipingManager::closePipe(int pipe_id)
531563
{
532-
std::map<int, PipeData*>::iterator it = mData->mPipes.find(pipe_id);
564+
std::map<int, PipeData*>::iterator it = mData->mPipes.find(pipe_id);
533565
if (it == mData->mPipes.end())
534566
{
535567
return PIPE_MGR_PIPE_NOT_FOUND;
@@ -567,22 +599,22 @@ piping_status_t PipingManager::writeToPipe(int pipe_id, void* buffer, size_t dat
567599
{
568600
PipeData* pipe = it->second;
569601
std::lock_guard<std::mutex> lock(pipe->mMutex);
570-
602+
571603
size_t data_to_write = data_size;
572604
if (data_to_write > pipe->mInBuf.Free())
573605
{
574606
data_to_write = pipe->mInBuf.Free();
575-
}
576-
577-
if (pipe->mStatus != PIPE_MGR_OK)
578-
{
579-
status = pipe->mStatus;
580-
}
581-
else if (data_to_write > 0)
582-
{
583-
pipe->mInBuf.Append((char*)buffer, data_to_write);
584-
bytes_written = data_to_write;
585-
}
607+
}
608+
609+
if (pipe->mStatus != PIPE_MGR_OK)
610+
{
611+
status = pipe->mStatus;
612+
}
613+
else if (data_to_write > 0)
614+
{
615+
pipe->mInBuf.Append((char*)buffer, data_to_write);
616+
bytes_written = data_to_write;
617+
}
586618
}
587619

588620
return status;

plugins/code/common/PipingManager/PipingManager.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2018, Dolby Laboratories
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* * Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* * Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from
19+
* this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
133
#include <string>
234

335
struct PipingManagerData;

plugins/code/common/SystemCalls/SystemCalls.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2018, Dolby Laboratories
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* * Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* * Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from
19+
* this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
133
#include <SystemCalls.h>
234
#include <vector>
335
#include <sstream>

plugins/code/common/SystemCalls/SystemCalls.h

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
/*
2+
* BSD 3-Clause License
3+
*
4+
* Copyright (c) 2018, Dolby Laboratories
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* * Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* * Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived from
19+
* this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
133
#include <string>
234
#include <atomic>
335

@@ -14,4 +46,4 @@ int systemWithTimeout(std::string command, int& return_code, int timeout);
1446

1547
int systemWithKillswitch(std::string command, int& return_code, std::atomic_bool& killswitch);
1648

17-
int systemWithStdout(std::string cmd, std::string& output);
49+
int systemWithStdout(std::string cmd, std::string& output);

0 commit comments

Comments
 (0)