mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1528] [FIX] Incorrect skipping of packets #2250
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1528
State: closed
Merged: Yes
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Partially Fixes #1468
The reason why none of the text was showing up was because the given sample had service blocks of this kind:
80 ff 8c ff 9c 18 46 19 00 1f 11 84 92 00 04 90 05 00 91 2a 00 0080- Set Current Window to 0 - Does nothing since Window was never defined before.ff- character from G1 charset - The current implementation skips the entire packet if character is attempted to be inserted in an undefined window, which it was during this point.8c ff- Delete Windows specified with bitmapff- Does nothing since no windows were defined in the first place.9c ...- Define Window 4 - Here comes the actual definition of the window that will contain all the text but this is never executed due to the second byte (ff).All the window definitions followed the above pattern, hence a window was never defined, so all the text did not show up.
After fixing the implementation to only skip 1 character instead of entire packet, the following text was extracted:
Only the first line is skipped because the packet stream literally started from
This is a demo of the. Definition of Window 4 only came later. We could fix it by defining all windows before hand but that will against the CEA-708 spec.This was enough to get it fixed at the Rust side. The C side required more work.
The given sample file had packets of invalid length specified. The current implementation assumes the given packet length is valid. If the specified length is more than the actual length, it just keeps appending the content of the next packet too. (Here the actual length is till the next Packet Start). This problem was fixed by clearing the packet before the start of a new packet if it was not cleared previously. Hence this would skip the packets of invalid length.
Even though this error was not visible in Rust, I have still ported the code for parity's sake. The code at Rust side was able to clear the packet correctly even before this. I still haven't figured out how. Some help on this would be great.
Also, it is debatable if packets of invalid length should be processed or skipped. For now, I have chosen to skip them but they could very well be processed since such packets in the sample file had service number 0. Some advice on this will be very helpful.