Mercurial > libavformat.hg
annotate sierravmd.c @ 1502:eae8cc31215e libavformat
indention
author | michael |
---|---|
date | Tue, 14 Nov 2006 13:33:05 +0000 |
parents | deaec052eec4 |
children | 32d49970f01a |
rev | line source |
---|---|
338 | 1 /* |
2 * Sierra VMD Format Demuxer | |
3 * Copyright (c) 2004 The ffmpeg Project | |
4 * | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
338 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
338 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
338 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
887
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
338 | 20 */ |
21 | |
22 /** | |
23 * @file sierravmd.c | |
24 * Sierra VMD file demuxer | |
25 * by Vladimir "VAG" Gneushev (vagsoft at mail.ru) | |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
26 * for more information on the Sierra VMD file format, visit: |
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
27 * http://www.pcisys.net/~melanson/codecs/ |
338 | 28 */ |
29 | |
30 #include "avformat.h" | |
31 | |
32 #define VMD_HEADER_SIZE 0x0330 | |
33 #define BYTES_PER_FRAME_RECORD 16 | |
34 | |
35 typedef struct { | |
36 int stream_index; | |
37 offset_t frame_offset; | |
38 unsigned int frame_size; | |
39 int64_t pts; | |
40 int keyframe; | |
41 unsigned char frame_record[BYTES_PER_FRAME_RECORD]; | |
42 } vmd_frame_t; | |
43 | |
44 typedef struct VmdDemuxContext { | |
45 int video_stream_index; | |
46 int audio_stream_index; | |
47 | |
48 unsigned int frame_count; | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
49 unsigned int frames_per_block; |
338 | 50 vmd_frame_t *frame_table; |
51 unsigned int current_frame; | |
52 | |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
53 int sample_rate; |
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
54 int64_t audio_sample_counter; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
55 int skiphdr; |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
56 |
338 | 57 unsigned char vmd_header[VMD_HEADER_SIZE]; |
58 } VmdDemuxContext; | |
59 | |
60 static int vmd_probe(AVProbeData *p) | |
61 { | |
62 if (p->buf_size < 2) | |
63 return 0; | |
64 | |
65 /* check if the first 2 bytes of the file contain the appropriate size | |
66 * of a VMD header chunk */ | |
67 if (LE_16(&p->buf[0]) != VMD_HEADER_SIZE - 2) | |
68 return 0; | |
69 | |
70 /* only return half certainty since this check is a bit sketchy */ | |
71 return AVPROBE_SCORE_MAX / 2; | |
72 } | |
73 | |
74 static int vmd_read_header(AVFormatContext *s, | |
75 AVFormatParameters *ap) | |
76 { | |
77 VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data; | |
78 ByteIOContext *pb = &s->pb; | |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
79 AVStream *st, *vst; |
338 | 80 unsigned int toc_offset; |
81 unsigned char *raw_frame_table; | |
82 int raw_frame_table_size; | |
83 offset_t current_offset; | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
84 int i, j; |
338 | 85 unsigned int total_frames; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
86 int64_t pts_inc = 1; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
87 int64_t current_video_pts = 0, current_audio_pts = 0; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
88 unsigned char chunk[BYTES_PER_FRAME_RECORD]; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
89 int num, den; |
338 | 90 |
91 /* fetch the main header, including the 2 header length bytes */ | |
92 url_fseek(pb, 0, SEEK_SET); | |
93 if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) | |
482 | 94 return AVERROR_IO; |
338 | 95 |
96 /* start up the decoders */ | |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
97 vst = av_new_stream(s, 0); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
98 if (!vst) |
338 | 99 return AVERROR_NOMEM; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
100 av_set_pts_info(vst, 33, 1, 10); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
101 vmd->video_stream_index = vst->index; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
102 vst->codec->codec_type = CODEC_TYPE_VIDEO; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
103 vst->codec->codec_id = CODEC_ID_VMDVIDEO; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
104 vst->codec->codec_tag = 0; /* no fourcc */ |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
105 vst->codec->width = LE_16(&vmd->vmd_header[12]); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
106 vst->codec->height = LE_16(&vmd->vmd_header[14]); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
107 vst->codec->extradata_size = VMD_HEADER_SIZE; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
108 vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
109 memcpy(vst->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE); |
338 | 110 |
111 /* if sample rate is 0, assume no audio */ | |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
112 vmd->sample_rate = LE_16(&vmd->vmd_header[804]); |
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
113 if (vmd->sample_rate) { |
338 | 114 st = av_new_stream(s, 0); |
115 if (!st) | |
116 return AVERROR_NOMEM; | |
117 vmd->audio_stream_index = st->index; | |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
118 st->codec->codec_type = CODEC_TYPE_AUDIO; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
119 st->codec->codec_id = CODEC_ID_VMDAUDIO; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
120 st->codec->codec_tag = 0; /* no fourcc */ |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
121 st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1; |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
122 st->codec->sample_rate = vmd->sample_rate; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
123 st->codec->block_align = LE_16(&vmd->vmd_header[806]); |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
124 if (st->codec->block_align & 0x8000) { |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
125 st->codec->bits_per_sample = 16; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
126 st->codec->block_align = -(st->codec->block_align - 0x10000); |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
127 } else { |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
128 st->codec->bits_per_sample = 8; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
129 } |
885 | 130 st->codec->bit_rate = st->codec->sample_rate * |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
815
diff
changeset
|
131 st->codec->bits_per_sample * st->codec->channels; |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
132 |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
133 /* calculate pts */ |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
134 num = st->codec->block_align; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
135 den = st->codec->sample_rate * st->codec->channels; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
136 av_reduce(&den, &num, den, num, (1UL<<31)-1); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
137 av_set_pts_info(vst, 33, num, den); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
138 av_set_pts_info(st, 33, num, den); |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
139 pts_inc = num; |
338 | 140 } |
141 | |
142 toc_offset = LE_32(&vmd->vmd_header[812]); | |
143 vmd->frame_count = LE_16(&vmd->vmd_header[6]); | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
144 vmd->frames_per_block = LE_16(&vmd->vmd_header[18]); |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
145 url_fseek(pb, toc_offset, SEEK_SET); |
338 | 146 |
147 raw_frame_table = NULL; | |
148 vmd->frame_table = NULL; | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
149 raw_frame_table_size = vmd->frame_count * 6; |
338 | 150 raw_frame_table = av_malloc(raw_frame_table_size); |
1079 | 151 if(vmd->frame_count * vmd->frames_per_block >= UINT_MAX / sizeof(vmd_frame_t)){ |
152 av_log(s, AV_LOG_ERROR, "vmd->frame_count * vmd->frames_per_block too large\n"); | |
153 return -1; | |
154 } | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
155 vmd->frame_table = av_malloc(vmd->frame_count * vmd->frames_per_block * sizeof(vmd_frame_t)); |
338 | 156 if (!raw_frame_table || !vmd->frame_table) { |
157 av_free(raw_frame_table); | |
158 av_free(vmd->frame_table); | |
159 return AVERROR_NOMEM; | |
160 } | |
885 | 161 if (get_buffer(pb, raw_frame_table, raw_frame_table_size) != |
338 | 162 raw_frame_table_size) { |
163 av_free(raw_frame_table); | |
164 av_free(vmd->frame_table); | |
482 | 165 return AVERROR_IO; |
338 | 166 } |
167 | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
168 total_frames = 0; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
169 for (i = 0; i < vmd->frame_count; i++) { |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
170 |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
171 current_offset = LE_32(&raw_frame_table[6 * i + 2]); |
338 | 172 |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
173 /* handle each entry in index block */ |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
174 for (j = 0; j < vmd->frames_per_block; j++) { |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
175 int type; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
176 uint32_t size; |
338 | 177 |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
178 get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD); |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
179 type = chunk[0]; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
180 size = LE_32(&chunk[2]); |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
181 if(!size) |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
182 continue; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
183 switch(type) { |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
184 case 1: /* Audio Chunk */ |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
185 vmd->frame_table[total_frames].frame_offset = current_offset; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
186 vmd->frame_table[total_frames].stream_index = vmd->audio_stream_index; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
187 vmd->frame_table[total_frames].frame_size = size; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
188 memcpy(vmd->frame_table[total_frames].frame_record, chunk, BYTES_PER_FRAME_RECORD); |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
189 vmd->frame_table[total_frames].pts = current_audio_pts; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
190 total_frames++; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
191 /* first audio chunk contains several audio buffers */ |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
192 current_audio_pts += (current_audio_pts == 0) ? LE_16(&vmd->vmd_header[808]) * pts_inc : pts_inc; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
193 break; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
194 case 2: /* Video Chunk */ |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
195 vmd->frame_table[total_frames].frame_offset = current_offset; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
196 vmd->frame_table[total_frames].stream_index = vmd->video_stream_index; |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
197 vmd->frame_table[total_frames].frame_size = size; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
198 memcpy(vmd->frame_table[total_frames].frame_record, chunk, BYTES_PER_FRAME_RECORD); |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
199 vmd->frame_table[total_frames].pts = current_video_pts; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
200 total_frames++; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
201 break; |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
202 } |
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
203 current_offset += size; |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
204 } |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
205 current_video_pts += pts_inc; |
338 | 206 } |
207 | |
208 av_free(raw_frame_table); | |
209 | |
210 vmd->current_frame = 0; | |
1004
409b399440a3
More correct demuxing and timestamp setting fot Sierra VMD
kostya
parents:
896
diff
changeset
|
211 vmd->frame_count = total_frames; |
338 | 212 |
213 return 0; | |
214 } | |
215 | |
216 static int vmd_read_packet(AVFormatContext *s, | |
217 AVPacket *pkt) | |
218 { | |
219 VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data; | |
220 ByteIOContext *pb = &s->pb; | |
221 int ret = 0; | |
222 vmd_frame_t *frame; | |
223 | |
224 if (vmd->current_frame >= vmd->frame_count) | |
482 | 225 return AVERROR_IO; |
338 | 226 |
227 frame = &vmd->frame_table[vmd->current_frame]; | |
228 /* position the stream (will probably be there already) */ | |
229 url_fseek(pb, frame->frame_offset, SEEK_SET); | |
230 | |
231 if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) | |
232 return AVERROR_NOMEM; | |
775 | 233 pkt->pos= url_ftell(pb); |
338 | 234 memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); |
885 | 235 ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, |
338 | 236 frame->frame_size); |
237 | |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
238 if (ret != frame->frame_size) { |
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
239 av_free_packet(pkt); |
482 | 240 ret = AVERROR_IO; |
387
f2760852ed18
minor VMD system update; still not perfect, but should not crash either
melanson
parents:
338
diff
changeset
|
241 } |
338 | 242 pkt->stream_index = frame->stream_index; |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
243 pkt->pts = frame->pts; |
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
244 av_log(NULL, AV_LOG_INFO, " dispatching %s frame with %d bytes and pts %"PRId64"\n", |
1441
ad3b03b7b142
reindentation, patch by From: Steve Lhomme, slhomme divxcorp com
diego
parents:
1358
diff
changeset
|
245 (frame->frame_record[0] == 0x02) ? "video" : "audio", |
ad3b03b7b142
reindentation, patch by From: Steve Lhomme, slhomme divxcorp com
diego
parents:
1358
diff
changeset
|
246 frame->frame_size + BYTES_PER_FRAME_RECORD, |
1492
deaec052eec4
Simplify VMD demuxer (but it still does not work right)
kostya
parents:
1441
diff
changeset
|
247 pkt->pts); |
338 | 248 |
249 vmd->current_frame++; | |
250 | |
251 return ret; | |
252 } | |
253 | |
254 static int vmd_read_close(AVFormatContext *s) | |
255 { | |
256 VmdDemuxContext *vmd = (VmdDemuxContext *)s->priv_data; | |
257 | |
258 av_free(vmd->frame_table); | |
259 | |
260 return 0; | |
261 } | |
262 | |
1169 | 263 AVInputFormat vmd_demuxer = { |
338 | 264 "vmd", |
265 "Sierra VMD format", | |
266 sizeof(VmdDemuxContext), | |
267 vmd_probe, | |
268 vmd_read_header, | |
269 vmd_read_packet, | |
270 vmd_read_close, | |
271 }; |