rtpenc: HEVC/H.265 support
[ffmpeg.git] / libavformat / rtpenc.c
index 9c587d2dc5d11f054f1be435d8458bd04a19a040..dfaccef2e290f03d5758de06b5816b8614a358a8 100644 (file)
@@ -53,6 +53,7 @@ static int is_supported(enum AVCodecID id)
     case AV_CODEC_ID_H263:
     case AV_CODEC_ID_H263P:
     case AV_CODEC_ID_H264:
+    case AV_CODEC_ID_HEVC:
     case AV_CODEC_ID_MPEG1VIDEO:
     case AV_CODEC_ID_MPEG2VIDEO:
     case AV_CODEC_ID_MPEG4:
@@ -200,6 +201,13 @@ static int rtp_write_header(AVFormatContext *s1)
             s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
         }
         break;
+    case AV_CODEC_ID_HEVC:
+        if (st->codec->extradata_size > 21 &&
+            (st->codec->extradata[0] || st->codec->extradata[1] ||
+             st->codec->extradata[2] > 1)) {
+            s->nal_length_size = (st->codec->extradata[21] & 0x03) + 1;
+        }
+        break;
     case AV_CODEC_ID_VORBIS:
     case AV_CODEC_ID_THEORA:
         if (!s->max_frames_per_packet) s->max_frames_per_packet = 15;
@@ -577,6 +585,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
     case AV_CODEC_ID_H263P:
         ff_rtp_send_h263(s1, pkt->data, size);
         break;
+    case AV_CODEC_ID_HEVC:
+        ff_rtp_send_hevc(s1, pkt->data, size);
+        break;
     case AV_CODEC_ID_VORBIS:
     case AV_CODEC_ID_THEORA:
         ff_rtp_send_xiph(s1, pkt->data, size);