diff mbox series

[FFmpeg-devel,v3,7/7] avformat/rtp: support for RGB/BGR for rfc4175

Message ID 1637767665-6777-7-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 522f577d7eca66c65aece841610cb008a10c1a2e
Headers show
Series [FFmpeg-devel,v3,1/7] avformat/rtpdec_rfc4175: use rawvideo for uyvy422 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Nov. 24, 2021, 3:27 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/rtpdec_rfc4175.c | 20 ++++++++++++++++++++
 libavformat/rtpenc_rfc4175.c |  8 ++++++++
 libavformat/sdp.c            |  6 ++++++
 3 files changed, 34 insertions(+)

Comments

Lynne Nov. 24, 2021, 3:49 p.m. UTC | #1
24 Nov 2021, 16:27 by lance.lmwang@gmail.com:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavformat/rtpdec_rfc4175.c | 20 ++++++++++++++++++++
>  libavformat/rtpenc_rfc4175.c |  8 ++++++++
>  libavformat/sdp.c            |  6 ++++++
>  3 files changed, 34 insertions(+)
>

Much better, thanks.
Patchset looks good to me now.
Lance Wang Nov. 25, 2021, 10:40 a.m. UTC | #2
On Wed, Nov 24, 2021 at 04:49:18PM +0100, Lynne wrote:
> 24 Nov 2021, 16:27 by lance.lmwang@gmail.com:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavformat/rtpdec_rfc4175.c | 20 ++++++++++++++++++++
> >  libavformat/rtpenc_rfc4175.c |  8 ++++++++
> >  libavformat/sdp.c            |  6 ++++++
> >  3 files changed, 34 insertions(+)
> >
> 
> Much better, thanks.
> Patchset looks good to me now.

thanks, have pushed the patchset.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c
index 5a7058b..7feefd2 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 4623b4a..ea4c370 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 5ad2a54..a41c2cf 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;