#
76a2c5df |
|
19-Jun-2023 |
Jiasheng Jiang <jiasheng@iscas.ac.cn> |
media: vidtv: psi: Add check for kstrdup Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Fixes: 7a7899f6f58e ("media: vidtv: psi: Implement an Event Information Table (EIT)") Fixes: c2f78f0cb294 ("media: vidtv: psi: add a Network Information Table (NIT)") Fixes: f90cf6079bf6 ("media: vidtv: add a bridge driver") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
#
3ef57509 |
|
05-Jan-2023 |
Colin Ian King <colin.i.king@gmail.com> |
media: vidtv: make const array DURATION static Don't populate the read-only const array DURATION on the stack but instead make it static. Also makes the object code a little smaller. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
#
9dd2444f |
|
09-Dec-2021 |
Minghao Chi <chi.minghao@zte.com.cn> |
media: vidtv: remove unneeded variable make code cleaner return value form directly instead of taking this in another redundant variable. Link: https://lore.kernel.org/linux-media/20211210024721.425145-1-chi.minghao@zte.com.cn Reported-by: Zeal Robot <zealci@zte.com.cm> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
1b0b433f |
|
05-Mar-2021 |
Zhang Yunkai <zhang.yunkai@zte.com.cn> |
media: vidtv: remove duplicate include in vidtv_psi 'string.h' included in 'vidtv_psi.c' is duplicated. Signed-off-by: Zhang Yunkai <zhang.yunkai@zte.com.cn> Acked-by: Daniel Almeida <dwlsalmeida@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
8d23ada8 |
|
29-Dec-2020 |
Tian Tao <tiantao6@hisilicon.com> |
media: vidtv: Use kmemdup instead of kzalloc and memcpy Fixes coccicheck warning: drivers/media/test-drivers/vidtv/vidtv_psi.c:509:10-17: WARNING opportunity for kmemdup Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
0a933a7f |
|
24-Dec-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: psi: fix missing crc for PMT The PMT write function was refactored and this broke the CRC computation. Fix it. Fixes: db9569f67e2e ("media: vidtv: cleanup PMT write table function") Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
b0879828 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: simplify EIT write function - pass struct vidtv_psi_eit_write_args as a pointer; - avoid initializing struct fields multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
5a5b9fb1 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: simplify NIT write function - pass struct vidtv_psi_nit_write_args as a pointer; - avoid initializing struct fields multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
6286a4b7 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: simplify SDT write function - pass struct vidtv_psi_sdt_write_args as a pointer; - avoid initializing struct fields multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
db9569f6 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: cleanup PMT write table function - Pass struct vidtv_psi_pmt_write_args as a pointer; - Avoid initializing structs multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
7f957515 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: cleanup PAT write function Avoid initializing the structs multiple times and pass the PAT struct as a pointer, instead of a var. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
c570fb9f |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: cleanup PSI table header function - Pass struct header_write_args as a pointer, instead of passing as a var; - Initialize the psi_args struct only once. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
974ea176 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: cleanup PSI descriptor write function This function initializes the psi_args twice, and receives a struct, instead of a pointer to a struct. Clean it up. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
9e006741 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: simplify the crc writing logic Cleanup the table_section_crc32_write_into() function by initializing struct psi_write_args only once and by passing the args as a pointer. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
5edbd330 |
|
24-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: simplify PSI write function The function vidtv_psi_ts_psi_write_into() initializes the ts_header fields several times, and receives a struct as argument, instead of using a pointer to struct. Cleanup the function, in order to reduce its stack usage and to avoid initializing the ts_header multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
16002854 |
|
23-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: add date to the current event The current event is using an undefined date. Instead, it should be the timestamp when the EIT table was generated. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
bfa4aaeb |
|
23-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: fix service_id at SDT table The service_id there should be equal to the one used on other tables, otherwise, EIT entries won't be valid. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
039b7cae |
|
23-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: add a PID entry for the NIT table On normal TS streams, the NIT table has its own entry at PAT, but not at PMT. While here, properly handle alloc problems when creating PMT entries. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
91a8a240 |
|
23-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: properly fill EIT service_id The EIT header ID field should not contain the network ID, but, instead, the service_id of the program described at EIT. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
330d1356 |
|
20-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: remove some unused functions Right now, there's no need to access the length of some tables. So, drop the unused functions. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
a8bd461c |
|
22-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: do some cleanups at the driver Do some cleanups at the coding style of the driver: - remove "inline" declarations; - use reverse xmas-tree for local var declarations; - Adjust some indent to avoid breaking 80-cols; - Cleanup some comments. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
31e82355 |
|
17-Nov-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: don't use recursive functions The Linux stack is too short. So, using recursive functions is a very bad idea. Convert those into non-recursive ones. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
3be80379 |
|
21-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: add error checks Currently, there are not checks if something gets bad during memory allocation: it will simply use NULL pointers and crash. Add error path at the logic which allocates memory for the MPEG-TS generator code, propagating the errors up to the vidtv_bridge. Now, if something wents bad, start_streaming will return an error that userspace can detect: ERROR DMX_SET_PES_FILTER failed (PID = 0x2000): 12 Cannot allocate memory and the driver doesn't crash. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
8922e393 |
|
21-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: reorganize includes - Place the includes on alphabetical order; - get rid of asm/byteorder.h; - add bug.h at vidtv_s302m.c, as it is needed by inux/fixp-arith.h Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
c2b6ca66 |
|
31-Oct-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: psi: fix missing assignments in while loops Some variables were only assigned once but were used in while loops as if they had been updated at every iteration. Fix this. Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
84306c96 |
|
31-Oct-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: psi: extract descriptor chaining code into a helper The code to append a descriptor to the end of a chain is repeated throughout the psi generator code. Extract it into its own helper function to avoid cluttering. Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
7a7899f6 |
|
31-Oct-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: psi: Implement an Event Information Table (EIT) Implement an Event Information Table (EIT) as per EN 300 468 5.2.4. The EIT provides information in chronological order regarding the events contained within each service. For now only present event information is supported. [mchehab+huawei@kernel.org: removed an extra blank line] Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
c2f78f0c |
|
31-Oct-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: psi: add a Network Information Table (NIT) Add a Network Information Table (NIT) as specified in ETSI EN 300 468. This table conveys information relating to the physical organization of the multiplexes carried via a given network and the characteristics of the network itself. It is conveyed in the output of vidtv as packets with TS PID of 0x0010 [mchehab+huawei@kernel.org: removed an extra blank line] Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
dd6dbe8d |
|
31-Oct-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: extract the initial CRC value to into a #define The same constant (0xffffffff) is used in three different functions. Extract it into a #define to avoid repetition. Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
fc4405a5 |
|
20-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: cleanup PSI version numbers There's no reason to use static vars to store PSI version numbers. Also, currently, version numbers are starting with 0x01, because there's a code being called that increases it to 1 for all table initializer code, as the code may support dynamic changes at the PS tables on some future. So, let's just initialize them to 0x1f, in order for the versions to be reported as starting from 0. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
56ce9eff |
|
20-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: fix initialization of the network_id field at SDT This field should point to the network ID, and has different ranges for cable, terrestrial or satellite. It also has an special range for temporary private usage. For now, let's use the temporary private one. Once the Network Information Table (NIT) gets added, this should be reviewed. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
9e76f2cf |
|
17-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: remove an impossible condition As warned by smatch: drivers/media/test-drivers/vidtv/vidtv_psi.c:93 vidtv_psi_update_version_num() warn: impossible condition '(h->version > 32) => (0-31 > 32)' h_version is declared as: u8 version:5; Meaning that its value ranges from 0 to 31. Incrementing 31 on such data will overflow to zero, as expected. So, just drop the uneeded overflow check. While here, use "foo++" instead of "++foo", as this is a much more common pattern. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
044e27ae |
|
12-Sep-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: vidtv: get rid of some endiannes nonsense Genmask is always highest order to low order. It doesn't make any sense to make it depends on endiannes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
#
f90cf607 |
|
21-Aug-2020 |
Daniel W. S. Almeida <dwlsalmeida@gmail.com> |
media: vidtv: add a bridge driver Digital TV devices consist of several independent hardware components which are controlled by different drivers. Each media device is controlled by a group of cooperating drivers with the bridge driver as the main driver. This patch adds a bridge driver for the Virtual Digital TV driver [vidtv]. The bridge driver binds to the other drivers, that is, vidtv_tuner and vidtv_demod and implements the digital demux logic, providing userspace with a MPEG Transport Stream. The MPEG related code is split in the following way: - vidtv_ts: code to work with MPEG TS packets, such as TS headers, adaptation fields, PCR packets and NULL packets. - vidtv_psi: this is the PSI generator. PSI packets contain general information about a MPEG Transport Stream. A PSI generator is needed so userspace apps can retrieve information about the Transport Stream and eventually tune into a (dummy) channel. Because the generator is implemented in a separate file, it can be reused elsewhere in the media subsystem. Currently vidtv supports working with 3 PSI tables: PAT, PMT and SDT. - vidtv_pes: implements the PES logic to convert encoder data into MPEG TS packets. These can then be fed into a TS multiplexer and eventually into userspace. - vidtv_s302m: implements a S302M encoder to make it possible to insert PCM audio data in the generated MPEG Transport Stream. This shall enable passing an audio signal into userspace so it can be decoded and played by media software. - vidtv_channels: Implements a 'channel' abstraction When vidtv boots, it will create some hardcoded channels: Their services will be concatenated to populate the SDT. Their programs will be concatenated to populate the PAT For each program in the PAT, a PMT section will be created The PMT section for a channel will be assigned its streams. Every stream will have its corresponding encoder polled to produce TS packets These packets may be interleaved by the mux and then delivered to the bridge - vidtv_mux - Implements a MPEG TS mux, loosely based on the ffmpeg implementation The multiplexer is responsible for polling encoders, interleaving packets, padding the resulting stream with NULL packets if necessary and then delivering the resulting TS packets to the bridge driver so it can feed the demux. Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|