media: vidtv: extract the initial CRC value to into a #define
Subsystems (2)
Daniel W. S. Almeida
maintainerPATCH 1/6 media: vidtv: extract the initial CRC value to into a #define
From: Daniel W. S. Almeida <[email protected]>
The same constant (0xffffffff) is used in three different functions.
Extract it into a #define to avoid repetition.
--- drivers/media/test-drivers/vidtv/vidtv_psi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +4 -3
@@ -30,6 +30,7 @@#define CRC_SIZE_IN_BYTES 4#define MAX_VERSION_NUM 32 +#define INITIAL_CRC 0xffffffffstatic const u32 CRC_LUT [256 ] = {/* from libdvbv5 */
@@ -794,7 +795,7 @@ u32 vidtv_psi_pat_write_into(struct vidtv_psi_pat_write_args args)/* the number of bytes written by this function */ u32 nbytes =0 ;const u16 pat_pid =VIDTV_PAT_PID ; -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_table_pat_program *p = args.pat->program;
@@ -990,7 +991,7 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args) {/* the number of bytes written by this function */ u32 nbytes =0 ; -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_desc *table_descriptor = args.pmt->descriptor;struct vidtv_psi_table_pmt_stream *stream = args.pmt->stream;
@@ -1143,7 +1144,7 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args)u32 nbytes =0 ;u16 sdt_pid =VIDTV_SDT_PID ;/* see ETSI EN 300 468 v1.15.1 p. 11 */ -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_table_sdt_service *service = args.sdt->service; struct vidtv_psi_desc *service_desc = (args.sdt->service) ?
Signature · 1 line
2.28.0
Daniel W. S. Almeida
maintainerPATCH 2/6 media: vidtv: psi: add a Network Information Table (NIT)
From: Daniel W. S. Almeida <[email protected]>
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
--- .../driver-api/media/drivers/vidtv.rst | 6 +- .../media/test-drivers/vidtv/vidtv_bridge.c | 4 + .../media/test-drivers/vidtv/vidtv_channel.c | 61 ++++ drivers/media/test-drivers/vidtv/vidtv_mux.c | 17 + drivers/media/test-drivers/vidtv/vidtv_mux.h | 9 + drivers/media/test-drivers/vidtv/vidtv_psi.c | 345 +++++++++++++++++- drivers/media/test-drivers/vidtv/vidtv_psi.h | 119 +++++- 7 files changed, 549 insertions(+), 12 deletions(-)
Documentation/driver-api/media/drivers/vidtv.rst +3 -3
@@ -149,11 +149,11 @@ vidtv_psi.[ch] 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. + Currently vidtv supports working with 4 PSI tables: PAT, PMT, + SDT and NIT. The specification for PAT and PMT can be found in *ISO 13818-1: - Systems*, while the specification for the SDT can be found in *ETSI + Systems*, while the specification for the SDT, NIT can be found in *ETSI EN 300 468: Specification for Service Information (SI) in DVB systems*.
drivers/media/test-drivers/vidtv/vidtv_bridge.c +4 -0
@@ -28,6 +28,8 @@//#define MUX_BUF_MIN_SZ #define TUNER_DEFAULT_ADDR 0x68#define DEMOD_DEFAULT_ADDR 0x60 +#define VIDTV_DEFAULT_NETWORK_ID 0x744 +#define VIDTV_DEFAULT_NETWORK_NAME "LinuxTV.org"/* LNBf fake parameters: ranges used by an Universal (extended) European LNBf */ #define LNB_CUT_FREQUENCY 11700000
@@ -166,6 +168,8 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) .si_period_usecs = si_period_msec * USEC_PER_MSEC, .pcr_pid = pcr_pid, .transport_stream_id = VIDTV_DEFAULT_TS_ID, + .network_id = VIDTV_DEFAULT_NETWORK_ID, + .network_name = VIDTV_DEFAULT_NETWORK_NAME, };struct device *dev = &dvb->pdev->dev;u32 mux_buf_sz;
drivers/media/test-drivers/vidtv/vidtv_channel.c +61 -0
89 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_mux.c +17 -0
@@ -79,6 +79,9 @@ static int vidtv_mux_pid_ctx_init(struct vidtv_mux *m)/* push the SDT pid ctx */ if (!vidtv_mux_create_pid_ctx_once (m,VIDTV_SDT_PID ))return -ENOMEM ; +/* push the NIT pid ctx */ +if (!vidtv_mux_create_pid_ctx_once (m,VIDTV_NIT_PID )) +return -ENOMEM ;/* add a ctx for all PMT sections */ while (p) {
@@ -124,10 +127,12 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m)struct vidtv_mux_pid_ctx *pat_ctx;struct vidtv_mux_pid_ctx *pmt_ctx;struct vidtv_mux_pid_ctx *sdt_ctx; +struct vidtv_mux_pid_ctx *nit_ctx;struct vidtv_psi_pat_write_args pat_args = {};struct vidtv_psi_pmt_write_args pmt_args = {};struct vidtv_psi_sdt_write_args sdt_args = {}; +struct vidtv_psi_nit_write_args nit_args = {};u32 nbytes;/* the number of bytes written by this function */ u16 pmt_pid;
@@ -135,6 +140,7 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m) pat_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_PAT_PID ); sdt_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_SDT_PID ); + nit_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_NIT_PID ); pat_args.buf = m->mux_buf; pat_args.offset = m->mux_buf_offset;
@@ -176,6 +182,14 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m) m->mux_buf_offset +=vidtv_psi_sdt_write_into (sdt_args); + nit_args.buf = m->mux_buf; + nit_args.offset = m->mux_buf_offset; + nit_args.nit = m->si.nit; + nit_args.buf_sz = m->mux_buf_sz; + nit_args.continuity_counter = &nit_ctx->cc; + + m->mux_buf_offset +=vidtv_psi_nit_write_into (nit_args); + nbytes = m->mux_buf_offset - initial_offset; m->num_streamed_si++;
@@ -465,6 +479,8 @@ struct vidtv_mux *vidtv_mux_init(struct dvb_frontend *fe, m->pcr_pid = args->pcr_pid; m->transport_stream_id = args->transport_stream_id; + m->network_id = args->network_id; + m->network_name =kstrdup (args->network_name,GFP_KERNEL ); m->priv = args->priv; m->timing.current_jiffies =get_jiffies_64 ();
@@ -502,6 +518,7 @@ void vidtv_mux_destroy(struct vidtv_mux *m)vidtv_mux_pid_ctx_destroy (m);vidtv_channel_si_destroy (m);vidtv_channels_destroy (m); +kfree (m->network_name);vfree (m->mux_buf);kfree (m); }
drivers/media/test-drivers/vidtv/vidtv_mux.h +9 -0
@@ -65,6 +65,7 @@ struct vidtv_mux_si {struct vidtv_psi_table_pat *pat;struct vidtv_psi_table_pmt **pmt_secs;/* the PMT sections */ struct vidtv_psi_table_sdt *sdt; +struct vidtv_psi_table_nit *nit; };/**
@@ -100,6 +101,8 @@ struct vidtv_mux_pid_ctx {* @pcr_pid: The TS PID used for the PSI packets. All channels will share the * same PCR. * @transport_stream_id: The transport stream ID +* @network_id: The network ID +* @network_name: The network name * @priv: Private data. */ struct vidtv_mux {
@@ -129,6 +132,8 @@ struct vidtv_mux {u16 pcr_pid;u16 transport_stream_id; +u16 network_id; +char *network_name;void *priv; };
@@ -143,6 +148,8 @@ struct vidtv_mux {* same PCR. * @transport_stream_id: The transport stream ID * @channels: an optional list of channels to use +* @network_id: The network ID +* @network_name: The network name * @priv: Private data. */ struct vidtv_mux_init_args {
@@ -154,6 +161,8 @@ struct vidtv_mux_init_args {u16 pcr_pid;u16 transport_stream_id;struct vidtv_channel *channels; +u16 network_id; +char *network_name;void *priv; };
drivers/media/test-drivers/vidtv/vidtv_psi.c +340 -5
402 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_psi.h +115 -4
153 lines not on this page · raw message
Signature · 1 line
2.28.0
Daniel W. S. Almeida
maintainerPATCH 3/6 media: vidtv: psi: Implement an Event Information Table (EIT)
In reply to Daniel W. S. AlmeidaFrom: Daniel W. S. Almeida <[email protected]>
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.
--- .../driver-api/media/drivers/vidtv.rst | 8 +- .../media/test-drivers/vidtv/vidtv_channel.c | 73 +++- .../media/test-drivers/vidtv/vidtv_channel.h | 3 + drivers/media/test-drivers/vidtv/vidtv_mux.c | 14 + drivers/media/test-drivers/vidtv/vidtv_mux.h | 2 + drivers/media/test-drivers/vidtv/vidtv_psi.c | 315 +++++++++++++++++- drivers/media/test-drivers/vidtv/vidtv_psi.h | 121 ++++++- 7 files changed, 527 insertions(+), 9 deletions(-)
Documentation/driver-api/media/drivers/vidtv.rst +5 -3
@@ -149,11 +149,11 @@ vidtv_psi.[ch] Because the generator is implemented in a separate file, it can be reused elsewhere in the media subsystem. - Currently vidtv supports working with 4 PSI tables: PAT, PMT, - SDT and NIT. + Currently vidtv supports working with 5 PSI tables: PAT, PMT, + SDT, NIT and EIT. The specification for PAT and PMT can be found in *ISO 13818-1: - Systems*, while the specification for the SDT, NIT can be found in *ETSI + Systems*, while the specification for the SDT, NIT, EIT can be found in *ETSI EN 300 468: Specification for Service Information (SI) in DVB systems*.
@@ -197,6 +197,8 @@ vidtv_channel.[ch] #. Their programs will be concatenated to populate the PAT + #. Their events will be concatenated to populate the EIT + #. For each program in the PAT, a PMT section will be created #. The PMT section for a channel will be assigned its streams.
drivers/media/test-drivers/vidtv/vidtv_channel.c +71 -2
145 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_channel.h +3 -0
@@ -9,6 +9,7 @@* 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 +* Their events will be concatenated to populate the EIT * 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
@@ -45,6 +46,7 @@* Will be concatenated into the PAT. * @streams: A stream loop used to populate the PMT section for 'program' * @encoders: A encoder loop. There must be one encoder for each stream. +* @events: Optional event information. This will feed into the EIT. * @next: Optionally chain this channel. */ struct vidtv_channel {
@@ -55,6 +57,7 @@ struct vidtv_channel {struct vidtv_psi_table_pat_program *program;struct vidtv_psi_table_pmt_stream *streams;struct vidtv_encoder *encoders; +struct vidtv_psi_table_eit_event *events;struct vidtv_channel *next; };
drivers/media/test-drivers/vidtv/vidtv_mux.c +14 -0
@@ -82,6 +82,9 @@ static int vidtv_mux_pid_ctx_init(struct vidtv_mux *m)/* push the NIT pid ctx */ if (!vidtv_mux_create_pid_ctx_once (m,VIDTV_NIT_PID ))return -ENOMEM ; +/* push the EIT pid ctx */ +if (!vidtv_mux_create_pid_ctx_once (m,VIDTV_EIT_PID )) +return -ENOMEM ;/* add a ctx for all PMT sections */ while (p) {
@@ -128,11 +131,13 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m)struct vidtv_mux_pid_ctx *pmt_ctx;struct vidtv_mux_pid_ctx *sdt_ctx;struct vidtv_mux_pid_ctx *nit_ctx; +struct vidtv_mux_pid_ctx *eit_ctx;struct vidtv_psi_pat_write_args pat_args = {};struct vidtv_psi_pmt_write_args pmt_args = {};struct vidtv_psi_sdt_write_args sdt_args = {};struct vidtv_psi_nit_write_args nit_args = {}; +struct vidtv_psi_eit_write_args eit_args = {};u32 nbytes;/* the number of bytes written by this function */ u16 pmt_pid;
@@ -141,6 +146,7 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m) pat_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_PAT_PID ); sdt_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_SDT_PID ); nit_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_NIT_PID ); + eit_ctx =vidtv_mux_get_pid_ctx (m,VIDTV_EIT_PID ); pat_args.buf = m->mux_buf; pat_args.offset = m->mux_buf_offset;
@@ -190,6 +196,14 @@ static u32 vidtv_mux_push_si(struct vidtv_mux *m) m->mux_buf_offset +=vidtv_psi_nit_write_into (nit_args); + eit_args.buf = m->mux_buf; + eit_args.offset = m->mux_buf_offset; + eit_args.eit = m->si.eit; + eit_args.buf_sz = m->mux_buf_sz; + eit_args.continuity_counter = &eit_ctx->cc; + + m->mux_buf_offset +=vidtv_psi_eit_write_into (eit_args); + nbytes = m->mux_buf_offset - initial_offset; m->num_streamed_si++;
drivers/media/test-drivers/vidtv/vidtv_mux.h +2 -0
@@ -59,6 +59,7 @@ struct vidtv_mux_timing {* @pat: The PAT in use by the muxer. * @pmt_secs: The PMT sections in use by the muxer. One for each program in the PAT. * @sdt: The SDT in use by the muxer. +* @eit: the EIT in use by the muxer. */ struct vidtv_mux_si {/* the SI tables */
@@ -66,6 +67,7 @@ struct vidtv_mux_si {struct vidtv_psi_table_pmt **pmt_secs;/* the PMT sections */ struct vidtv_psi_table_sdt *sdt;struct vidtv_psi_table_nit *nit; +struct vidtv_psi_table_eit *eit; };/**
drivers/media/test-drivers/vidtv/vidtv_psi.c +312 -3
366 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_psi.h +120 -1
153 lines not on this page · raw message
Signature · 1 line
2.28.0
Daniel W. S. Almeida
maintainerPATCH 4/6 media: vidtv: psi: extract descriptor chaining code into a helper
In reply to Daniel W. S. AlmeidaFrom: Daniel W. S. Almeida <[email protected]>
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.
--- drivers/media/test-drivers/vidtv/vidtv_psi.c | 49 ++++++-------------- 1 file changed, 15 insertions(+), 34 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +15 -34
@@ -313,6 +313,16 @@ static u32 table_section_crc32_write_into(struct crc32_write_args args)return nbytes; } +static void vidtv_psi_desc_chain (struct vidtv_psi_desc *head,struct vidtv_psi_desc *desc) +{ +if (head) { +while (head->next) + head = head->next; + + head->next = desc; + } +} + struct vidtv_psi_desc_service *vidtv_psi_service_desc_init(struct vidtv_psi_desc *head, enum service_type service_type, char *service_name,
@@ -346,12 +356,7 @@ struct vidtv_psi_desc_service *vidtv_psi_service_desc_init(struct vidtv_psi_descif (provider_name && provider_name_len) desc->provider_name =kstrdup (provider_name,GFP_KERNEL ); -if (head) { -while (head->next) - head = head->next; - - head->next = (struct vidtv_psi_desc *)desc; - } +vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; }
@@ -379,13 +384,7 @@ struct vidtv_psi_desc_registration additional_ident_info, additional_info_len); -if (head) { -while (head->next) - head = head->next; - - head->next = (struct vidtv_psi_desc *)desc; - } - +vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; }
@@ -404,13 +403,7 @@ struct vidtv_psi_desc_network_nameif (network_name && network_name_len) desc->network_name =kstrdup (network_name,GFP_KERNEL ); -if (head) { -while (head->next) - head = head->next; - - head->next = (struct vidtv_psi_desc *)desc; - } - +vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; }
@@ -448,13 +441,7 @@ struct vidtv_psi_desc_service_list desc->length = length; desc->service_list = head_e; -if (head) { -while (head->next) - head = head->next; - - head->next = (struct vidtv_psi_desc *)desc; - } - +vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; }
@@ -493,13 +480,7 @@ struct vidtv_psi_desc_short_eventif (text && text_len) desc->text =kstrdup (text,GFP_KERNEL ); -if (head) { -while (head->next) - head = head->next; - - head->next = (struct vidtv_psi_desc *)desc; - } - +vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; }
Signature · 1 line
2.28.0
Daniel W. S. Almeida
maintainerPATCH 5/6 media: vidtv: Move s302m specific fields into encoder context
In reply to Daniel W. S. AlmeidaFrom: Daniel W. S. Almeida <[email protected]>
A few fields used only by the tone generator in the s302m encoder are stored in struct vidtv_encoder. Move them into struct vidtv_s302m_ctx instead. While we are at it: fix a checkpatch warning for long lines.
--- .../media/test-drivers/vidtv/vidtv_encoder.h | 3 -- .../media/test-drivers/vidtv/vidtv_s302m.c | 30 +++++++++++-------- .../media/test-drivers/vidtv/vidtv_s302m.h | 3 ++ 3 files changed, 20 insertions(+), 16 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_encoder.h +0 -3
@@ -131,9 +131,6 @@ struct vidtv_encoder {u32 encoder_buf_offset;u64 sample_count; -int last_duration; -int note_offset; -enum musical_notes last_tone;struct vidtv_access_unit *access_units;
drivers/media/test-drivers/vidtv/vidtv_s302m.c +17 -13
@@ -233,36 +233,38 @@ static u16 vidtv_s302m_get_sample(struct vidtv_encoder *e) {u16 sample;int pos; +struct vidtv_s302m_ctx *ctx = e->ctx;if (!e->src_buf) {/* * Simple tone generator: play the tones at the * beethoven_5th_symphony array. */ -if (e->last_duration <=0 ) { +if (ctx->last_duration <=0 ) {if (e->src_buf_offset >=ARRAY_SIZE (beethoven_5th_symphony)) e->src_buf_offset =0 ; - e->last_tone = beethoven_5th_symphony[e->src_buf_offset].note; - e->last_duration = beethoven_5th_symphony[e->src_buf_offset].duration *S302M_SAMPLING_RATE_HZ /COMPASS /5 ; + ctx->last_tone = beethoven_5th_symphony[e->src_buf_offset].note; + ctx->last_duration = beethoven_5th_symphony[e->src_buf_offset].duration * +S302M_SAMPLING_RATE_HZ /COMPASS /5 ; e->src_buf_offset++; - e->note_offset =0 ; + ctx->note_offset =0 ; }else { - e->last_duration--; + ctx->last_duration--; }/* Handle silent */ -if (!e->last_tone) { +if (!ctx->last_tone) { e->src_buf_offset =0 ;return 0x8000 ; } - pos = (2 *PI * e->note_offset * e->last_tone /S302M_SAMPLING_RATE_HZ ); + pos = (2 *PI * ctx->note_offset * ctx->last_tone /S302M_SAMPLING_RATE_HZ );if (pos ==360 ) - e->note_offset =0 ; + ctx->note_offset =0 ;else - e->note_offset++; + ctx->note_offset++;return (fixp_sin32 (pos % (2 *PI )) >>16 ) +0x8000 ; }
@@ -445,6 +447,10 @@ struct vidtv_encoder {struct vidtv_encoder *e;u32 priv_sz =sizeof (struct vidtv_s302m_ctx ); +struct vidtv_s302m_ctx *ctx =kzalloc (priv_sz,GFP_KERNEL ); + +if (!ctx) +return NULL ; e =kzalloc (sizeof (*e),GFP_KERNEL );if (!e)
@@ -460,16 +466,14 @@ struct vidtv_encoder e->encoder_buf_offset =0 ; e->sample_count =0 ; - e->last_duration =0 ; e->src_buf = (args.src_buf) ? args.src_buf :NULL ; e->src_buf_sz = (args.src_buf) ? args.src_buf_sz :0 ; e->src_buf_offset =0 ; e->is_video_encoder = false; - e->ctx =kzalloc (priv_sz,GFP_KERNEL ); -if (!e->ctx) -return NULL ; + e->ctx = ctx; + ctx->last_duration =0 ; e->encode = vidtv_s302m_encode; e->clear = vidtv_s302m_clear;
drivers/media/test-drivers/vidtv/vidtv_s302m.h +3 -0
@@ -38,6 +38,9 @@ struct vidtv_s302m_ctx {struct vidtv_encoder *enc;u32 frame_index;u32 au_count; +int last_duration; +int note_offset; +enum musical_notes last_tone; };/**
Signature · 1 line
2.28.0
Daniel W. S. Almeida
maintainerPATCH 6/6 media: vidtv: psi: fix missing assignments in while loops
In reply to Daniel W. S. AlmeidaFrom: Daniel W. S. Almeida <[email protected]>
Some variables were only assigned once but were used in while loops as if they had been updated at every iteration. Fix this.
--- drivers/media/test-drivers/vidtv/vidtv_psi.c | 22 +++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +10 -12
@@ -1191,9 +1191,7 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args)struct vidtv_psi_desc *table_descriptor = args.pmt->descriptor;struct vidtv_psi_table_pmt_stream *stream = args.pmt->stream; -struct vidtv_psi_desc *stream_descriptor = (stream) ? - args.pmt->stream->descriptor : -NULL ; +struct vidtv_psi_desc *stream_descriptor;struct header_write_args h_args = {};struct psi_write_args psi_args = {};
@@ -1253,6 +1251,8 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args) nbytes +=vidtv_psi_ts_psi_write_into (psi_args); + stream_descriptor = stream->descriptor; +while (stream_descriptor) {/* write the stream descriptors, if any */ d_args.dest_buf = args.buf;
@@ -1343,9 +1343,7 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args)u32 crc =INITIAL_CRC ;struct vidtv_psi_table_sdt_service *service = args.sdt->service; -struct vidtv_psi_desc *service_desc = (args.sdt->service) ? - args.sdt->service->descriptor : -NULL ; +struct vidtv_psi_desc *service_desc;struct header_write_args h_args = {};struct psi_write_args psi_args = {};
@@ -1392,6 +1390,8 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args) nbytes +=vidtv_psi_ts_psi_write_into (psi_args); + service_desc = service->descriptor; +while (service_desc) {/* copy the service descriptors, if any */ d_args.dest_buf = args.buf;
@@ -1639,9 +1639,7 @@ u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_write_args args)struct vidtv_psi_desc *table_descriptor = args.nit->descriptor;struct vidtv_psi_table_transport *transport = args.nit->transport; -struct vidtv_psi_desc *transport_descriptor = (transport) ? - args.nit->transport->descriptor : -NULL ; +struct vidtv_psi_desc *transport_descriptor;struct header_write_args h_args = {};struct psi_write_args psi_args = {};
@@ -1709,6 +1707,8 @@ u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_write_args args) nbytes +=vidtv_psi_ts_psi_write_into (psi_args); + transport_descriptor = transport->descriptor; +while (transport_descriptor) {/* write the transport descriptors, if any */ d_args.dest_buf = args.buf;
@@ -1846,9 +1846,7 @@ u32 vidtv_psi_eit_write_into(struct vidtv_psi_eit_write_args args)u32 crc =INITIAL_CRC ;struct vidtv_psi_table_eit_event *event = args.eit->event; -struct vidtv_psi_desc *event_descriptor = (args.eit->event) ? - args.eit->event->descriptor : -NULL ; +struct vidtv_psi_desc *event_descriptor;struct header_write_args h_args = {};struct psi_write_args psi_args = {};
Signature · 6 lines
2.28.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Em Tue, 29 Sep 2020 00:26:20 -0300
"Daniel W. S. Almeida" <[email protected]> escreveu:
Quoted 1 line
From: Daniel W. S. Almeida <[email protected]>
On a very quick look, patches seem good. Why did you mark them as WIP?
Next time, please add a patch 0, specially when you tag something as WIP, or RFC.
Quoted 2 lines
The same constant (
0xffffffff) is used in three different functions.
This one at least seems to be ready for merging ;-)
Regards,
Mauro
Quoted 39 lines
Extract it into a #define to avoid repetition.
Signed-off-by Daniel W. S. Almeida <[email protected]>--- drivers/media/test-drivers/vidtv/vidtv_psi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/media/test-drivers/vidtv/vidtv_psi.c +3
-2@@ -30,6 +30,7 @@#define CRC_SIZE_IN_BYTES 4#define MAX_VERSION_NUM 32 +#define INITIAL_CRC 0xffffffffstatic const u32 CRC_LUT [256 ] = {/* from libdvbv5 */ @@ -794,7 +795,7 @@ u32 vidtv_psi_pat_write_into(struct vidtv_psi_pat_write_args args)/* the number of bytes written by this function */ u32 nbytes =0 ;const u16 pat_pid =VIDTV_PAT_PID ; -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_table_pat_program *p = args.pat->program;@@ -990,7 +991,7 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_write_args args) {/* the number of bytes written by this function */ u32 nbytes =0 ; -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_desc *table_descriptor = args.pmt->descriptor;struct vidtv_psi_table_pmt_stream *stream = args.pmt->stream;
drivers/media/test-drivers/vidtv/vidtv_psi.c u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args) · line 1150
Quoted 8 lines
drivers/media/test-drivers/vidtv/vidtv_psi.c +1
-1@@ -1143,7 +1144,7 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_write_args args)u32 nbytes =0 ;u16 sdt_pid =VIDTV_SDT_PID ;/* see ETSI EN 300 468 v1.15.1 p. 11 */ -u32 crc =0xffffffff ; +u32 crc =INITIAL_CRC ;struct vidtv_psi_table_sdt_service *service = args.sdt->service; struct vidtv_psi_desc *service_desc = (args.sdt->service) ?
Thanks,
Mauro
Daniel W. S. Almeida
maintainerHi Mauro!
Quoted 2 lines
Next time, please add a patch 0, specially when you tag something as WIP, or RFC.
Sorry about that :)
These are almost good but I came across some weird kasan output.
Can you test this series in a kernel with kasan instrumentation turned on?
Should apply just fine on top of your latest changes in mchehab-experimental/vidtv
-- thanks
-- Daniel
Em Tue, 29 Sep 2020 06:30:56 -0300
"Daniel W. S. Almeida" <[email protected]> escreveu:
Quoted 5 lines
Hi Mauro!
Quoted 2 lines
Next time, please add a patch 0, specially when you tag something as WIP, or RFC.
Quoted 7 lines
Sorry about that :)
These are almost good but I came across some weird kasan output.
Can you test this series in a kernel with kasan instrumentation turned on?
Should apply just fine on top of your latest changes in mchehab-experimental/vidtv
I'm currently focusing preparing some things for the merge window.
I can try to test them after it.
Btw, before testing those patches, you should test with KASAN and with the memory leak detector if everything is being de-allocated when the drivers are removed from the memory.
If you find something wrong there, I suggest you to fix the found issues before applying the new NIT and EDT tables support, as it may help to check what it could be happening after the patches.
Thanks,
Mauro