comparison mlp_parser.c @ 7557:8813c715eb9d libavcodec

mlp_parser: Initialize crc data in its own function.
author ramiro
date Wed, 13 Aug 2008 02:44:38 +0000
parents ae8c047d6be5
children fd24c8628221
comparison
equal deleted inserted replaced
7556:a8ddede2248f 7557:8813c715eb9d
75 75
76 static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size) 76 static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
77 { 77 {
78 uint16_t crc; 78 uint16_t crc;
79 79
80 crc = av_crc(crc_2D, 0, buf, buf_size - 2);
81 crc ^= AV_RL16(buf + buf_size - 2);
82 return crc;
83 }
84
85 static int av_cold mlp_parse_init(AVCodecParserContext *s)
86 {
80 if (!crc_init) { 87 if (!crc_init) {
81 av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D)); 88 av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
82 crc_init = 1; 89 crc_init = 1;
83 } 90 }
84 91
85 crc = av_crc(crc_2D, 0, buf, buf_size - 2); 92 return 0;
86 crc ^= AV_RL16(buf + buf_size - 2);
87 return crc;
88 } 93 }
89 94
90 /** Read a major sync info header - contains high level information about 95 /** Read a major sync info header - contains high level information about
91 * the stream - sample rate, channel arrangement etc. Most of this 96 * the stream - sample rate, channel arrangement etc. Most of this
92 * information is not actually necessary for decoding, only for playback. 97 * information is not actually necessary for decoding, only for playback.
303 } 308 }
304 309
305 AVCodecParser mlp_parser = { 310 AVCodecParser mlp_parser = {
306 { CODEC_ID_MLP }, 311 { CODEC_ID_MLP },
307 sizeof(MLPParseContext), 312 sizeof(MLPParseContext),
308 NULL, 313 mlp_parse_init,
309 mlp_parse, 314 mlp_parse,
310 NULL, 315 NULL,
311 }; 316 };