annotate pnmenc.c @ 9716:d45e44454d13 libavcodec

In the event of a mismatch, do not follow the sample rate index in an AAC PCE. This matches the behavior the reference decoder and fixes issue 1072.
author alexc
date Tue, 26 May 2009 21:34:56 +0000
parents 54bc8a2727b0
children 7f15f8f14e97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
1 /*
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
2 * PNM image format
8629
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 8590
diff changeset
3 * Copyright (c) 2002, 2003 Fabrice Bellard
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
15 * Lesser General Public License for more details.
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
16 *
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3455
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
20 */
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
21 #include "avcodec.h"
5089
bff60ecc02f9 Use AV_xx throughout libavcodec
ramiro
parents: 4985
diff changeset
22 #include "bytestream.h"
4978
95934eef9589 move pnm parser in its own file
aurel
parents: 4931
diff changeset
23 #include "pnm.h"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
24
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
25
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6272
diff changeset
26 static av_cold int common_init(AVCodecContext *avctx){
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
27 PNMContext *s = avctx->priv_data;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
28
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
29 avcodec_get_frame_defaults((AVFrame*)&s->picture);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
30 avctx->coded_frame= (AVFrame*)&s->picture;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
31
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
32 return 0;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
33 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
34
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
35 static int pnm_decode_frame(AVCodecContext *avctx,
2348
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
36 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9246
diff changeset
37 AVPacket *avpkt)
2348
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
38 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9246
diff changeset
39 const uint8_t *buf = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9246
diff changeset
40 int buf_size = avpkt->size;
2348
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
41 PNMContext * const s = avctx->priv_data;
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
42 AVFrame *picture = data;
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
43 AVFrame * const p= (AVFrame*)&s->picture;
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
44 int i, n, linesize, h, upgrade = 0;
2348
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
45 unsigned char *ptr;
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
46
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
47 s->bytestream_start=
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
48 s->bytestream= buf;
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
49 s->bytestream_end= buf + buf_size;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
50
4978
95934eef9589 move pnm parser in its own file
aurel
parents: 4931
diff changeset
51 if(ff_pnm_decode_header(avctx, s) < 0)
2349
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
52 return -1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
53
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
54 if(p->data[0])
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
55 avctx->release_buffer(avctx, p);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
56
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
57 p->reference= 0;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
58 if(avctx->get_buffer(avctx, p) < 0){
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
59 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
60 return -1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
61 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
62 p->pict_type= FF_I_TYPE;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
63 p->key_frame= 1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
64
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
65 switch(avctx->pix_fmt) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
66 default:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
67 return -1;
9002
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
68 case PIX_FMT_RGB48BE:
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
69 n = avctx->width * 6;
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
70 goto do_read;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
71 case PIX_FMT_RGB24:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
72 n = avctx->width * 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
73 goto do_read;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
74 case PIX_FMT_GRAY8:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
75 n = avctx->width;
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
76 if (s->maxval < 255)
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
77 upgrade = 1;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
78 goto do_read;
4068
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
79 case PIX_FMT_GRAY16BE:
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
80 case PIX_FMT_GRAY16LE:
4068
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
81 n = avctx->width * 2;
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
82 if (s->maxval < 65535)
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
83 upgrade = 2;
4068
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
84 goto do_read;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
85 case PIX_FMT_MONOWHITE:
2349
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
86 case PIX_FMT_MONOBLACK:
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
87 n = (avctx->width + 7) >> 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
88 do_read:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
89 ptr = p->data[0];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
90 linesize = p->linesize[0];
2839
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
91 if(s->bytestream + n*avctx->height > s->bytestream_end)
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
92 return -1;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
93 for(i = 0; i < avctx->height; i++) {
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
94 if (!upgrade)
4837
79e3bf8af72c cosmetics after last commit
ivo
parents: 4836
diff changeset
95 memcpy(ptr, s->bytestream, n);
4836
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
96 else if (upgrade == 1) {
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
97 unsigned int j, f = (255*128 + s->maxval/2) / s->maxval;
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
98 for (j=0; j<n; j++)
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
99 ptr[j] = (s->bytestream[j] * f + 64) >> 7;
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
100 } else if (upgrade == 2) {
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
101 unsigned int j, v, f = (65535*32768 + s->maxval/2) / s->maxval;
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
102 for (j=0; j<n/2; j++) {
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
103 v = be2me_16(((uint16_t *)s->bytestream)[j]);
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
104 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
105 }
ae19d863073f Add support for grayscale images with arbitrary maxvals.
ivo
parents: 4494
diff changeset
106 }
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
107 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
108 ptr += linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
109 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
110 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
111 case PIX_FMT_YUV420P:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
112 {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
113 unsigned char *ptr1, *ptr2;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
114
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
115 n = avctx->width;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
116 ptr = p->data[0];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
117 linesize = p->linesize[0];
2839
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
118 if(s->bytestream + n*avctx->height*3/2 > s->bytestream_end)
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
119 return -1;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
120 for(i = 0; i < avctx->height; i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
121 memcpy(ptr, s->bytestream, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
122 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
123 ptr += linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
124 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
125 ptr1 = p->data[1];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
126 ptr2 = p->data[2];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
127 n >>= 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
128 h = avctx->height >> 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
129 for(i = 0; i < h; i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
130 memcpy(ptr1, s->bytestream, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
131 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
132 memcpy(ptr2, s->bytestream, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
133 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
134 ptr1 += p->linesize[1];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
135 ptr2 += p->linesize[2];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
136 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
137 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
138 break;
4494
ce643a22f049 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 4152
diff changeset
139 case PIX_FMT_RGB32:
2349
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
140 ptr = p->data[0];
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
141 linesize = p->linesize[0];
2839
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
142 if(s->bytestream + avctx->width*avctx->height*4 > s->bytestream_end)
b857807dfe30 segfault fix
michael
parents: 2661
diff changeset
143 return -1;
2349
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
144 for(i = 0; i < avctx->height; i++) {
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
145 int j, r, g, b, a;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
146
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
147 for(j = 0;j < avctx->width; j++) {
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
148 r = *s->bytestream++;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
149 g = *s->bytestream++;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
150 b = *s->bytestream++;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
151 a = *s->bytestream++;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
152 ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
153 }
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
154 ptr += linesize;
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
155 }
f7f4f06a55c9 merge pam_decode_frame() into pnm_decode_frame()
michael
parents: 2348
diff changeset
156 break;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
157 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
158 *picture= *(AVFrame*)&s->picture;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
159 *data_size = sizeof(AVPicture);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
160
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
161 return s->bytestream - s->bytestream_start;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
162 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
163
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
164 static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data){
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
165 PNMContext *s = avctx->priv_data;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
166 AVFrame *pict = data;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
167 AVFrame * const p= (AVFrame*)&s->picture;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
168 int i, h, h1, c, n, linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
169 uint8_t *ptr, *ptr1, *ptr2;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
170
2422
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
171 if(buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200){
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
172 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
173 return -1;
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
174 }
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
175
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
176 *p = *pict;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
177 p->pict_type= FF_I_TYPE;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
178 p->key_frame= 1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
179
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
180 s->bytestream_start=
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
181 s->bytestream= outbuf;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
182 s->bytestream_end= outbuf+buf_size;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
183
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
184 h = avctx->height;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
185 h1 = h;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
186 switch(avctx->pix_fmt) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
187 case PIX_FMT_MONOWHITE:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
188 c = '4';
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
189 n = (avctx->width + 7) >> 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
190 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
191 case PIX_FMT_GRAY8:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
192 c = '5';
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
193 n = avctx->width;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
194 break;
4068
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
195 case PIX_FMT_GRAY16BE:
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
196 c = '5';
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
197 n = avctx->width * 2;
186e51891c8c PGM 16-bit gray support
kostya
parents: 3947
diff changeset
198 break;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
199 case PIX_FMT_RGB24:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
200 c = '6';
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
201 n = avctx->width * 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
202 break;
9002
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
203 case PIX_FMT_RGB48BE:
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
204 c = '6';
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
205 n = avctx->width * 6;
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
206 break;
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
207 case PIX_FMT_YUV420P:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
208 c = '5';
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
209 n = avctx->width;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
210 h1 = (h * 3) / 2;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
211 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
212 default:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
213 return -1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
214 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
215 snprintf(s->bytestream, s->bytestream_end - s->bytestream,
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
216 "P%c\n%d %d\n",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
217 c, avctx->width, h1);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
218 s->bytestream += strlen(s->bytestream);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
219 if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
220 snprintf(s->bytestream, s->bytestream_end - s->bytestream,
9002
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
221 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
222 s->bytestream += strlen(s->bytestream);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
223 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
224
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
225 ptr = p->data[0];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
226 linesize = p->linesize[0];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
227 for(i=0;i<h;i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
228 memcpy(s->bytestream, ptr, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
229 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
230 ptr += linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
231 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
232
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
233 if (avctx->pix_fmt == PIX_FMT_YUV420P) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
234 h >>= 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
235 n >>= 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
236 ptr1 = p->data[1];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
237 ptr2 = p->data[2];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
238 for(i=0;i<h;i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
239 memcpy(s->bytestream, ptr1, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
240 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
241 memcpy(s->bytestream, ptr2, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
242 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
243 ptr1 += p->linesize[1];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
244 ptr2 += p->linesize[2];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
245 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
246 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
247 return s->bytestream - s->bytestream_start;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
248 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
249
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
250 static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data){
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
251 PNMContext *s = avctx->priv_data;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
252 AVFrame *pict = data;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
253 AVFrame * const p= (AVFrame*)&s->picture;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
254 int i, h, w, n, linesize, depth, maxval;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
255 const char *tuple_type;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
256 uint8_t *ptr;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
257
2422
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
258 if(buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200){
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
259 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
260 return -1;
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
261 }
18b8b2dcc037 various security fixes and precautionary checks
michael
parents: 2349
diff changeset
262
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
263 *p = *pict;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
264 p->pict_type= FF_I_TYPE;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
265 p->key_frame= 1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
266
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
267 s->bytestream_start=
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
268 s->bytestream= outbuf;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
269 s->bytestream_end= outbuf+buf_size;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
270
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
271 h = avctx->height;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
272 w = avctx->width;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
273 switch(avctx->pix_fmt) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
274 case PIX_FMT_MONOWHITE:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
275 n = (w + 7) >> 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
276 depth = 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
277 maxval = 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
278 tuple_type = "BLACKANDWHITE";
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
279 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
280 case PIX_FMT_GRAY8:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
281 n = w;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
282 depth = 1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
283 maxval = 255;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
284 tuple_type = "GRAYSCALE";
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
285 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
286 case PIX_FMT_RGB24:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
287 n = w * 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
288 depth = 3;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
289 maxval = 255;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
290 tuple_type = "RGB";
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
291 break;
4494
ce643a22f049 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 4152
diff changeset
292 case PIX_FMT_RGB32:
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
293 n = w * 4;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
294 depth = 4;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
295 maxval = 255;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
296 tuple_type = "RGB_ALPHA";
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
297 break;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
298 default:
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
299 return -1;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
300 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
301 snprintf(s->bytestream, s->bytestream_end - s->bytestream,
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
302 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLETYPE %s\nENDHDR\n",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
303 w, h, depth, maxval, tuple_type);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
304 s->bytestream += strlen(s->bytestream);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
305
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
306 ptr = p->data[0];
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
307 linesize = p->linesize[0];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
308
4494
ce643a22f049 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 4152
diff changeset
309 if (avctx->pix_fmt == PIX_FMT_RGB32) {
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
310 int j;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
311 unsigned int v;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
312
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
313 for(i=0;i<h;i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
314 for(j=0;j<w;j++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
315 v = ((uint32_t *)ptr)[j];
5089
bff60ecc02f9 Use AV_xx throughout libavcodec
ramiro
parents: 4985
diff changeset
316 bytestream_put_be24(&s->bytestream, v);
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
317 *s->bytestream++ = v >> 24;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
318 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
319 ptr += linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
320 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
321 } else {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
322 for(i=0;i<h;i++) {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
323 memcpy(s->bytestream, ptr, n);
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
324 s->bytestream += n;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
325 ptr += linesize;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
326 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
327 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
328 return s->bytestream - s->bytestream_start;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
329 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
330
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
331 #if 0
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
332 static int pnm_probe(AVProbeData *pd)
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
333 {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
334 const char *p = pd->buf;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
335 if (pd->buf_size >= 8 &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
336 p[0] == 'P' &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
337 p[1] >= '4' && p[1] <= '6' &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
338 pnm_space(p[2]) )
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
339 return AVPROBE_SCORE_MAX - 1; /* to permit pgmyuv probe */
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
340 else
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
341 return 0;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
342 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
343
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
344 static int pgmyuv_probe(AVProbeData *pd)
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
345 {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
346 if (match_ext(pd->filename, "pgmyuv"))
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
347 return AVPROBE_SCORE_MAX;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
348 else
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
349 return 0;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
350 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
351
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
352 static int pam_probe(AVProbeData *pd)
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
353 {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
354 const char *p = pd->buf;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
355 if (pd->buf_size >= 8 &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
356 p[0] == 'P' &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
357 p[1] == '7' &&
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
358 p[2] == '\n')
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
359 return AVPROBE_SCORE_MAX;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
360 else
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
361 return 0;
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
362 }
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
363 #endif
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
364
2348
d02fb928ca44 pnm parser
michael
parents: 2344
diff changeset
365
9246
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
366 #if CONFIG_PGM_DECODER
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
367 AVCodec pgm_decoder = {
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
368 "pgm",
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
369 CODEC_TYPE_VIDEO,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
370 CODEC_ID_PGM,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
371 sizeof(PNMContext),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
372 common_init,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
373 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
374 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
375 pnm_decode_frame,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
376 .pix_fmts= (enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
377 .long_name= NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
378 };
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
379 #endif
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
380
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7040
diff changeset
381 #if CONFIG_PGM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
382 AVCodec pgm_encoder = {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
383 "pgm",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
384 CODEC_TYPE_VIDEO,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
385 CODEC_ID_PGM,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
386 sizeof(PNMContext),
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
387 common_init,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
388 pnm_encode_frame,
6788
e1302edb0f69 Replace some occurrences of -1 with PIX_FMT_NONE.
cehoyos
parents: 6722
diff changeset
389 .pix_fmts= (enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
390 .long_name= NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
391 };
2661
b2846918585c a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents: 2453
diff changeset
392 #endif // CONFIG_PGM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
393
9246
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
394 #if CONFIG_PGMYUV_DECODER
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
395 AVCodec pgmyuv_decoder = {
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
396 "pgmyuv",
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
397 CODEC_TYPE_VIDEO,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
398 CODEC_ID_PGMYUV,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
399 sizeof(PNMContext),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
400 common_init,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
401 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
402 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
403 pnm_decode_frame,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
404 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
405 .long_name= NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
406 };
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
407 #endif
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
408
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7040
diff changeset
409 #if CONFIG_PGMYUV_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
410 AVCodec pgmyuv_encoder = {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
411 "pgmyuv",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
412 CODEC_TYPE_VIDEO,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
413 CODEC_ID_PGMYUV,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
414 sizeof(PNMContext),
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
415 common_init,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
416 pnm_encode_frame,
6788
e1302edb0f69 Replace some occurrences of -1 with PIX_FMT_NONE.
cehoyos
parents: 6722
diff changeset
417 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
418 .long_name= NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
419 };
2661
b2846918585c a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents: 2453
diff changeset
420 #endif // CONFIG_PGMYUV_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
421
9246
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
422 #if CONFIG_PPM_DECODER
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
423 AVCodec ppm_decoder = {
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
424 "ppm",
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
425 CODEC_TYPE_VIDEO,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
426 CODEC_ID_PPM,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
427 sizeof(PNMContext),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
428 common_init,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
429 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
430 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
431 pnm_decode_frame,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
432 .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
433 .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
434 };
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
435 #endif
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
436
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7040
diff changeset
437 #if CONFIG_PPM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
438 AVCodec ppm_encoder = {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
439 "ppm",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
440 CODEC_TYPE_VIDEO,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
441 CODEC_ID_PPM,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
442 sizeof(PNMContext),
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
443 common_init,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
444 pnm_encode_frame,
9002
eb98d61af310 Support 48-bit RGB PPM image.
pross
parents: 8629
diff changeset
445 .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
446 .long_name= NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
447 };
2661
b2846918585c a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents: 2453
diff changeset
448 #endif // CONFIG_PPM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
449
9246
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
450 #if CONFIG_PBM_DECODER
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
451 AVCodec pbm_decoder = {
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
452 "pbm",
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
453 CODEC_TYPE_VIDEO,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
454 CODEC_ID_PBM,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
455 sizeof(PNMContext),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
456 common_init,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
457 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
458 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
459 pnm_decode_frame,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
460 .pix_fmts= (enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
461 .long_name= NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
462 };
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
463 #endif
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
464
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7040
diff changeset
465 #if CONFIG_PBM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
466 AVCodec pbm_encoder = {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
467 "pbm",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
468 CODEC_TYPE_VIDEO,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
469 CODEC_ID_PBM,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
470 sizeof(PNMContext),
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
471 common_init,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
472 pnm_encode_frame,
6788
e1302edb0f69 Replace some occurrences of -1 with PIX_FMT_NONE.
cehoyos
parents: 6722
diff changeset
473 .pix_fmts= (enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
474 .long_name= NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
475 };
2661
b2846918585c a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents: 2453
diff changeset
476 #endif // CONFIG_PBM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
477
9246
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
478 #if CONFIG_PAM_DECODER
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
479 AVCodec pam_decoder = {
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
480 "pam",
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
481 CODEC_TYPE_VIDEO,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
482 CODEC_ID_PAM,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
483 sizeof(PNMContext),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
484 common_init,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
485 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
486 NULL,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
487 pnm_decode_frame,
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
488 .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
489 .long_name= NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
490 };
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
491 #endif
18b83dac1221 Split AVCodec declarations for PAM/PBM/PGM/PGMYUV/PPM decoders and encoders
diego
parents: 9002
diff changeset
492
8590
7a463923ecd1 Change semantic of CONFIG_*, HAVE_* and ARCH_*.
aurel
parents: 7040
diff changeset
493 #if CONFIG_PAM_ENCODER
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
494 AVCodec pam_encoder = {
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
495 "pam",
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
496 CODEC_TYPE_VIDEO,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
497 CODEC_ID_PAM,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
498 sizeof(PNMContext),
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
499 common_init,
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
500 pam_encode_frame,
6788
e1302edb0f69 Replace some occurrences of -1 with PIX_FMT_NONE.
cehoyos
parents: 6722
diff changeset
501 .pix_fmts= (enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
502 .long_name= NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
2344
f09680c5e8f4 move p*m from image/lavf -> image2/lavc
michael
parents:
diff changeset
503 };
2661
b2846918585c a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents: 2453
diff changeset
504 #endif // CONFIG_PAM_ENCODER