catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
327 stars 81 forks source link

[Req] PMT.C : process_sdt() and clean PSI #916

Closed lars18th closed 1 year ago

lars18th commented 2 years ago

Hi @catalinii ,

After fixing #340, and partially related to #339, I request if you can enhance the process_sdt() function in pmt.c to clear the encrypted identification of the service. The processing is quite simple:

This is necessary for clients that process the SDT table in order to stablish the content of the stream.

I hope you agree with this. Regards.

lars18th commented 2 years ago

Hi @catalinii ,

I prepared a new patch to start to solve this problem. You can merge now the PR #917 as it's standalone. But I need your help:

Futhermore, I don't know how to rewrite rightly the TS packet of the table. I've done some modification to execute the function process_sdt for every SDT packet (removing the FILTER_REVERSE of the filter flags). However, I need help because all modifications are not sended (the b buffer seems to be a copy). Futhermore, I don't know how to recalculate the CRC of the table.

So, as the PR contains the code to patch the CA flag for every service in the table (if (opts.clean_psi) b[3] &= 0xEF;), I ask if you can complete the code or point about how to finish it.

Regards.

catalinii commented 2 years ago

I did a bit of digging and is more complex than I thought. By looking at the code, I am not sure even clean_psi works as expected. Basically the flow is this: for every packet: 1) process_filters is called to identify the required filter to be processed (a filter is needed for each pid) 2) process_filter is then called for that specific filters which calls assemble_normal to get the data from potentially multiple packets which copies the data in a new buffer (f->data) 3) process_sdt/process_pmt is called with f->data 4) process_pmt calls clean_psi which seems to change f->data and not the original adapter data (which is then sent to the client).

Can u confirm clean_psi actually cleans the PMT ?

lars18th commented 2 years ago

Hi @catalinii ,

I frustrated with this: f->data seems to not be the original adapter data.

However, from my tests...

Can u confirm clean_psi actually cleans the PMT ?

in the PMT of the channels decrypted the Descriptor 0x09 (Conditional Access) continues on the table. Therefore it seems to not work.

Regards.

lars18th commented 1 year ago

Hi @catalinii ,

Because you removed the option of clean_psi... we will close this issue?

catalinii commented 1 year ago

Yeah I think is best.

They both (this issue and clean_psi)relies on rewriting the TS which can be done but it is a lot of duplication with DDCI.

lars18th commented 1 year ago

...which can be done but it is a lot of duplication with DDCI.

Can you explain this more, please?

catalinii commented 1 year ago

For example ddci_create_pmt is very similar to clean_psi_buffer except it adds also the CA information from pmt. But there are 3 main issues:

lars18th commented 1 year ago

not sure any client cares at this point

I agree. Only if we ever encounter any specific scenario where this is needed, then it will be useful to reincorporate it again.

Many thanks for continuing to maintain this wonderful project. Regards.