1 /* 2 * Copyright (c) 2011-2012 - Mauro Carvalho Chehab 3 * Copyright (c) 2012-2014 - Andre Roth <neolynx@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation version 2.1 of the License. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 18 * 19 */ 20 21 /** 22 * @file crc32.h 23 * @ingroup ancillary 24 * @brief Provides ancillary code to calculate DVB crc32 checksum 25 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 26 * @author Mauro Carvalho Chehab 27 * @author Andre Roth 28 * 29 * @par Bug Report 30 * Please submit bug reports and patches to linux-media@vger.kernel.org 31 */ 32 33 #ifndef _CRC32_H 34 #define _CRC32_H 35 36 #include <stdint.h> 37 #include <unistd.h> /* size_t */ 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /** @brief Calculates the crc-32 as defined at the MPEG-TS specs 44 * @ingroup ancillary 45 * 46 * @param data Pointer to the buffer to be checked 47 * @param datalen Length of the buffer 48 * @param crc Initial value for the crc checksum. To calculate the 49 * checksum of the entire packet at once, use 0xFFFFFFFF 50 */ 51 uint32_t dvb_crc32(uint8_t *data, size_t datalen, uint32_t crc); 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #endif 58 59