From 0226277758b7312cf3524e9bd9f0e71edebf32a7 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 19:00:51 +0100 Subject: [PATCH] triple: fix narrowing warning in video_td, add FD_CLOEXEC --- libtriple/audio_td.cpp | 1 + libtriple/record_td.cpp | 1 + libtriple/video_td.cpp | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libtriple/audio_td.cpp b/libtriple/audio_td.cpp index cd1bb26..af0fc1d 100644 --- a/libtriple/audio_td.cpp +++ b/libtriple/audio_td.cpp @@ -274,6 +274,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) /* not a real error */ return 0; } + fcntl(P->mixer_fd, F_SETFD, FD_CLOEXEC); if (ioctl(P->mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) { lt_info("%s: SOUND_MIXER_READ_DEVMASK %m\n", __func__); devmask = 0; diff --git a/libtriple/record_td.cpp b/libtriple/record_td.cpp index dd10e6a..a4bfbe2 100644 --- a/libtriple/record_td.cpp +++ b/libtriple/record_td.cpp @@ -113,6 +113,7 @@ bool cRecord::Start(int fd, unsigned short vpid, unsigned short *apids, int nump pd->dmx->addPid(apids[i]); pd->file_fd = fd; + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD)|FD_CLOEXEC); pd->exit_flag = RECORD_RUNNING; if (posix_fadvise(pd->file_fd, 0, 0, POSIX_FADV_DONTNEED)) perror("posix_fadvise"); diff --git a/libtriple/video_td.cpp b/libtriple/video_td.cpp index c8df609..d6f9010 100644 --- a/libtriple/video_td.cpp +++ b/libtriple/video_td.cpp @@ -854,7 +854,7 @@ void VDec::FastForwardMode(int mode) * this code is inspired by dreambox AIO-grab, * git://schwerkraft.elitedvb.net/aio-grab/aio-grab.git */ /* static lookup tables for faster yuv2rgb conversion */ -static const int yuv2rgbtable_y[256] = { +static const uint32_t yuv2rgbtable_y[256] = { 0xFFED5EA0, 0xFFEE88B6, 0xFFEFB2CC, 0xFFF0DCE2, 0xFFF206F8, 0xFFF3310E, 0xFFF45B24, 0xFFF5853A, 0xFFF6AF50, 0xFFF7D966, 0xFFF9037C, 0xFFFA2D92, 0xFFFB57A8, 0xFFFC81BE, 0xFFFDABD4, 0xFFFED5EA, 0x00000000, 0x00012A16, 0x0002542C, 0x00037E42, 0x0004A858, 0x0005D26E, 0x0006FC84, 0x0008269A, @@ -888,7 +888,7 @@ static const int yuv2rgbtable_y[256] = { 0x0104D340, 0x0105FD56, 0x0107276C, 0x01085182, 0x01097B98, 0x010AA5AE, 0x010BCFC4, 0x010CF9DA, 0x010E23F0, 0x010F4E06, 0x0110781C, 0x0111A232, 0x0112CC48, 0x0113F65E, 0x01152074, 0x01164A8A }; -static const int yuv2rgbtable_ru[256] = { +static const uint32_t yuv2rgbtable_ru[256] = { 0xFEFDA500, 0xFEFFA9B6, 0xFF01AE6C, 0xFF03B322, 0xFF05B7D8, 0xFF07BC8E, 0xFF09C144, 0xFF0BC5FA, 0xFF0DCAB0, 0xFF0FCF66, 0xFF11D41C, 0xFF13D8D2, 0xFF15DD88, 0xFF17E23E, 0xFF19E6F4, 0xFF1BEBAA, 0xFF1DF060, 0xFF1FF516, 0xFF21F9CC, 0xFF23FE82, 0xFF260338, 0xFF2807EE, 0xFF2A0CA4, 0xFF2C115A, @@ -922,7 +922,7 @@ static const int yuv2rgbtable_ru[256] = { 0x00E20FA0, 0x00E41456, 0x00E6190C, 0x00E81DC2, 0x00EA2278, 0x00EC272E, 0x00EE2BE4, 0x00F0309A, 0x00F23550, 0x00F43A06, 0x00F63EBC, 0x00F84372, 0x00FA4828, 0x00FC4CDE, 0x00FE5194, 0x00100564A }; -static const int yuv2rgbtable_gu[256] = { +static const uint32_t yuv2rgbtable_gu[256] = { 0xFFCDD300, 0xFFCE375A, 0xFFCE9BB4, 0xFFCF000E, 0xFFCF6468, 0xFFCFC8C2, 0xFFD02D1C, 0xFFD09176, 0xFFD0F5D0, 0xFFD15A2A, 0xFFD1BE84, 0xFFD222DE, 0xFFD28738, 0xFFD2EB92, 0xFFD34FEC, 0xFFD3B446, 0xFFD418A0, 0xFFD47CFA, 0xFFD4E154, 0xFFD545AE, 0xFFD5AA08, 0xFFD60E62, 0xFFD672BC, 0xFFD6D716, @@ -956,7 +956,7 @@ static const int yuv2rgbtable_gu[256] = { 0x002BE760, 0x002C4BBA, 0x002CB014, 0x002D146E, 0x002D78C8, 0x002DDD22, 0x002E417C, 0x002EA5D6, 0x002F0A30, 0x002F6E8A, 0x002FD2E4, 0x0030373E, 0x00309B98, 0x0030FFF2, 0x0031644C, 0x0031C8A6 }; -static const int yuv2rgbtable_gv[256] = { +static const uint32_t yuv2rgbtable_gv[256] = { 0xFF97E900, 0xFF98B92E, 0xFF99895C, 0xFF9A598A, 0xFF9B29B8, 0xFF9BF9E6, 0xFF9CCA14, 0xFF9D9A42, 0xFF9E6A70, 0xFF9F3A9E, 0xFFA00ACC, 0xFFA0DAFA, 0xFFA1AB28, 0xFFA27B56, 0xFFA34B84, 0xFFA41BB2, 0xFFA4EBE0, 0xFFA5BC0E, 0xFFA68C3C, 0xFFA75C6A, 0xFFA82C98, 0xFFA8FCC6, 0xFFA9CCF4, 0xFFAA9D22, @@ -990,7 +990,7 @@ static const int yuv2rgbtable_gv[256] = { 0x005B1420, 0x005BE44E, 0x005CB47C, 0x005D84AA, 0x005E54D8, 0x005F2506, 0x005FF534, 0x0060C562, 0x00619590, 0x006265BE, 0x006335EC, 0x0064061A, 0x0064D648, 0x0065A676, 0x006676A4, 0x006746D2 }; -static const int yuv2rgbtable_bv[256] = { +static const uint32_t yuv2rgbtable_bv[256] = { 0xFF33A280, 0xFF353B3B, 0xFF36D3F6, 0xFF386CB1, 0xFF3A056C, 0xFF3B9E27, 0xFF3D36E2, 0xFF3ECF9D, 0xFF406858, 0xFF420113, 0xFF4399CE, 0xFF453289, 0xFF46CB44, 0xFF4863FF, 0xFF49FCBA, 0xFF4B9575, 0xFF4D2E30, 0xFF4EC6EB, 0xFF505FA6, 0xFF51F861, 0xFF53911C, 0xFF5529D7, 0xFF56C292, 0xFF585B4D, @@ -1043,6 +1043,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g lt_info("%s: cannot open open /dev/mem (%m)\n", __func__); return false; } + fcntl(mfd, F_SETFD, FD_CLOEXEC); /* this hints at incorrect usage */ if (video != NULL) lt_info("%s: WARNING, video != NULL?\n", __func__);