media: vidtv: Add support for more MPEG PSI tables
Subsystems (2)
Daniel W. S. Almeida
maintainerv2 cover media: vidtv: Add support for more MPEG PSI tables
From: Daniel W. S. Almeida <[email protected]>
Implement support for more MPEG PSI tables (i.e. NIT & EIT).
While we're at it, fix a few minor mistakes in the PSI generator.
I initially sent this without a cover letter and as WIP but I have now tidied it up and it's spotless. I tested the driver on a kernel with KASAN & Kmemleak and tested the output on DVBInspector.
Daniel W. S. Almeida (6):
media: vidtv: extract the initial CRC value to into a #define
media: vidtv: psi: add a Network Information Table (NIT)
media: vidtv: psi: Implement an Event Information Table (EIT)
media: vidtv: psi: extract descriptor chaining code into a helper
media: vidtv: Move s302m specific fields into encoder context
media: vidtv: psi: fix missing assignments in while loops
.../driver-api/media/drivers/vidtv.rst | 8 +- .../media/test-drivers/vidtv/vidtv_bridge.c | 4 + .../media/test-drivers/vidtv/vidtv_channel.c | 130 +++- .../media/test-drivers/vidtv/vidtv_channel.h | 3 + .../media/test-drivers/vidtv/vidtv_encoder.h | 3 - drivers/media/test-drivers/vidtv/vidtv_mux.c | 29 + drivers/media/test-drivers/vidtv/vidtv_mux.h | 11 + drivers/media/test-drivers/vidtv/vidtv_psi.c | 678 +++++++++++++++++- drivers/media/test-drivers/vidtv/vidtv_psi.h | 240 ++++++- .../media/test-drivers/vidtv/vidtv_s302m.c | 25 +- .../media/test-drivers/vidtv/vidtv_s302m.h | 3 + 11 files changed, 1083 insertions(+), 51 deletions(-)
Signature · 1 line
2.29.2
Daniel W. S. Almeida
maintainerPATCH v2 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
@@ -31,6 +31,7 @@#define CRC_SIZE_IN_BYTES 4#define MAX_VERSION_NUM 32 +#define INITIAL_CRC 0xffffffffstatic const u32 CRC_LUT [256 ] = {/* from libdvbv5 */
@@ -784,7 +785,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;
@@ -974,7 +975,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;
@@ -1124,7 +1125,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 · 6 lines
2.29.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Daniel W. S. Almeida
maintainerPATCH v2 2/6 media: vidtv: psi: add a Network Information Table (NIT)
In reply to Daniel W. S. AlmeidaFrom: 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 | 59 +++ drivers/media/test-drivers/vidtv/vidtv_mux.c | 16 + 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, 546 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
@@ -177,6 +179,8 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) mux_args.si_period_usecs = si_period_msec *1000 ; mux_args.pcr_pid = pcr_pid; mux_args.transport_stream_id =VIDTV_DEFAULT_TS_ID ; + mux_args.network_id =VIDTV_DEFAULT_NETWORK_ID , + mux_args.network_name =VIDTV_DEFAULT_NETWORK_NAME , mux_args.priv = dvb; dvb->streaming = true;
drivers/media/test-drivers/vidtv/vidtv_channel.c +59 -0
87 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_mux.c +16 -0
@@ -74,6 +74,8 @@ static void vidtv_mux_pid_ctx_init(struct vidtv_mux *m)vidtv_mux_create_pid_ctx_once (m,VIDTV_PAT_PID );/* push the SDT pid ctx */ vidtv_mux_create_pid_ctx_once (m,VIDTV_SDT_PID ); +/* push the NIT pid ctx */ +vidtv_mux_create_pid_ctx_once (m,VIDTV_NIT_PID );/* add a ctx for all PMT sections */ while (p) {
@@ -117,10 +119,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;
@@ -128,6 +132,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;
@@ -169,6 +174,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++;
@@ -446,6 +459,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->priv = args.priv; + m->network_id = args.network_id; + m->network_name =kstrdup (args.network_name,GFP_KERNEL ); m->timing.current_jiffies =get_jiffies_64 ();if (args.channels)
@@ -469,6 +484,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
@@ -64,6 +64,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; };/**
@@ -99,6 +100,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 {
@@ -128,6 +131,8 @@ struct vidtv_mux {u16 pcr_pid;u16 transport_stream_id; +u16 network_id; +char *network_name;void *priv; };
@@ -142,6 +147,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 {
@@ -153,6 +160,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.29.2
Daniel W. S. Almeida
maintainerPATCH v2 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 | 71 +++- .../media/test-drivers/vidtv/vidtv_channel.h | 3 + drivers/media/test-drivers/vidtv/vidtv_mux.c | 13 + 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, 524 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 +69 -2
143 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
@@ -44,6 +45,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 {
@@ -54,6 +56,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 +13 -0
@@ -76,6 +76,8 @@ static void vidtv_mux_pid_ctx_init(struct vidtv_mux *m)vidtv_mux_create_pid_ctx_once (m,VIDTV_SDT_PID );/* push the NIT pid ctx */ vidtv_mux_create_pid_ctx_once (m,VIDTV_NIT_PID ); +/* push the EIT pid ctx */ +vidtv_mux_create_pid_ctx_once (m,VIDTV_EIT_PID );/* add a ctx for all PMT sections */ while (p) {
@@ -120,11 +122,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;
@@ -133,6 +137,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;
@@ -182,6 +187,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
@@ -58,6 +58,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 */
@@ -65,6 +66,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.29.2
Daniel W. S. Almeida
maintainerPATCH v2 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
@@ -314,6 +314,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,
@@ -345,12 +355,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; }
@@ -376,13 +381,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; }
@@ -401,13 +400,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; }
@@ -445,13 +438,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; }
@@ -490,13 +477,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 · 6 lines
2.29.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Daniel W. S. Almeida
maintainerPATCH v2 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 | 25 +++++++++++-------- .../media/test-drivers/vidtv/vidtv_s302m.h | 3 +++ 3 files changed, 17 insertions(+), 14 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 +14 -11
@@ -230,36 +230,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 ; }
@@ -442,6 +444,7 @@ struct vidtv_encoder {struct vidtv_encoder *e =kzalloc (sizeof (*e),GFP_KERNEL );u32 priv_sz =sizeof (struct vidtv_s302m_ctx ); +struct vidtv_s302m_ctx *ctx =kzalloc (priv_sz,GFP_KERNEL ); e->id =S302M ;
@@ -453,14 +456,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 ); + 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
@@ -39,6 +39,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 · 6 lines
2.29.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Daniel W. S. Almeida
maintainerPATCH v2 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
@@ -1175,9 +1175,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 = {};
@@ -1237,6 +1235,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;
@@ -1324,9 +1324,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 = {};
@@ -1373,6 +1371,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;
@@ -1616,9 +1616,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 = {};
@@ -1686,6 +1684,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;
@@ -1823,9 +1823,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.29.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees