Commit 2dbe2aa2 authored by Alexandra Hájková's avatar Alexandra Hájková Committed by Diego Biurrun

rdt: Convert to the new bitstream reader

parent 2cef81a8
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* @author Ronald S. Bultje <rbultje@ronald.bitfreak.net> * @author Ronald S. Bultje <rbultje@ronald.bitfreak.net>
*/ */
#include "libavcodec/bitstream.h"
#include "avformat.h" #include "avformat.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "rtpdec.h" #include "rtpdec.h"
...@@ -34,7 +36,6 @@ ...@@ -34,7 +36,6 @@
#include "rm.h" #include "rm.h"
#include "internal.h" #include "internal.h"
#include "avio_internal.h" #include "avio_internal.h"
#include "libavcodec/get_bits.h"
struct RDTDemuxContext { struct RDTDemuxContext {
AVFormatContext *ic; /**< the containing (RTSP) demux context */ AVFormatContext *ic; /**< the containing (RTSP) demux context */
...@@ -191,7 +192,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len, ...@@ -191,7 +192,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
int *pset_id, int *pseq_no, int *pstream_id, int *pset_id, int *pseq_no, int *pstream_id,
int *pis_keyframe, uint32_t *ptimestamp) int *pis_keyframe, uint32_t *ptimestamp)
{ {
GetBitContext gb; BitstreamContext bc;
int consumed = 0, set_id, seq_no, stream_id, is_keyframe, int consumed = 0, set_id, seq_no, stream_id, is_keyframe,
len_included, need_reliable; len_included, need_reliable;
uint32_t timestamp; uint32_t timestamp;
...@@ -261,24 +262,24 @@ ff_rdt_parse_header(const uint8_t *buf, int len, ...@@ -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 * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
* http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c * http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
*/ */
init_get_bits(&gb, buf, len << 3); bitstream_init(&bc, buf, len << 3);
len_included = get_bits1(&gb); len_included = bitstream_read_bit(&bc);
need_reliable = get_bits1(&gb); need_reliable = bitstream_read_bit(&bc);
set_id = get_bits(&gb, 5); set_id = bitstream_read(&bc, 5);
skip_bits(&gb, 1); bitstream_skip(&bc, 1);
seq_no = get_bits(&gb, 16); seq_no = bitstream_read(&bc, 16);
if (len_included) if (len_included)
skip_bits(&gb, 16); bitstream_skip(&bc, 16);
skip_bits(&gb, 2); bitstream_skip(&bc, 2);
stream_id = get_bits(&gb, 5); stream_id = bitstream_read(&bc, 5);
is_keyframe = !get_bits1(&gb); is_keyframe = !bitstream_read_bit(&bc);
timestamp = get_bits_long(&gb, 32); timestamp = bitstream_read(&bc, 32);
if (set_id == 0x1f) if (set_id == 0x1f)
set_id = get_bits(&gb, 16); set_id = bitstream_read(&bc, 16);
if (need_reliable) if (need_reliable)
skip_bits(&gb, 16); bitstream_skip(&bc, 16);
if (stream_id == 0x1f) if (stream_id == 0x1f)
stream_id = get_bits(&gb, 16); stream_id = bitstream_read(&bc, 16);
if (pset_id) *pset_id = set_id; if (pset_id) *pset_id = set_id;
if (pseq_no) *pseq_no = seq_no; if (pseq_no) *pseq_no = seq_no;
...@@ -286,7 +287,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len, ...@@ -286,7 +287,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
if (pis_keyframe) *pis_keyframe = is_keyframe; if (pis_keyframe) *pis_keyframe = is_keyframe;
if (ptimestamp) *ptimestamp = timestamp; 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... */ /**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment