[SCM] libav/experimental: experimental mpeg4 video support (currently no slice/timestamp handling)

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:34:21 UTC 2013


The following commit has been merged in the experimental branch:
commit 65e70450de4bb3dc19474cf08573fe178bd56719
Author: Fabrice Bellard <fabrice at bellard.org>
Date:   Wed Nov 20 20:53:32 2002 +0000

    experimental mpeg4 video support (currently no slice/timestamp handling)
    
    Originally committed as revision 1264 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libav/rtp.c b/libav/rtp.c
index 714787c..f36da6d 100644
--- a/libav/rtp.c
+++ b/libav/rtp.c
@@ -85,6 +85,7 @@ enum RTPPayloadType {
     RTP_PT_MPEGVIDEO = 32,
     RTP_PT_MPEG2TS = 33,
     RTP_PT_H263 = 34, /* old H263 encapsulation */
+    RTP_PT_PRIVATE = 96,
 };
 
 typedef struct RTPContext {
@@ -358,7 +359,7 @@ static int rtp_write_header(AVFormatContext *s1)
 
     payload_type = rtp_get_payload_type(&st->codec);
     if (payload_type < 0)
-        return -1;
+        payload_type = RTP_PT_PRIVATE; /* private payload type */
     s->payload_type = payload_type;
 
     s->base_timestamp = random();
@@ -570,6 +571,32 @@ static void rtp_send_mpegvideo(AVFormatContext *s1,
     s->cur_timestamp++;
 }
 
+static void rtp_send_raw(AVFormatContext *s1,
+                         UINT8 *buf1, int size)
+{
+    RTPContext *s = s1->priv_data;
+    AVStream *st = s1->streams[0];
+    int len, max_packet_size;
+
+    max_packet_size = s->max_payload_size;
+
+    while (size > 0) {
+        len = max_packet_size;
+        if (len > size)
+            len = size;
+
+        /* 90 KHz time stamp */
+        /* XXX: overflow */
+        s->timestamp = s->base_timestamp + 
+            (s->cur_timestamp * 90000LL * FRAME_RATE_BASE) / st->codec.frame_rate;
+        rtp_send_data(s1, buf1, len);
+
+        buf1 += len;
+        size -= len;
+    }
+    s->cur_timestamp++;
+}
+
 /* write an RTP packet. 'buf1' must contain a single specific frame. */
 static int rtp_write_packet(AVFormatContext *s1, int stream_index,
                             UINT8 *buf1, int size, int force_pts)
@@ -615,7 +642,9 @@ static int rtp_write_packet(AVFormatContext *s1, int stream_index,
         rtp_send_mpegvideo(s1, buf1, size);
         break;
     default:
-        return AVERROR_IO;
+        /* better than nothing : send the codec raw data */
+        rtp_send_raw(s1, buf1, size);
+        break;
     }
     return 0;
 }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list