Revision 239dec21 libavformat/rdt.c

View differences:

libavformat/rdt.c
39 39
    AVStream *st;
40 40
    void *dynamic_protocol_context;
41 41
    DynamicPayloadPacketHandlerProc parse_packet;
42
    uint32_t prev_sn, prev_ts;
42
    uint32_t prev_set_id, prev_timestamp;
43 43
};
44 44

  
45 45
RDTDemuxContext *
......
52 52

  
53 53
    s->ic = ic;
54 54
    s->st = st;
55
    s->prev_sn = -1;
56
    s->prev_ts = -1;
55
    s->prev_set_id    = -1;
56
    s->prev_timestamp = -1;
57 57
    s->parse_packet = handler->parse_packet;
58 58
    s->dynamic_protocol_context = priv_data;
59 59

  
......
173 173

  
174 174
int
175 175
ff_rdt_parse_header(const uint8_t *buf, int len,
176
                    int *sn, int *seq, int *rn, uint32_t *ts)
176
                    int *set_id, int *seq_no, int *stream_id, uint32_t *timestamp)
177 177
{
178 178
    int consumed = 10;
179 179

  
......
235 235
     * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
236 236
     *     http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
237 237
     */
238
    if (sn)  *sn  = (buf[0]>>1) & 0x1f;
239
    if (seq) *seq = AV_RB16(buf+1);
240
    if (ts)  *ts  = AV_RB32(buf+4);
241
    if (rn)  *rn  = buf[3] & 0x3f;
238
    if (set_id)    *set_id    = (buf[0]>>1) & 0x1f;
239
    if (seq_no)    *seq_no    = AV_RB16(buf+1);
240
    if (timestamp) *timestamp = AV_RB32(buf+4);
241
    if (stream_id) *stream_id = buf[3] & 0x3f;
242 242

  
243 243
    return consumed;
244 244
}
......
287 287
ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
288 288
                    const uint8_t *buf, int len)
289 289
{
290
    int seq, flags = 0, rule, sn;
290
    int seq_no, flags = 0, stream_id, set_id;
291 291
    uint32_t timestamp;
292 292
    int rv= 0;
293 293

  
......
304 304

  
305 305
    if (len < 12)
306 306
        return -1;
307
    rv = ff_rdt_parse_header(buf, len, &sn, &seq, &rule, &timestamp);
307
    rv = ff_rdt_parse_header(buf, len, &set_id, &seq_no, &stream_id, &timestamp);
308 308
    if (rv < 0)
309 309
        return rv;
310
    if (!(rule & 1) && (sn != s->prev_sn || timestamp != s->prev_ts)) {
310
    if (!(stream_id & 1) && (set_id != s->prev_set_id || timestamp != s->prev_timestamp)) {
311 311
        flags |= PKT_FLAG_KEY;
312
        s->prev_sn = sn;
313
        s->prev_ts = timestamp;
312
        s->prev_set_id    = set_id;
313
        s->prev_timestamp = timestamp;
314 314
    }
315 315
    buf += rv;
316 316
    len -= rv;

Also available in: Unified diff