Commit 519e401a authored by ramiro's avatar ramiro

mlp_parser: Initialize crc data in its own function.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14722 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 280ac083
...@@ -77,14 +77,19 @@ static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size) ...@@ -77,14 +77,19 @@ static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
{ {
uint16_t crc; uint16_t crc;
crc = av_crc(crc_2D, 0, buf, buf_size - 2);
crc ^= AV_RL16(buf + buf_size - 2);
return crc;
}
static int av_cold mlp_parse_init(AVCodecParserContext *s)
{
if (!crc_init) { if (!crc_init) {
av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D)); av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
crc_init = 1; crc_init = 1;
} }
crc = av_crc(crc_2D, 0, buf, buf_size - 2); return 0;
crc ^= AV_RL16(buf + buf_size - 2);
return crc;
} }
/** Read a major sync info header - contains high level information about /** Read a major sync info header - contains high level information about
...@@ -305,7 +310,7 @@ lost_sync: ...@@ -305,7 +310,7 @@ lost_sync:
AVCodecParser mlp_parser = { AVCodecParser mlp_parser = {
{ CODEC_ID_MLP }, { CODEC_ID_MLP },
sizeof(MLPParseContext), sizeof(MLPParseContext),
NULL, mlp_parse_init,
mlp_parse, mlp_parse,
NULL, NULL,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment