diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 04:18:02 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-06 04:19:26 +0100 |
commit | fb06b8ba9371495d051d2fd815a21fb1c1392b73 (patch) | |
tree | 7e65ebf4b5e2f8b9af9cd4dbf19cb3e06bad8df0 /libavcodec/mjpegenc.c | |
parent | 0d9f2f5c47a008d3077510e499d68a4e960e2c66 (diff) | |
parent | 0812f5a40a0a190172b6de6e91755b882472ddc5 (diff) | |
download | ffmpeg-fb06b8ba9371495d051d2fd815a21fb1c1392b73.tar.gz |
Merge commit '0812f5a40a0a190172b6de6e91755b882472ddc5'
* commit '0812f5a40a0a190172b6de6e91755b882472ddc5':
mjpegenc: write the JFIF header if the sample aspect ratio is set
Conflicts:
libavcodec/mjpegenc.c
See: f3ce748d3453a490f32a5518f9cf6bef6892a30c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r-- | libavcodec/mjpegenc.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index d4db8d83da..1129118856 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -159,13 +159,12 @@ static void jpeg_table_header(MpegEncContext *s) AV_WB16(ptr, size); } -static void jpeg_put_comments(MpegEncContext *s) +static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p) { - PutBitContext *p = &s->pb; int size; uint8_t *ptr; - if (s->avctx->sample_aspect_ratio.num /* && !lossless */) + if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) { /* JFIF header */ put_marker(p, APP0); @@ -173,14 +172,14 @@ static void jpeg_put_comments(MpegEncContext *s) avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */ put_bits(p, 16, 0x0102); /* v 1.02 */ put_bits(p, 8, 0); /* units type: 0 - aspect ratio */ - put_bits(p, 16, s->avctx->sample_aspect_ratio.num); - put_bits(p, 16, s->avctx->sample_aspect_ratio.den); + put_bits(p, 16, avctx->sample_aspect_ratio.num); + put_bits(p, 16, avctx->sample_aspect_ratio.den); put_bits(p, 8, 0); /* thumbnail width */ put_bits(p, 8, 0); /* thumbnail height */ } /* comment */ - if(!(s->flags & CODEC_FLAG_BITEXACT)){ + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { put_marker(p, COM); flush_put_bits(p); ptr = put_bits_ptr(p); @@ -190,9 +189,9 @@ static void jpeg_put_comments(MpegEncContext *s) AV_WB16(ptr, size); } - if( s->avctx->pix_fmt == AV_PIX_FMT_YUV420P - ||s->avctx->pix_fmt == AV_PIX_FMT_YUV422P - ||s->avctx->pix_fmt == AV_PIX_FMT_YUV444P){ + if( avctx->pix_fmt == AV_PIX_FMT_YUV420P + ||avctx->pix_fmt == AV_PIX_FMT_YUV422P + ||avctx->pix_fmt == AV_PIX_FMT_YUV444P){ put_marker(p, COM); flush_put_bits(p); ptr = put_bits_ptr(p); @@ -213,7 +212,7 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s) // hack for AMV mjpeg format if(s->avctx->codec_id == AV_CODEC_ID_AMV) goto end; - jpeg_put_comments(s); + jpeg_put_comments(s->avctx, &s->pb); jpeg_table_header(s); |