[FFmpeg-cvslog] rdt: Convert to the new bitstream reader

Alexandra Hájková git at videolan.org
Tue Apr 4 21:52:37 EEST 2017


ffmpeg | branch: master | Alexandra Hájková <alexandra at khirnov.net> | Sat Apr 16 17:58:30 2016 +0200| [2dbe2aa2c2d4f02d2669feae45dee4fc45414813] | committer: Diego Biurrun

rdt: Convert to the new bitstream reader

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2dbe2aa2c2d4f02d2669feae45dee4fc45414813
---

 libavformat/rdt.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index eb718cf..da5ff59 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -25,6 +25,8 @@
  * @author Ronald S. Bultje <rbultje at ronald.bitfreak.net>
  */
 
+#include "libavcodec/bitstream.h"
+
 #include "avformat.h"
 #include "libavutil/avstring.h"
 #include "rtpdec.h"
@@ -34,7 +36,6 @@
 #include "rm.h"
 #include "internal.h"
 #include "avio_internal.h"
-#include "libavcodec/get_bits.h"
 
 struct RDTDemuxContext {
     AVFormatContext *ic; /**< the containing (RTSP) demux context */
@@ -191,7 +192,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
                     int *pset_id, int *pseq_no, int *pstream_id,
                     int *pis_keyframe, uint32_t *ptimestamp)
 {
-    GetBitContext gb;
+    BitstreamContext bc;
     int consumed = 0, set_id, seq_no, stream_id, is_keyframe,
         len_included, need_reliable;
     uint32_t timestamp;
@@ -261,24 +262,24 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
      * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
      *     http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
      */
-    init_get_bits(&gb, buf, len << 3);
-    len_included  = get_bits1(&gb);
-    need_reliable = get_bits1(&gb);
-    set_id        = get_bits(&gb, 5);
-    skip_bits(&gb, 1);
-    seq_no        = get_bits(&gb, 16);
+    bitstream_init(&bc, buf, len << 3);
+    len_included  = bitstream_read_bit(&bc);
+    need_reliable = bitstream_read_bit(&bc);
+    set_id        = bitstream_read(&bc, 5);
+    bitstream_skip(&bc, 1);
+    seq_no        = bitstream_read(&bc, 16);
     if (len_included)
-        skip_bits(&gb, 16);
-    skip_bits(&gb, 2);
-    stream_id     = get_bits(&gb, 5);
-    is_keyframe   = !get_bits1(&gb);
-    timestamp     = get_bits_long(&gb, 32);
+        bitstream_skip(&bc, 16);
+    bitstream_skip(&bc, 2);
+    stream_id     = bitstream_read(&bc, 5);
+    is_keyframe   = !bitstream_read_bit(&bc);
+    timestamp     = bitstream_read(&bc, 32);
     if (set_id == 0x1f)
-        set_id    = get_bits(&gb, 16);
+        set_id    = bitstream_read(&bc, 16);
     if (need_reliable)
-        skip_bits(&gb, 16);
+        bitstream_skip(&bc, 16);
     if (stream_id == 0x1f)
-        stream_id = get_bits(&gb, 16);
+        stream_id = bitstream_read(&bc, 16);
 
     if (pset_id)      *pset_id      = set_id;
     if (pseq_no)      *pseq_no      = seq_no;
@@ -286,7 +287,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
     if (pis_keyframe) *pis_keyframe = is_keyframe;
     if (ptimestamp)   *ptimestamp   = timestamp;
 
-    return consumed + (get_bits_count(&gb) >> 3);
+    return consumed + (bitstream_tell(&bc) >> 3);
 }
 
 /**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */



More information about the ffmpeg-cvslog mailing list