annotate raw.c @ 223:848b612d0595 libavformat

move packetheader after startcodes
author al3x
date Sun, 07 Sep 2003 00:37:46 +0000
parents 56590088f801
children eb90c0a5a1ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
2 * RAW encoder and decoder
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
18 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
19 #include "avformat.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21 /* simple formats */
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
22 static int raw_write_header(struct AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
26
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
27 static int raw_write_packet(struct AVFormatContext *s, int stream_index,
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
28 unsigned char *buf, int size, int force_pts)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30 put_buffer(&s->pb, buf, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
31 put_flush_packet(&s->pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
32 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
33 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
34
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
35 static int raw_write_trailer(struct AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40 /* raw input */
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 64
diff changeset
41 static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 int id;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
45
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
46 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
47 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
48 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
49 if (ap) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
50 id = s->iformat->value;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
51 if (id == CODEC_ID_RAWVIDEO) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
52 st->codec.codec_type = CODEC_TYPE_VIDEO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
53 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
54 st->codec.codec_type = CODEC_TYPE_AUDIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
55 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
56 st->codec.codec_id = id;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
57
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
58 switch(st->codec.codec_type) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
59 case CODEC_TYPE_AUDIO:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
60 st->codec.sample_rate = ap->sample_rate;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
61 st->codec.channels = ap->channels;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
62 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
63 case CODEC_TYPE_VIDEO:
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
64 st->codec.frame_rate = ap->frame_rate;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
65 st->codec.frame_rate_base = ap->frame_rate_base;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
66 st->codec.width = ap->width;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
67 st->codec.height = ap->height;
128
45633cd5518a * introducing new public interface in imgconvert.c
romansh
parents: 126
diff changeset
68 st->codec.pix_fmt = ap->pix_fmt;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
69 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
70 default:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
71 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
72 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
73 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
74 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
75 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
76 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
77 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
78
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
79 #define RAW_PACKET_SIZE 1024
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
80
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
81 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
82 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
83 int ret, size;
28
64678c053566 removed warnings
bellard
parents: 0
diff changeset
84 // AVStream *st = s->streams[0];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
85
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
86 size= RAW_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
87
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
88 if (av_new_packet(pkt, size) < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
89 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
90
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
91 pkt->stream_index = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
92 ret = get_buffer(&s->pb, pkt->data, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
93 if (ret <= 0) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
94 av_free_packet(pkt);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
95 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
96 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
97 /* note: we need to modify the packet size here to handle the last
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
98 packet */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
99 pkt->size = ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
100 return ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
101 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
102
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
103 static int raw_read_close(AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
104 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
105 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
106 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
107
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
108 /* mp3 read */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
109 static int mp3_read_header(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
110 AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
111 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
112 AVStream *st;
125
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
113 int pos;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
114
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
115 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
116 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
117 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
118
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
119 st->codec.codec_type = CODEC_TYPE_AUDIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
120 st->codec.codec_id = CODEC_ID_MP2;
125
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
121
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
122 /* looking for 11111111 111MMLLC - MPEG synchronization tag
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
123 MM: 00 - MPEG-2.5, 10 - MPEG-2, 11 - MPEG-1
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
124 LL: 11 - Layer I, 10 - Layer II, 01 - Layer III
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
125 XXX: this code does not read more bytes from file
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
126 so if ID3 (or other stuff) length > IO_BUFFER_SIZE it fails back to CODEC_ID_MP2 */
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
127 for(pos=0; pos < s->pb.buffer_size-1; pos++)
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
128 if( s->pb.buffer[pos] == 0xFF && (s->pb.buffer[pos] & 0xE0) == 0xE0 )
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
129 break;
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
130
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
131 if( pos < s->pb.buffer_size-1 && (s->pb.buffer[pos+1] & 6) == 2 )
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
132 st->codec.codec_id = CODEC_ID_MP3LAME;
7500e14259a6 mp3 codec autodetection patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 100
diff changeset
133
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
134 /* the parameters will be extracted from the compressed bitstream */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
135 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
136 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
137
63
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
138 /* ac3 read */
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
139 static int ac3_read_header(AVFormatContext *s,
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
140 AVFormatParameters *ap)
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
141 {
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
142 AVStream *st;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
143
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
144 st = av_new_stream(s, 0);
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
145 if (!st)
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
146 return AVERROR_NOMEM;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
147
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
148 st->codec.codec_type = CODEC_TYPE_AUDIO;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
149 st->codec.codec_id = CODEC_ID_AC3;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
150 /* the parameters will be extracted from the compressed bitstream */
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
151 return 0;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
152 }
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
153
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
154 /* mpeg1/h263 input */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
155 static int video_read_header(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
156 AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
157 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
158 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
159
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
160 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
161 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
162 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
163
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
164 st->codec.codec_type = CODEC_TYPE_VIDEO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
165 st->codec.codec_id = s->iformat->value;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
166 /* for mjpeg, specify frame rate */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
167 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
168 if (st->codec.codec_id == CODEC_ID_MJPEG || st->codec.codec_id == CODEC_ID_MPEG4) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
169 if (ap) {
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
170 st->codec.frame_rate = ap->frame_rate;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
171 st->codec.frame_rate_base = ap->frame_rate_base;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
172 } else {
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
173 st->codec.frame_rate = 25;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
174 st->codec.frame_rate_base = 1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
175 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
176 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
177 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
178 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
179
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
180 #define SEQ_START_CODE 0x000001b3
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
181 #define GOP_START_CODE 0x000001b8
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
182 #define PICTURE_START_CODE 0x00000100
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
183
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
184 /* XXX: improve that by looking at several start codes */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
185 static int mpegvideo_probe(AVProbeData *p)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
186 {
49
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
187 int code;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
188 const uint8_t *d;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
189
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
190 /* we search the first start code. If it is a sequence, gop or
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
191 picture start code then we decide it is an mpeg video
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
192 stream. We do not send highest value to give a chance to mpegts */
49
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
193 /* NOTE: the search range was restricted to avoid too many false
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
194 detections */
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
195
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
196 if (p->buf_size < 6)
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
197 return 0;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
198 d = p->buf;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
199 code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
200 if ((code & 0xffffff00) == 0x100) {
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
201 if (code == SEQ_START_CODE ||
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
202 code == GOP_START_CODE ||
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
203 code == PICTURE_START_CODE)
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
204 return 50 - 1;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
205 else
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
206 return 0;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
207 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
208 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
209 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
210
135
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
211 static int h263_probe(AVProbeData *p)
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
212 {
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
213 int code;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
214 const uint8_t *d;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
215
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
216 if (p->buf_size < 6)
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
217 return 0;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
218 d = p->buf;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
219 code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
220 if (code == 0x20) {
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
221 return 50;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
222 }
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
223 return 0;
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
224 }
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
225
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
226
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
227 AVInputFormat mp3_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
228 "mp3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
229 "MPEG audio",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
230 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
231 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
232 mp3_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
233 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
234 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
235 .extensions = "mp2,mp3", /* XXX: use probe */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
236 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
237
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
238 AVOutputFormat mp2_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
239 "mp2",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
240 "MPEG audio layer 2",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
241 "audio/x-mpeg",
126
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
242 #ifdef CONFIG_MP3LAME
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
243 "mp2",
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
244 #else
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
245 "mp2,mp3",
126
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
246 #endif
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
247 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
248 CODEC_ID_MP2,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
249 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
250 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
251 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
252 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
253 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
254
126
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
255 #ifdef CONFIG_MP3LAME
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
256 AVOutputFormat mp3_oformat = {
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
257 "mp3",
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
258 "MPEG audio layer 3",
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
259 "audio/x-mpeg",
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
260 "mp3",
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
261 0,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
262 CODEC_ID_MP3LAME,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
263 0,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
264 raw_write_header,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
265 raw_write_packet,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
266 raw_write_trailer,
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
267 };
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
268 #endif
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
269
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
270 AVInputFormat ac3_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
271 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
272 "raw ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
273 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
274 NULL,
63
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
275 ac3_read_header,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
276 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
277 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
278 .extensions = "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
279 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
280
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
281 AVOutputFormat ac3_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
282 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
283 "raw ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
284 "audio/x-ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
285 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
286 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
287 CODEC_ID_AC3,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
288 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
289 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
290 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
291 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
292 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
293
135
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
294 AVInputFormat h263_iformat = {
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
295 "h263",
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
296 "raw h263",
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
297 0,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
298 h263_probe,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
299 video_read_header,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
300 raw_read_packet,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
301 raw_read_close,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
302 // .extensions = "h263", //FIXME remove after writing mpeg4_probe
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
303 .value = CODEC_ID_H263,
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
304 };
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
305
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
306 AVOutputFormat h263_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
307 "h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
308 "raw h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
309 "video/x-h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
310 "h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
311 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
312 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
313 CODEC_ID_H263,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
314 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
315 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
316 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
317 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
318
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
319 AVInputFormat m4v_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
320 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
321 "raw MPEG4 video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
322 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
323 NULL /*mpegvideo_probe*/,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
324 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
325 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
326 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
327 .extensions = "m4v", //FIXME remove after writing mpeg4_probe
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
328 .value = CODEC_ID_MPEG4,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
329 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
330
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
331 AVOutputFormat m4v_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
332 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
333 "raw MPEG4 video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
334 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
335 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
336 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
337 CODEC_ID_NONE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
338 CODEC_ID_MPEG4,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
339 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
340 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
341 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
342 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
343
100
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
344 AVInputFormat h264_iformat = {
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
345 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
346 "raw H264 video format",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
347 0,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
348 NULL /*mpegvideo_probe*/,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
349 video_read_header,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
350 raw_read_packet,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
351 raw_read_close,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
352 .extensions = "h26l,h264", //FIXME remove after writing mpeg4_probe
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
353 .value = CODEC_ID_H264,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
354 };
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
355
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
356 AVOutputFormat h264_oformat = {
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
357 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
358 "raw H264 video format",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
359 NULL,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
360 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
361 0,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
362 CODEC_ID_NONE,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
363 CODEC_ID_H264,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
364 raw_write_header,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
365 raw_write_packet,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
366 raw_write_trailer,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
367 };
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
368
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
369 AVInputFormat mpegvideo_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
370 "mpegvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
371 "MPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
372 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
373 mpegvideo_probe,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
374 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
375 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
376 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
377 .value = CODEC_ID_MPEG1VIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
378 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
379
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
380 AVOutputFormat mpeg1video_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
381 "mpeg1video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
382 "MPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
383 "video/x-mpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
384 "mpg,mpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
385 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
386 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
387 CODEC_ID_MPEG1VIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
388 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
389 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
390 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
391 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
392
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
393 AVInputFormat mjpeg_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
394 "mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
395 "MJPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
396 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
397 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
398 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
399 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
400 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
401 .extensions = "mjpg,mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
402 .value = CODEC_ID_MJPEG,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
403 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
404
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
405 AVOutputFormat mjpeg_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
406 "mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
407 "MJPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
408 "video/x-mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
409 "mjpg,mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
410 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
411 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
412 CODEC_ID_MJPEG,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
413 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
414 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
415 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
416 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
417
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
418 /* pcm formats */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
419
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
420 #define PCMDEF(name, long_name, ext, codec) \
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
421 AVInputFormat pcm_ ## name ## _iformat = {\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
422 #name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
423 long_name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
424 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
425 NULL,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
426 raw_read_header,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
427 raw_read_packet,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
428 raw_read_close,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
429 .extensions = ext,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
430 .value = codec,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
431 };\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
432 \
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
433 AVOutputFormat pcm_ ## name ## _oformat = {\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
434 #name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
435 long_name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
436 NULL,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
437 ext,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
438 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
439 codec,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
440 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
441 raw_write_header,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
442 raw_write_packet,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
443 raw_write_trailer,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
444 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
445
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
446 #ifdef WORDS_BIGENDIAN
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
447 #define BE_DEF(s) s
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
448 #define LE_DEF(s) NULL
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
449 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
450 #define BE_DEF(s) NULL
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
451 #define LE_DEF(s) s
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
452 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
453
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
454
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
455 PCMDEF(s16le, "pcm signed 16 bit little endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
456 LE_DEF("sw"), CODEC_ID_PCM_S16LE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
457
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
458 PCMDEF(s16be, "pcm signed 16 bit big endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
459 BE_DEF("sw"), CODEC_ID_PCM_S16BE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
460
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
461 PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
462 LE_DEF("uw"), CODEC_ID_PCM_U16LE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
463
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
464 PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
465 BE_DEF("uw"), CODEC_ID_PCM_U16BE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
466
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
467 PCMDEF(s8, "pcm signed 8 bit format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
468 "sb", CODEC_ID_PCM_S8)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
469
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
470 PCMDEF(u8, "pcm unsigned 8 bit format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
471 "ub", CODEC_ID_PCM_U8)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
472
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
473 PCMDEF(mulaw, "pcm mu law format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
474 "ul", CODEC_ID_PCM_MULAW)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
475
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
476 PCMDEF(alaw, "pcm A law format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
477 "al", CODEC_ID_PCM_ALAW)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
478
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
479 static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
480 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
481 int packet_size, ret, width, height;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
482 AVStream *st = s->streams[0];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
483
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
484 width = st->codec.width;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
485 height = st->codec.height;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
486
128
45633cd5518a * introducing new public interface in imgconvert.c
romansh
parents: 126
diff changeset
487 packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
45633cd5518a * introducing new public interface in imgconvert.c
romansh
parents: 126
diff changeset
488 if (packet_size < 0)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
489 av_abort();
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
490
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
491 if (av_new_packet(pkt, packet_size) < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
492 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
493
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
494 pkt->stream_index = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
495 #if 0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
496 /* bypass buffered I/O */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
497 ret = url_read(url_fileno(&s->pb), pkt->data, pkt->size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
498 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
499 ret = get_buffer(&s->pb, pkt->data, pkt->size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
500 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
501 if (ret != pkt->size) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
502 av_free_packet(pkt);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
503 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
504 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
505 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
506 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
507 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
508
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
509 AVInputFormat rawvideo_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
510 "rawvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
511 "raw video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
512 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
513 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
514 raw_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
515 rawvideo_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
516 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
517 .extensions = "yuv",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
518 .value = CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
519 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
520
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
521 AVOutputFormat rawvideo_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
522 "rawvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
523 "raw video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
524 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
525 "yuv",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
526 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
527 CODEC_ID_NONE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
528 CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
529 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
530 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
531 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
532 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
533
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
534 static int null_write_packet(struct AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
535 int stream_index,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
536 unsigned char *buf, int size, int force_pts)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
537 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
538 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
539 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
540
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
541 AVOutputFormat null_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
542 "null",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
543 "null video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
544 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
545 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
546 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
547 #ifdef WORDS_BIGENDIAN
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
548 CODEC_ID_PCM_S16BE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
549 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
550 CODEC_ID_PCM_S16LE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
551 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
552 CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
553 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
554 null_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
555 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
556 .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
557 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
558
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
559 int raw_init(void)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
560 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
561 av_register_input_format(&mp3_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
562 av_register_output_format(&mp2_oformat);
126
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
563 #ifdef CONFIG_MP3LAME
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
564 av_register_output_format(&mp3_oformat);
23f62139c013 prefers MP3 codec (rather than MP2) for output if
michaelni
parents: 125
diff changeset
565 #endif
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
566 av_register_input_format(&ac3_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
567 av_register_output_format(&ac3_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
568
135
56590088f801 truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents: 128
diff changeset
569 av_register_input_format(&h263_iformat);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
570 av_register_output_format(&h263_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
571
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
572 av_register_input_format(&m4v_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
573 av_register_output_format(&m4v_oformat);
100
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
574
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
575 av_register_input_format(&h264_iformat);
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
576 av_register_output_format(&h264_oformat);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
577
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
578 av_register_input_format(&mpegvideo_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
579 av_register_output_format(&mpeg1video_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
580
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
581 av_register_input_format(&mjpeg_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
582 av_register_output_format(&mjpeg_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
583
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
584 av_register_input_format(&pcm_s16le_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
585 av_register_output_format(&pcm_s16le_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
586 av_register_input_format(&pcm_s16be_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
587 av_register_output_format(&pcm_s16be_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
588 av_register_input_format(&pcm_u16le_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
589 av_register_output_format(&pcm_u16le_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
590 av_register_input_format(&pcm_u16be_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
591 av_register_output_format(&pcm_u16be_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
592 av_register_input_format(&pcm_s8_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
593 av_register_output_format(&pcm_s8_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
594 av_register_input_format(&pcm_u8_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
595 av_register_output_format(&pcm_u8_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
596 av_register_input_format(&pcm_mulaw_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
597 av_register_output_format(&pcm_mulaw_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
598 av_register_input_format(&pcm_alaw_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
599 av_register_output_format(&pcm_alaw_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
600
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
601 av_register_input_format(&rawvideo_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
602 av_register_output_format(&rawvideo_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
603
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
604 av_register_output_format(&null_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
605 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
606 }