OLD | NEW |
1 /* | 1 /* |
2 * Targa (.tga) image encoder | 2 * Targa (.tga) image encoder |
3 * Copyright (c) 2007 Bobby Bingham | 3 * Copyright (c) 2007 Bobby Bingham |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 AV_WL16(outbuf+12, avctx->width); | 97 AV_WL16(outbuf+12, avctx->width); |
98 AV_WL16(outbuf+14, avctx->height); | 98 AV_WL16(outbuf+14, avctx->height); |
99 outbuf[17] = 0x20; /* origin is top-left. no alpha */ | 99 outbuf[17] = 0x20; /* origin is top-left. no alpha */ |
100 | 100 |
101 /* TODO: support alpha channel */ | 101 /* TODO: support alpha channel */ |
102 switch(avctx->pix_fmt) { | 102 switch(avctx->pix_fmt) { |
103 case PIX_FMT_GRAY8: | 103 case PIX_FMT_GRAY8: |
104 outbuf[2] = 3; /* uncompressed grayscale image */ | 104 outbuf[2] = 3; /* uncompressed grayscale image */ |
105 outbuf[16] = 8; /* bpp */ | 105 outbuf[16] = 8; /* bpp */ |
106 break; | 106 break; |
107 case PIX_FMT_RGB555: | 107 case PIX_FMT_RGB555LE: |
108 outbuf[2] = 2; /* uncompresses true-color image */ | 108 outbuf[2] = 2; /* uncompresses true-color image */ |
109 outbuf[16] = 16; /* bpp */ | 109 outbuf[16] = 16; /* bpp */ |
110 break; | 110 break; |
111 case PIX_FMT_BGR24: | 111 case PIX_FMT_BGR24: |
112 outbuf[2] = 2; /* uncompressed true-color image */ | 112 outbuf[2] = 2; /* uncompressed true-color image */ |
113 outbuf[16] = 24; /* bpp */ | 113 outbuf[16] = 24; /* bpp */ |
114 break; | 114 break; |
115 default: | 115 default: |
116 return -1; | 116 return -1; |
117 } | 117 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return 0; | 151 return 0; |
152 } | 152 } |
153 | 153 |
154 AVCodec targa_encoder = { | 154 AVCodec targa_encoder = { |
155 .name = "targa", | 155 .name = "targa", |
156 .type = CODEC_TYPE_VIDEO, | 156 .type = CODEC_TYPE_VIDEO, |
157 .id = CODEC_ID_TARGA, | 157 .id = CODEC_ID_TARGA, |
158 .priv_data_size = sizeof(TargaContext), | 158 .priv_data_size = sizeof(TargaContext), |
159 .init = targa_encode_init, | 159 .init = targa_encode_init, |
160 .encode = targa_encode_frame, | 160 .encode = targa_encode_frame, |
161 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555, PIX_FMT
_GRAY8, PIX_FMT_NONE}, | 161 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555LE, PIX_F
MT_GRAY8, PIX_FMT_NONE}, |
162 .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"), | 162 .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"), |
163 }; | 163 }; |
OLD | NEW |