crc32.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation version 2
  8. * of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. *
  20. */
  21. /**
  22. * @file crc32.h
  23. * @ingroup ancillary
  24. * @brief Provides ancillary code to calculate DVB crc32 checksum
  25. * @copyright GNU General Public License version 2 (GPLv2)
  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. #ifndef _CRC32_H
  33. #define _CRC32_H
  34. #include <stdint.h>
  35. #include <unistd.h> /* size_t */
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /** @brief Calculates the crc-32 as defined at the MPEG-TS specs
  40. * @ingroup ancillary
  41. *
  42. * @param data Pointer to the buffer to be checked
  43. * @param datalen Length of the buffer
  44. * @param crc Initial value for the crc checksum. To calculate the
  45. * checksum of the entire packet at once, use 0xFFFFFFFF
  46. */
  47. uint32_t dvb_crc32(uint8_t *data, size_t datalen, uint32_t crc);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif