annotate raw.c @ 1650:bdade3baabfc libavcodec

initial support for Duck TrueMotion v1 (think of it as On2 VP1); only 16-bit mode supported thus far
author melanson
date Wed, 03 Dec 2003 04:22:15 +0000
parents ec946cb74397
children 141a9539e270
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
1 /*
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
2 * Raw Video Codec
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
4 *
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
9 *
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
13 * Lesser General Public License for more details.
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
14 *
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
18 */
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
19
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
20 /**
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
21 * @file raw.c
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
22 * Raw Video Codec
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
23 */
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
24
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
25 #include "avcodec.h"
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
26
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
27 typedef struct RawVideoContext {
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
28 unsigned char * buffer; /* block of memory for holding one frame */
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
29 unsigned char * p; /* current position in buffer */
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
30 int length; /* number of bytes in buffer */
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
31 AVFrame pic; ///< AVCodecContext.coded_frame
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
32 } RawVideoContext;
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
33
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
34 typedef struct PixleFormatTag {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
35 int pix_fmt;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
36 unsigned int fourcc;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
37 } PixelFormatTag;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
38
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
39 const PixelFormatTag pixelFormatTags[] = {
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
40 { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
41 { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
42 { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
43 { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
44 { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
45 { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
46 { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
47
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
48
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
49 { PIX_FMT_YUV422, MKTAG('Y', '4', '2', '2') }, /* Packed formats */
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
50 { PIX_FMT_YUV422, MKTAG('U', 'Y', 'V', 'Y') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
51 { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') },
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
52
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
53 { -1, 0 },
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
54 };
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
55
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
56 static int findPixelFormat(unsigned int fourcc)
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
57 {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
58 const PixelFormatTag * tags = pixelFormatTags;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
59 while (tags->pix_fmt >= 0) {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
60 if (tags->fourcc == fourcc)
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
61 return tags->pix_fmt;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
62 tags++;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
63 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
64 return PIX_FMT_YUV420P;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
65 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
66
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
67 static unsigned int findFourCC(int fmt)
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
68 {
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
69 const PixelFormatTag * tags = pixelFormatTags;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
70 while (tags->pix_fmt >= 0) {
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
71 if (tags->pix_fmt == fmt)
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
72 return tags->fourcc;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
73 tags++;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
74 }
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
75 return 0;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
76 }
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
77
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
78 /* RAW Decoder Implementation */
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
79
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
80 static int raw_init_decoder(AVCodecContext *avctx)
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
81 {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
82 RawVideoContext *context = avctx->priv_data;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
83
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
84 if (avctx->codec_tag)
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
85 avctx->pix_fmt = findPixelFormat(avctx->codec_tag);
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
86
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
87 context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
88 context->buffer = av_malloc(context->length);
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
89 context->p = context->buffer;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
90 context->pic.pict_type = FF_I_TYPE;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
91 context->pic.key_frame = 1;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
92
1195
f7522f310c7e segfault fix
michaelni
parents: 1155
diff changeset
93 avctx->coded_frame= &context->pic;
f7522f310c7e segfault fix
michaelni
parents: 1155
diff changeset
94
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
95 if (!context->buffer)
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
96 return -1;
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
97
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
98 return 0;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
99 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
100
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
101 static int raw_decode(AVCodecContext *avctx,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
102 void *data, int *data_size,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
103 uint8_t *buf, int buf_size)
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
104 {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
105 RawVideoContext *context = avctx->priv_data;
1140
michaelni
parents: 1139
diff changeset
106 int bytesNeeded;
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
107
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
108 AVPicture * picture = (AVPicture *) data;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
109
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
110 /* Early out without copy if packet size == frame size */
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
111 if (buf_size == context->length && context->p == context->buffer) {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
112 avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
113 *data_size = sizeof(AVPicture);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
114 return buf_size;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
115 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
116
1140
michaelni
parents: 1139
diff changeset
117 bytesNeeded = context->length - (context->p - context->buffer);
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
118 if (buf_size < bytesNeeded) {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
119 memcpy(context->p, buf, buf_size);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
120 context->p += buf_size;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
121 *data_size = 0;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
122 return buf_size;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
123 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
124
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
125 memcpy(context->p, buf, bytesNeeded);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
126 context->p = context->buffer;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
127 avpicture_fill(picture, context->buffer, avctx->pix_fmt, avctx->width, avctx->height);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
128 *data_size = sizeof(AVPicture);
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
129 return bytesNeeded;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
130 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
131
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
132 static int raw_close_decoder(AVCodecContext *avctx)
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
133 {
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
134 RawVideoContext *context = avctx->priv_data;
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
135
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
136 av_freep(&context->buffer);
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
137 return 0;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
138 }
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
139
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
140 /* RAW Encoder Implementation */
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
141
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
142 static int raw_init_encoder(AVCodecContext *avctx)
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
143 {
1266
ec946cb74397 Warning fixes.
mellum
parents: 1231
diff changeset
144 avctx->coded_frame = (AVFrame *)avctx->priv_data;
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
145 avctx->coded_frame->pict_type = FF_I_TYPE;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
146 avctx->coded_frame->key_frame = 1;
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
147 avctx->codec_tag = findFourCC(avctx->pix_fmt);
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
148 return 0;
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
149 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
150
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
151 static int raw_encode(AVCodecContext *avctx,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
152 unsigned char *frame, int buf_size, void *data)
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
153 {
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
154 return avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
155 avctx->height, frame, buf_size);
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
156 }
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
157
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
158 AVCodec rawvideo_encoder = {
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
159 "rawvideo",
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
160 CODEC_TYPE_VIDEO,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
161 CODEC_ID_RAWVIDEO,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
162 sizeof(AVFrame),
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
163 raw_init_encoder,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
164 raw_encode,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
165 };
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
166
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
167 AVCodec rawvideo_decoder = {
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
168 "rawvideo",
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
169 CODEC_TYPE_VIDEO,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
170 CODEC_ID_RAWVIDEO,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
171 sizeof(RawVideoContext),
1231
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
172 raw_init_decoder,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
173 NULL,
b88dfc4bbf8c * introducing new public interface in imgconvert.c
romansh
parents: 1195
diff changeset
174 raw_close_decoder,
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
175 raw_decode,
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
diff changeset
176 };