[FFmpeg-devel] [PATCH]lavc/opus_rc: Case a const pointer to uint8_t *
Carl Eugen Hoyos
ceffmpeg at gmail.com
Mon Dec 17 03:47:29 EET 2018
Hi!
The Opus struct RawBitsContext is used in both the decoder and the encoder.
The fact that *position is const avoids warnings in the decoder where
it points into the bitstream. The encoder writes into the same
pointer, attached cast silences the warning on targets where AV_WB32()
does not internally cast the qualifier away.
It is also possible to use a union if anybody prefers this:
diff --git a/libavcodec/opus_rc.h b/libavcodec/opus_rc.h
index 627f832..baad4ce 100644
--- a/libavcodec/opus_rc.h
+++ b/libavcodec/opus_rc.h
@@ -37,9 +37,19 @@ typedef struct RawBitsContext {
uint32_t cacheval;
} RawBitsContext;
+typedef struct RawBitsEncContext {
+ uint8_t *position;
+ uint32_t bytes;
+ uint32_t cachelen;
+ uint32_t cacheval;
+} RawBitsEncContext;
+
typedef struct OpusRangeCoder {
GetBitContext gb;
- RawBitsContext rb;
+ union {
+ RawBitsContext rb;
+ RawBitsEncContext rbe;
+ };
uint32_t range;
uint32_t value;
uint32_t total_bits;
and use rbe in ff_opus_rc_put_raw().
Please comment, Carl Eugen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-opus_rc-Cast-a-const-pointer-to-uint8_t.patch
Type: text/x-patch
Size: 1055 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181217/eb5f096b/attachment.bin>
More information about the ffmpeg-devel
mailing list