* commit '39975acc699c83af0a87a7318c0f41e189142938': rtpenc_jpeg: check for color_range too
Unified · Split
| @@ -29,7 +29,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) · 28 unmodified lines | |||
| 29 | RTPMuxContext *s = s1->priv_data; | 29 | RTPMuxContext *s = s1->priv_data; |
| 30 | const uint8_t *qtables = NULL; | 30 | const uint8_t *qtables = NULL; |
| 31 | int nb_qtables = 0; | 31 | int nb_qtables = 0; |
| 32 | uint8_t type = 1; /* default pixel format is AV_PIX_FMT_YUVJ420P */ | 32 | uint8_t type; |
| 33 | uint8_t w, h; | 33 | uint8_t w, h; |
| 34 | uint8_t *p; | 34 | uint8_t *p; |
| 35 | int off = 0; /* fragment offset of the current JPEG frame */ | 35 | 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) · 7 unmodified lines | |||
| 43 | w = s1->streams[0]->codec->width >> 3; | 43 | w = s1->streams[0]->codec->width >> 3; |
| 44 | h = s1->streams[0]->codec->height >> 3; | 44 | h = s1->streams[0]->codec->height >> 3; |
| 45 | 45 | ||
| 46 | /* check if pixel format is not the normal 420 case */ | 46 | /* get the pixel format type or fail */ |
| 47 | if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) { | 47 | if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P || |
| 48 | (s1->streams[0]->codec->color_range == AVCOL_RANGE_JPEG && | ||
| 49 | s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUV422P)) { | ||
| 48 | type = 0; | 50 | type = 0; |
| 49 | } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) { | 51 | } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P || |
| 52 | (s1->streams[0]->codec->color_range == AVCOL_RANGE_JPEG && | ||
| 53 | s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUV420P)) { | ||
| 50 | type = 1; | 54 | type = 1; |
| 51 | } else { | 55 | } else { |
| 52 | av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n"); | 56 | av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n"); |