]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtp.c
Add mipsel architecture that differs from mips in endianness.
[ffmpeg] / libavformat / rtp.c
index 439fd6d3f8e62e1494c018a908b409cf1f5edb7f..e42cfb16d47df1172cfa46da22f39c281b8a99c7 100644 (file)
@@ -222,24 +222,14 @@ int rtp_get_payload_type(AVCodecContext *codec)
     return payload_type;
 }
 
-static inline uint32_t decode_be32(const uint8_t *p)
-{
-    return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
-}
-
-static inline uint64_t decode_be64(const uint8_t *p)
-{
-    return ((uint64_t)decode_be32(p) << 32) | decode_be32(p + 4);
-}
-
 static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
 {
     if (buf[1] != 200)
         return -1;
-    s->last_rtcp_ntp_time = decode_be64(buf + 8);
+    s->last_rtcp_ntp_time = AV_RB64(buf + 8);
     if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
         s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
-    s->last_rtcp_timestamp = decode_be32(buf + 16);
+    s->last_rtcp_timestamp = AV_RB32(buf + 16);
     return 0;
 }
 
@@ -469,7 +459,7 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r
         case CODEC_ID_MP3:
         case CODEC_ID_MPEG4:
         case CODEC_ID_H264:
-            st->need_parsing = 1;
+            st->need_parsing = AVSTREAM_PARSE_FULL;
             break;
         default:
             break;
@@ -515,7 +505,7 @@ static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
 
     /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
-       In my test, the faad decoder doesnt behave correctly when sending each AU one by one
+       In my test, the FAAD decoder does not behave correctly when sending each AU one by one
        but does when sending the whole as one big packet...  */
     infos->au_headers[0].size = 0;
     infos->au_headers[0].index = 0;
@@ -613,9 +603,9 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
         return -1;
     }
     payload_type = buf[1] & 0x7f;
-    seq  = (buf[2] << 8) | buf[3];
-    timestamp = decode_be32(buf + 4);
-    ssrc = decode_be32(buf + 8);
+    seq  = AV_RB16(buf + 2);
+    timestamp = AV_RB32(buf + 4);
+    ssrc = AV_RB32(buf + 8);
     /* store the ssrc in the RTPDemuxContext */
     s->ssrc = ssrc;
 
@@ -654,7 +644,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
             /* better than nothing: skip mpeg audio RTP header */
             if (len <= 4)
                 return -1;
-            h = decode_be32(buf);
+            h = AV_RB32(buf);
             len -= 4;
             buf += 4;
             av_new_packet(pkt, len);
@@ -664,7 +654,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
             /* better than nothing: skip mpeg video RTP header */
             if (len <= 4)
                 return -1;
-            h = decode_be32(buf);
+            h = AV_RB32(buf);
             buf += 4;
             len -= 4;
             if (h & (1 << 26)) {
@@ -751,7 +741,7 @@ static int rtp_write_header(AVFormatContext *s1)
 
     max_packet_size = url_fget_max_packet_size(&s1->pb);
     if (max_packet_size <= 12)
-        return AVERROR_IO;
+        return AVERROR(EIO);
     s->max_payload_size = max_packet_size - 12;
 
     switch(st->codec->codec_id) {
@@ -1065,12 +1055,6 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
     return 0;
 }
 
-static int rtp_write_trailer(AVFormatContext *s1)
-{
-    //    RTPDemuxContext *s = s1->priv_data;
-    return 0;
-}
-
 AVOutputFormat rtp_muxer = {
     "rtp",
     "RTP output format",
@@ -1081,5 +1065,4 @@ AVOutputFormat rtp_muxer = {
     CODEC_ID_NONE,
     rtp_write_header,
     rtp_write_packet,
-    rtp_write_trailer,
 };