aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2021-11-24 19:14:17 +0800
committerLimin Wang <lance.lmwang@gmail.com>2021-11-25 15:07:19 +0800
commit522f577d7eca66c65aece841610cb008a10c1a2e (patch)
tree855733e6fdd3a61682f73d2629ffbf02685f3bcb
parent7b55f95f71559b2e76bdc6e7d6dcf12b3b5a8677 (diff)
downloadffmpeg-522f577d7eca66c65aece841610cb008a10c1a2e.tar.gz
avformat/rtp: support RGB/BGR for rfc4175
Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
-rw-r--r--libavformat/rtpdec_rfc4175.c20
-rw-r--r--libavformat/rtpenc_rfc4175.c8
-rw-r--r--libavformat/sdp.c6
3 files changed, 34 insertions, 0 deletions
diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index 5a7058bc14..7feefd2fff 100644
--- a/libavformat/rtpdec_rfc4175.c
+++ b/libavformat/rtpdec_rfc4175.c
@@ -74,6 +74,26 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data)
} else {
return AVERROR_INVALIDDATA;
}
+ } else if (!strncmp(data->sampling, "RGB", 3)) {
+ tag = MKTAG('R', 'G', 'B', 24);
+ if (data->depth == 8) {
+ data->xinc = 1;
+ data->pgroup = 3;
+ pixfmt = AV_PIX_FMT_RGB24;
+ stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ } else {
+ return AVERROR_INVALIDDATA;
+ }
+ } else if (!strncmp(data->sampling, "BGR", 3)) {
+ tag = MKTAG('B', 'G', 'R', 24);
+ if (data->depth == 8) {
+ data->xinc = 1;
+ data->pgroup = 3;
+ pixfmt = AV_PIX_FMT_BGR24;
+ stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ } else {
+ return AVERROR_INVALIDDATA;
+ }
} else {
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c
index 4623b4ac23..ea4c3705f3 100644
--- a/libavformat/rtpenc_rfc4175.c
+++ b/libavformat/rtpenc_rfc4175.c
@@ -45,6 +45,14 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size)
xinc = yinc = 4;
pgroup = 6;
break;
+ case AV_PIX_FMT_RGB24:
+ xinc = yinc = 1;
+ pgroup = 3;
+ break;
+ case AV_PIX_FMT_BGR24:
+ xinc = yinc = 1;
+ pgroup = 3;
+ break;
default:
return;
}
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 5ad2a54474..a41c2cf655 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -676,6 +676,12 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int
case AV_PIX_FMT_YUV420P:
pix_fmt = "YCbCr-4:2:0";
break;
+ case AV_PIX_FMT_RGB24:
+ pix_fmt = "RGB";
+ break;
+ case AV_PIX_FMT_BGR24:
+ pix_fmt = "BGR";
+ break;
default:
av_log(fmt, AV_LOG_ERROR, "Unsupported pixel format.\n");
return NULL;