[FFmpeg-devel] RTSP marker-bit packet merging

Ronald S. Bultje rsbultje
Mon Jan 26 00:33:42 CET 2009


I've seen in several (QDM2, SV3V, X-QT and UDP RTSP/ASF) cases that
there is a reuse of packet merging code where packet data (minus some
small header) is merged and finished when the marker bit is set. Is it
OK if I add some generic code to rtpdec.c to handle this? It would
look like this:

struct RTPMergePacketStruct {
 char *buf;
 int pos;
+ function decl

/** return 0 on full packet and 1 on incomplete packet */
int rtp_merge_packet_data(struct RTPMergePacketStruct *bla, AVPacket
*pkt, char *buf, int len, int *flags)
    if (bla->pos == 0)
        bla->buf = av_malloc(len);
        bla->buf = av_realloc(bla->buf, bla->pos + len);
    if (!bla->buf)
        return AVERROR(ENOMEM);
    memcpy(bla->buf + bla->pos, buf, len);
    bla->pos += len;

    if (*flags & RTP_FLAG_MARKER) {
        pkt->data = bla->buf;
        pkt->len = bla->pos;
        bla->pos = 0;
        pkt->flags = *flags & 0x1; //keyframe flag
        return 0;
    return 1;

This is probably more pseudo-code than anything else, just wanted to
see if this was OK.


More information about the ffmpeg-devel mailing list