X Tutup
Skip to content

VIDEO: Correctly handle raw Elementary Stream MPEG Videos#6496

Merged
bluegr merged 5 commits intoscummvm:masterfrom
malharbadve:mpegps_decoder
Mar 23, 2025
Merged

VIDEO: Correctly handle raw Elementary Stream MPEG Videos#6496
bluegr merged 5 commits intoscummvm:masterfrom
malharbadve:mpegps_decoder

Conversation

@malharbadve
Copy link
Contributor

Recognize the type of the stream in .mpg files (ES or PS) In case of ES (Elementary Streams) bypass the PES header parsing process and directly feed the MPEG decoder the raw data. Remove warning that appears when opening the ND
logo when opening the game 3mice1-pl

Changes made in how ES stream packets are pushed
in the _demuxer queue for decoding in function queueNextPacket Made sure that the ES stream is handled in
the MPEGPSDecoder::MPEGPSDemuxer class entirely

Recognize the type of the stream in .mpg files (ES or PS)
In case of ES (Elementary Streams) bypass the PES header
parsing process and directly feed the MPEG decoder the raw data.
Remove warning that appears when opening the ND
logo when opening the game 3mice1-pl

Changes made in how ES stream packets are pushed
in the _demuxer queue for decoding in function queueNextPacket
Made sure that the ES stream is handled in
the MPEGPSDecoder::MPEGPSDemuxer class entirely
@lephilousophe
Copy link
Member

This new PR doesn't seem to take my comments of #6491 into account.

Recognize the type of the stream in .mpg files (ES or PS) In case of ES (Elementary Streams) bypass the PES header parsing process and directly feed the MPEG decoder the raw data. Remove warning that appears when opening the ND
logo when opening the game 3mice1-pl

Changes made in how ES stream packets are pushed
in the _demuxer queue for decoding in function queueNextPacket Made sure that the ES stream is handled in
the MPEGPSDecoder::MPEGPSDemuxer class entirely
@malharbadve
Copy link
Contributor Author

I'm sorry, I must have made a mistake, I've resolved it

stream->seek(startPosition);

// If it is a Sequence Header (ES Stream), pass the stream to a Elementary Stream handler.
if (header == kStartCodeSequenceHeader)
Copy link
Member

Choose a reason for hiding this comment

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

Please use curly braces even if the if block only has one line.
In addition, you have to set _isESStream value even when the start code is not recognised (to false I would say).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep got it
And I'm sorry, I should realize this before pushing

Copy link
Member

Choose a reason for hiding this comment

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

Now, you are not following our code formatting conventions (hugging braces). :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Hopefully, this time...

Add curly braces for one line if statements
Set the value of _isEstream to false if stream
is not recognized.
Fixed the part not following the coding convention.
// ES streams start with the Sequence Header which has a start code of 0x1b3
int64 startPosition = stream->pos();
uint32 header = stream->readUint32BE();
stream->seek(startPosition);
Copy link
Member

Choose a reason for hiding this comment

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

You already know that you've read 4 bytes above. So, you can remove startPosition and simplify the seek as follows:

stream->seek(-4, SEEK_CUR);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right, got it

@sev-
Copy link
Member

sev- commented Mar 23, 2025

Why the previous PR was closed?

Simplified the code for reading the first four bytes of the
stream in queueNextPacket for header checking
@bluegr
Copy link
Member

bluegr commented Mar 23, 2025

Thanks for your work! Looks good now, squashing

@bluegr bluegr merged commit 73afe02 into scummvm:master Mar 23, 2025
8 checks passed
@sev-
Copy link
Member

sev- commented Mar 26, 2025

This is so annoying. I see that it is a THIRD PR on the same issue, the previous two were closed by the author for no reason.

@sev- sev- added the GSoC Part of a Google Summer of Code project label Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Part of a Google Summer of Code project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup