EXIHeaderDecoder.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2007-2011 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  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. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*******************************************************************
  19. *
  20. * @author Daniel.Peintner.EXT@siemens.com
  21. * @version 2011-12-02
  22. * @contact Joerg.Heuer@siemens.com
  23. *
  24. * <p>Code generated by EXIdizer</p>
  25. ********************************************************************/
  26. #include "EXIHeaderDecoder.h"
  27. #include "BitInputStream.h"
  28. #include "DecoderChannel.h"
  29. #ifndef EXI_HEADER_DECODER_C
  30. #define EXI_HEADER_DECODER_C
  31. int readEXIHeader(bitstream_t* stream) {
  32. uint32_t header = 0;
  33. int errn = readBits(stream, 8, &header);
  34. if (errn < 0) {
  35. return errn;
  36. }
  37. if(header == '$') {
  38. /* we do not support "EXI Cookie" */
  39. errn = EXI_UNSUPPORTED_HEADER_COOKIE;
  40. } else if ( header & 0x20 ) {
  41. /* we do not support "Presence Bit for EXI Options" */
  42. errn = EXI_UNSUPPORTED_HEADER_OPTIONS;
  43. } else {
  44. /* Yes, a *simple* header */
  45. errn = 0;
  46. }
  47. return errn;
  48. }
  49. #endif