summaryrefslogtreecommitdiff
path: root/libavcodec/pnmenc.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2009-02-22 00:56:55 +0000
committerPeter Ross <pross@xvid.org>2009-02-22 00:56:55 +0000
commit001821904e316b68c42d1671dcf963e5f7c648f7 (patch)
tree42385931606ea3994cb87b7dfe4912f59dd5ecc6 /libavcodec/pnmenc.c
parent88c21a6f149e27ff860226043d6c31998152c883 (diff)
Support 48-bit RGB PPM image.
Originally committed as revision 17511 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pnmenc.c')
-rw-r--r--libavcodec/pnmenc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index c3316ea0b5..46afbab560 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -63,6 +63,9 @@ static int pnm_decode_frame(AVCodecContext *avctx,
switch(avctx->pix_fmt) {
default:
return -1;
+ case PIX_FMT_RGB48BE:
+ n = avctx->width * 6;
+ goto do_read;
case PIX_FMT_RGB24:
n = avctx->width * 3;
goto do_read;
@@ -195,6 +198,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
c = '6';
n = avctx->width * 3;
break;
+ case PIX_FMT_RGB48BE:
+ c = '6';
+ n = avctx->width * 6;
+ break;
case PIX_FMT_YUV420P:
c = '5';
n = avctx->width;
@@ -209,7 +216,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu
s->bytestream += strlen(s->bytestream);
if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
snprintf(s->bytestream, s->bytestream_end - s->bytestream,
- "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE) ? 255 : 65535);
+ "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
s->bytestream += strlen(s->bytestream);
}
@@ -394,7 +401,7 @@ AVCodec ppm_encoder = {
pnm_encode_frame,
NULL, //encode_end,
pnm_decode_frame,
- .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_NONE},
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
};
#endif // CONFIG_PPM_ENCODER