Skip to content

Conversation

@steel-bucket
Copy link
Contributor

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

This PR ports the entire es_functions.c and es_userdata.c files to Rust.
Tested on This sample

}

if esstream.bits_left < 0 {
esstream.init_bitstream(gop_info_start_pos, gop_info_start_bpos as usize)?;
Copy link
Member

@prateekmedia prateekmedia Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be this? I think this has wrong parameters:
esstream.init_bitstream(gop_info_start_pos, esstream.data.len())?;
esstream.bpos = gop_info_start_bpos;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this was a mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

let hi = cc_data[1] & 0x7F; // Get rid of parity bit
let lo = cc_data[2] & 0x7F; // Get rid of parity bit
if hi >= 0x20 {
output = format!("{}{}", hi as char, if lo >= 20 { lo as char } else { '.' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the lo >= 20 correct or should it be lo >= 0x20?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same in C, so I guess it's fine.

	if (cc_valid && cc_type == channel)
	{
		hi = cc_data[1] & 0x7F; // Get rid of parity bit
		lo = cc_data[2] & 0x7F; // Get rid of parity bit
		if (hi >= 0x20)
		{
			output[0] = hi;
			output[1] = (lo >= 20 ? lo : '.'); // here
			output[2] = '\x00';
		}
		else
		{
			output[0] = '<';
			output[1] = '>';
			output[2] = '\x00';
		}
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I make it 0x20?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, make it 0x20 for both versions, since ASCII printable characters starts at 0x20 and not 20.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link
Member

@prateekmedia prateekmedia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit ba59eb0...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

All tests passing on the master branch were passed completely.

Check the result page for more info.

@prateekmedia prateekmedia merged commit c2a1f0d into CCExtractor:master Sep 6, 2025
16 of 18 checks passed
@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 12a27f3...:
Report Name Tests Passed
Broken 13/13
CEA-708 14/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 86/86
Teletext 21/21
WTV 13/13
XDS 34/34

All tests passing on the master branch were passed completely.

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants