diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/BitstreamWriter.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/BitstreamWriter.h')
| -rw-r--r-- | xbmc/utils/BitstreamWriter.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/xbmc/utils/BitstreamWriter.h b/xbmc/utils/BitstreamWriter.h new file mode 100644 index 0000000..91257b2 --- /dev/null +++ b/xbmc/utils/BitstreamWriter.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2017-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include <stdint.h> | ||
| 12 | |||
| 13 | class CBitstreamWriter | ||
| 14 | { | ||
| 15 | public: | ||
| 16 | CBitstreamWriter(uint8_t *buffer, unsigned int buffer_size, int writer_le); | ||
| 17 | void WriteBits(int n, unsigned int value); | ||
| 18 | void SkipBits(int n); | ||
| 19 | void FlushBits(); | ||
| 20 | |||
| 21 | private: | ||
| 22 | int writer_le; | ||
| 23 | uint32_t bit_buf; | ||
| 24 | int bit_left; | ||
| 25 | uint8_t *buf, *buf_ptr; | ||
| 26 | }; | ||
| 27 | |||
| 28 | //////////////////////////////////////////////////////////////////////////////////////////// | ||
| 29 | //! @todo refactor this so as not to need these ffmpeg routines. | ||
| 30 | //! These are not exposed in ffmpeg's API so we dupe them here. | ||
| 31 | |||
| 32 | /* | ||
| 33 | * AVC helper functions for muxers | ||
| 34 | * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@smartjog.com> | ||
| 35 | * This is part of FFmpeg | ||
| 36 | * | ||
| 37 | * SPDX-License-Identifier: LGPL-2.1-or-later | ||
| 38 | * See LICENSES/README.md for more information. | ||
| 39 | */ | ||
| 40 | #define BS_WB32(p, d) { \ | ||
| 41 | ((uint8_t*)(p))[3] = (d); \ | ||
| 42 | ((uint8_t*)(p))[2] = (d) >> 8; \ | ||
| 43 | ((uint8_t*)(p))[1] = (d) >> 16; \ | ||
| 44 | ((uint8_t*)(p))[0] = (d) >> 24; } | ||
| 45 | |||
| 46 | #define BS_WL32(p, d) { \ | ||
| 47 | ((uint8_t*)(p))[0] = (d); \ | ||
| 48 | ((uint8_t*)(p))[1] = (d) >> 8; \ | ||
| 49 | ((uint8_t*)(p))[2] = (d) >> 16; \ | ||
| 50 | ((uint8_t*)(p))[3] = (d) >> 24; } | ||
