summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc_jpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-28 12:39:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-28 12:40:01 +0200
commit823ea19a74ef69a71ca4d228c1664f60c4249b50 (patch)
tree11595929052a00f3435d7ebfc845d572d0e7c951 /libavformat/rtpenc_jpeg.c
parente925a82e2478adfbfb17813729ed8e68cf9c7120 (diff)
parent39975acc699c83af0a87a7318c0f41e189142938 (diff)
downloadffmpeg-823ea19a74ef69a71ca4d228c1664f60c4249b50.tar.gz
Merge commit '39975acc699c83af0a87a7318c0f41e189142938'
* commit '39975acc699c83af0a87a7318c0f41e189142938': rtpenc_jpeg: check for color_range too Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpenc_jpeg.c')
-rw-r--r--libavformat/rtpenc_jpeg.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 7eb0e23c6f..c35332953c 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -29,7 +29,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
RTPMuxContext *s = s1->priv_data;
const uint8_t *qtables = NULL;
int nb_qtables = 0;
- uint8_t type = 1; /* default pixel format is AV_PIX_FMT_YUVJ420P */
+ uint8_t type;
uint8_t w, h;
uint8_t *p;
int off = 0; /* fragment offset of the current JPEG frame */
@@ -43,10 +43,14 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
w = s1->streams[0]->codec->width >> 3;
h = s1->streams[0]->codec->height >> 3;
- /* check if pixel format is not the normal 420 case */
- if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) {
+ /* get the pixel format type or fail */
+ if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P ||
+ (s1->streams[0]->codec->color_range == AVCOL_RANGE_JPEG &&
+ s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUV422P)) {
type = 0;
- } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) {
+ } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P ||
+ (s1->streams[0]->codec->color_range == AVCOL_RANGE_JPEG &&
+ s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUV420P)) {
type = 1;
} else {
av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n");