Fix the codec version string for MPEG-4 codecs: if it indicates "DivX packed bitstream" then change it to not say "packed bitstream" anymore.

This commit is contained in:
Moritz Bunkus 2005-06-16 14:01:14 +00:00
parent 6a8e29fd18
commit d809e013f7
3 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2005-06-16 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fixes: Improved the native MPEG-4 generation a lot
(thanks to Haali for testing and pushing me). The codec version
string inside the MPEG-4 initialization data is now checked if it
indicates "DivX packed bitstream" and changed to not indicate it
anymore.
2005-06-07 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: If mmg was minimized when it was closed (e.g. with

View File

@ -353,6 +353,7 @@ mpeg4_p2_video_packetizer_c::process_non_native(packet_cptr packet) {
ti.private_data = config_data->grab();
ti.private_size = config_data->size;
delete config_data;
fix_codec_string();
set_codec_private(ti.private_data, ti.private_size);
rerender_track_headers();
@ -404,6 +405,40 @@ mpeg4_p2_video_packetizer_c::process_non_native(packet_cptr packet) {
return FILE_STATUS_MOREDATA;
}
void
mpeg4_p2_video_packetizer_c::fix_codec_string() {
static const unsigned char start_code[4] = {0x00, 0x00, 0x01, 0xb2};
unsigned char *end_pos;
int i, size;
if ((NULL == ti.private_data) || (0 == ti.private_size))
return;
size = ti.private_size;
for (i = 0; 9 < size;) {
if (memcmp(&ti.private_data[i], start_code, 4) != 0) {
++i;
--size;
continue;
}
i += 8;
size -= 8;
if (strncasecmp((const char *)&ti.private_data[i - 4], "divx", 4) != 0)
continue;
end_pos = (unsigned char *)memchr(&ti.private_data[i], 0, size);
if (NULL == end_pos)
end_pos = &ti.private_data[i + size];
--end_pos;
if ('p' == *end_pos)
*end_pos = 'n';
return;
}
}
int
mpeg4_p2_video_packetizer_c::process_native(packet_cptr packet) {
// Not implemented yet.

View File

@ -95,6 +95,7 @@ protected:
virtual void flush_frames_maybe(frame_type_e next_frame);
virtual void flush_frames();
virtual void extract_aspect_ratio(const unsigned char *buffer, int size);
virtual void fix_codec_string();
};
class mpeg4_p10_video_packetizer_c: public video_packetizer_c {