summaryrefslogtreecommitdiff
path: root/libavcodec/mlp_parser.c
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2008-08-13 02:44:38 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2008-08-13 02:44:38 +0000
commitee5b34d56e7fa9c1eb1a2aeb2bf7b55516c99c8a (patch)
treec5ecb3508358cdfcf570209723bc2295f622eca8 /libavcodec/mlp_parser.c
parent5dae0dd22c594714c0e0b0fbbd6171045f739e43 (diff)
mlp_parser: Initialize crc data in its own function.
Originally committed as revision 14722 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlp_parser.c')
-rw-r--r--libavcodec/mlp_parser.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 646442bf03..7668857d70 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -77,14 +77,19 @@ static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
{
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) {
av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
crc_init = 1;
}
- crc = av_crc(crc_2D, 0, buf, buf_size - 2);
- crc ^= AV_RL16(buf + buf_size - 2);
- return crc;
+ return 0;
}
/** Read a major sync info header - contains high level information about
@@ -305,7 +310,7 @@ lost_sync:
AVCodecParser mlp_parser = {
{ CODEC_ID_MLP },
sizeof(MLPParseContext),
- NULL,
+ mlp_parse_init,
mlp_parse,
NULL,
};