Mercurial > mplayer.hg
annotate libmpdemux/demux_nsv.c @ 36074:fbbf13706c50
Do not try with scale filter etc. when the format is a HWACCEL format.
author | reimar |
---|---|
date | Fri, 05 Apr 2013 14:21:40 +0000 |
parents | beafae9de2be |
children | f3c835ddce85 |
rev | line source |
---|---|
12175 | 1 /* |
2 * Nullsoft Streaming Video demuxer | |
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
3 * copyright (c) 2004 by Reza Jelveh <reza.jelveh@tuhh.de> |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
4 * Based on A'rpis G2 work |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
5 * |
12175 | 6 * seeking and PCM audio not yet supported |
7 * PCM needs extra audio chunk "miniheader" parsing | |
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
9 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
10 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
11 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
14 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
15 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
16 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
19 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
20 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
21 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
22 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26295
diff
changeset
|
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
12175 | 24 */ |
25 | |
34139
cc8dfde2b6c5
Fix off_t printf conversion specifiers and related warnings.
diego
parents:
32537
diff
changeset
|
26 #include <inttypes.h> |
12175 | 27 #include <stdio.h> |
28 #include <stdlib.h> | |
29 #include <unistd.h> | |
30 | |
31 #include "config.h" | |
32 #include "mp_msg.h" | |
33 #include "help_mp.h" | |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
20473
diff
changeset
|
34 #include "stream/stream.h" |
12175 | 35 #include "demuxer.h" |
36 #include "stheader.h" | |
37 | |
38 typedef struct { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
39 float v_pts; |
12175 | 40 int video_pack_no; |
41 unsigned int a_format; | |
42 unsigned int v_format; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
43 unsigned char fps; |
12175 | 44 } nsv_priv_t; |
45 | |
18251
fdb789f1a99a
Increase HEADER_SEARCH_SIZE, fixes high-bitrate streams from demoscene.tv.
diego
parents:
17636
diff
changeset
|
46 #define HEADER_SEARCH_SIZE 256000 |
16318 | 47 |
48 | |
12175 | 49 /** |
50 * Seeking still to be implemented | |
51 */ | |
17636 | 52 static void demux_seek_nsv ( demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags ) |
12175 | 53 { |
54 // seeking is not yet implemented | |
55 } | |
56 | |
57 | |
16175 | 58 static int demux_nsv_fill_buffer ( demuxer_t *demuxer, demux_stream_t *ds ) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
59 { |
12175 | 60 unsigned char hdr[17]; |
61 // for the extra data | |
62 unsigned char aux[6]; | |
63 int i_aux = 0; | |
64 // videolen = audio chunk length, audiolen = video chunk length | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
65 int videolen,audiolen; |
12175 | 66 |
12272 | 67 sh_video_t *sh_video = demuxer->video->sh; |
68 sh_audio_t *sh_audio = demuxer->audio->sh; | |
12175 | 69 |
70 nsv_priv_t * priv = demuxer->priv; | |
71 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
72 // if the audio/video chunk has no new header the first 2 bytes will be discarded 0xBEEF |
12175 | 73 // or rather 0xEF 0xBE |
74 stream_read(demuxer->stream,hdr,7); | |
75 if(stream_eof(demuxer->stream)) return 0; | |
76 // sometimes instead of 0xBEEF as described for the next audio/video chunk we get | |
77 // a whole new header | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
78 |
34144
beafae9de2be
Employ correct off_t printf conversion specifiers; this time without typos.
diego
parents:
34139
diff
changeset
|
79 mp_dbg(MSGT_DEMUX, MSGL_DBG2, "demux_nsv: %08X %08"PRIX64"\n", |
34139
cc8dfde2b6c5
Fix off_t printf conversion specifiers and related warnings.
diego
parents:
32537
diff
changeset
|
80 hdr[0] << 8 | hdr[1], stream_tell(demuxer->stream)); |
12175 | 81 switch(hdr[0]<<8|hdr[1]) { |
82 case 0x4E53: | |
83 if(hdr[2]==0x56 && hdr[3]==0x73){ | |
84 // NSVs | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
85 // get the header since there is no more metaheader after the first one |
12175 | 86 // there is no more need to skip that |
87 stream_read(demuxer->stream,hdr+7,17-7); | |
88 stream_read(demuxer->stream,hdr,7); | |
89 } | |
90 break; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
91 |
12175 | 92 case 0xEFBE: |
93 break; | |
94 | |
95 default: | |
12272 | 96 mp_dbg(MSGT_DEMUX,MSGL_WARN,"demux_nsv: sync lost\n"); |
12175 | 97 break; |
98 } | |
99 | |
12272 | 100 if (sh_video) |
12175 | 101 sh_video->pts = priv->v_pts =demuxer->video->pts= priv->video_pack_no * |
102 (float)sh_video->frametime; | |
12272 | 103 else |
104 priv->v_pts = priv->video_pack_no; | |
12175 | 105 |
106 demuxer->filepos=stream_tell(demuxer->stream); | |
107 | |
108 | |
109 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"demux_nsv: %08X: %02X %02X | %02X %02X %02X | %02X %02X \n", | |
110 (int)demuxer->filepos, hdr[0],hdr[1],hdr[2],hdr[3],hdr[4],hdr[5],hdr[6]); | |
111 | |
112 // read video: | |
113 videolen=(hdr[2]>>4)|(hdr[3]<<4)|(hdr[4]<<0xC); | |
114 //check if we got extra data like subtitles here | |
115 if( (hdr[2]&0x0f) != 0x0 ) { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
116 stream_read( demuxer->stream, aux, 6); |
12175 | 117 |
118 i_aux = aux[0]|aux[1]<<8; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
119 // We skip this extra data |
12175 | 120 stream_skip( demuxer->stream, i_aux ); |
121 i_aux+=6; | |
122 videolen -= i_aux; | |
123 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
124 |
12175 | 125 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
126 // we need to return an empty packet when the |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
127 // video frame is empty otherwise the stream will fasten up |
12272 | 128 if(sh_video) { |
12175 | 129 if( (hdr[2]&0x0f) != 0x0 ) |
130 ds_read_packet(demuxer->video,demuxer->stream,videolen,priv->v_pts,demuxer->filepos-i_aux,0); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
131 else |
12175 | 132 ds_read_packet(demuxer->video,demuxer->stream,videolen,priv->v_pts,demuxer->filepos,0); |
133 } | |
134 else | |
135 stream_skip(demuxer->stream,videolen); | |
136 | |
137 // read audio: | |
138 audiolen=(hdr[5])|(hdr[6]<<8); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
139 // we need to return an empty packet when the |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
140 // audio frame is empty otherwise the stream will fasten up |
12272 | 141 if(sh_audio) { |
12175 | 142 ds_read_packet(demuxer->audio,demuxer->stream,audiolen,priv->v_pts,demuxer->filepos+videolen,0); |
143 } | |
144 else | |
145 stream_skip(demuxer->stream,audiolen); | |
146 | |
147 ++priv->video_pack_no; | |
148 | |
149 return 1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
150 |
12175 | 151 } |
152 | |
153 | |
16175 | 154 static demuxer_t* demux_open_nsv ( demuxer_t* demuxer ) |
12175 | 155 { |
156 // last 2 bytes 17 and 18 are unknown but right after that comes the length | |
157 unsigned char hdr[17]; | |
158 int videolen,audiolen; | |
12272 | 159 unsigned char buf[10]; |
12175 | 160 sh_video_t *sh_video = NULL; |
161 sh_audio_t *sh_audio = NULL; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
162 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
163 |
12175 | 164 nsv_priv_t * priv = malloc(sizeof(nsv_priv_t)); |
165 demuxer->priv=priv; | |
166 priv->video_pack_no=0; | |
167 | |
168 /* disable seeking yet to be fixed*/ | |
169 demuxer->seekable = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
170 |
12175 | 171 stream_read(demuxer->stream,hdr,4); |
172 if(stream_eof(demuxer->stream)) return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
173 |
12175 | 174 if(hdr[0]==0x4E && hdr[1]==0x53 && hdr[2]==0x56){ |
175 // NSV header! | |
176 if(hdr[3]==0x73){ | |
177 // NSVs | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
178 stream_read(demuxer->stream,hdr+4,17-4); |
12175 | 179 } |
180 | |
181 if(hdr[3]==0x66){ | |
182 // NSVf | |
183 int len=stream_read_dword_le(demuxer->stream); | |
184 // TODO: parse out metadata!!!! | |
185 stream_skip(demuxer->stream,len-8); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
186 |
12175 | 187 // NSVs |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
188 stream_read(demuxer->stream,hdr,17); |
20470
054516eecb9b
Better check for non-broken NSVf-header to avoid incorrect detection.
reimar
parents:
18885
diff
changeset
|
189 if (stream_eof(demuxer->stream) || strncmp(hdr, "NSVs", 4)) |
054516eecb9b
Better check for non-broken NSVf-header to avoid incorrect detection.
reimar
parents:
18885
diff
changeset
|
190 return 0; |
12175 | 191 } |
192 | |
193 // dummy debug message | |
194 mp_msg(MSGT_DEMUX,MSGL_V,"demux_nsv: Header: %.12s\n",hdr); | |
195 | |
196 // bytes 8-11 audio codec fourcc | |
197 // PCM fourcc needs extra parsing for every audio chunk, yet to implement | |
12896 | 198 if((demuxer->audio->id != -2) && strncmp(hdr+8,"NONE", 4)){//&&strncmp(hdr+8,"VLB ", 4)){ |
31609
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
29263
diff
changeset
|
199 sh_audio = new_sh_audio ( demuxer, 0, NULL ); |
26295
c8a489c8cae8
Set demuxer->audio->id to avoid breakage due to r26301
reimar
parents:
25707
diff
changeset
|
200 demuxer->audio->id = 0; |
12175 | 201 demuxer->audio->sh = sh_audio; |
202 sh_audio->format=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]); | |
203 sh_audio->ds = demuxer->audio; | |
12896 | 204 priv->a_format=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]); |
12175 | 205 } |
206 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
207 // store hdr fps |
12175 | 208 priv->fps=hdr[16]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
209 |
12896 | 210 if ((demuxer->video->id != -2) && strncmp(hdr+4,"NONE", 4)) { |
12198 | 211 /* Create a new video stream header */ |
212 sh_video = new_sh_video ( demuxer, 0 ); | |
213 | |
214 /* Make sure the demuxer knows about the new video stream header | |
215 * (even though new_sh_video() ought to take care of it) | |
216 */ | |
217 demuxer->video->sh = sh_video; | |
218 | |
219 /* Make sure that the video demuxer stream header knows about its | |
220 * parent video demuxer stream (this is getting wacky), or else | |
221 * video_read_properties() will choke | |
222 */ | |
223 sh_video->ds = demuxer->video; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
224 |
12175 | 225 // bytes 4-7 video codec fourcc |
226 priv->v_format = sh_video->format=mmioFOURCC(hdr[4],hdr[5],hdr[6],hdr[7]); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
227 |
12175 | 228 // new video stream! parse header |
229 sh_video->disp_w=hdr[12]|(hdr[13]<<8); | |
230 sh_video->disp_h=hdr[14]|(hdr[15]<<8); | |
32105 | 231 sh_video->bih=calloc(1,sizeof(*sh_video->bih)); |
232 sh_video->bih->biSize=sizeof(*sh_video->bih); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
233 sh_video->bih->biPlanes=1; |
12175 | 234 sh_video->bih->biBitCount=24; |
235 sh_video->bih->biWidth=hdr[12]|(hdr[13]<<8); | |
236 sh_video->bih->biHeight=hdr[14]|(hdr[15]<<8); | |
237 memcpy(&sh_video->bih->biCompression,hdr+4,4); | |
238 sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*3; | |
239 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
240 // here we search for the correct keyframe |
12275 | 241 // vp6 keyframe is when the 2nd byte of the vp6 header is |
242 // 0x36 for VP61 and 0x46 for VP62 | |
12272 | 243 if((priv->v_format==mmioFOURCC('V','P','6','1')) || |
244 (priv->v_format==mmioFOURCC('V','P','6','2')) || | |
245 (priv->v_format==mmioFOURCC('V','P','3','1'))) { | |
246 stream_read(demuxer->stream,buf,10); | |
12277 | 247 if (((((priv->v_format>>16) & 0xff) == '6') && ((buf[8]&0x0e)!=0x06)) || |
12272 | 248 ((((priv->v_format>>16) & 0xff) == '3') && (buf[8]!=0x00 || buf[9]!=0x08))) { |
249 mp_msg(MSGT_DEMUX,MSGL_V,"demux_nsv: searching %.4s keyframe...\n", (char*)&priv->v_format); | |
12277 | 250 while(((((priv->v_format>>16) & 0xff) == '6') && ((buf[8]&0x0e)!=0x06)) || |
12272 | 251 ((((priv->v_format>>16) & 0xff) == '3') && (buf[8]!=0x00 || buf[9]!=0x08))){ |
252 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_nsv: %.4s block skip.\n", (char*)&priv->v_format); | |
12179
aeb377ccb110
Fix vp61 keyframe search (do not skip blocks if 1st frame is keyframe)
rtognimp
parents:
12175
diff
changeset
|
253 videolen=(buf[2]>>4)|(buf[3]<<4)|(buf[4]<<0xC); |
aeb377ccb110
Fix vp61 keyframe search (do not skip blocks if 1st frame is keyframe)
rtognimp
parents:
12175
diff
changeset
|
254 audiolen=(buf[5])|(buf[6]<<8); |
12272 | 255 stream_skip(demuxer->stream, videolen+audiolen-3); |
256 stream_read(demuxer->stream,buf,10); | |
12277 | 257 if(stream_eof(demuxer->stream)) return 0; |
12179
aeb377ccb110
Fix vp61 keyframe search (do not skip blocks if 1st frame is keyframe)
rtognimp
parents:
12175
diff
changeset
|
258 if(buf[0]==0x4E){ |
aeb377ccb110
Fix vp61 keyframe search (do not skip blocks if 1st frame is keyframe)
rtognimp
parents:
12175
diff
changeset
|
259 mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_nsv: Got NSVs block.\n"); |
12272 | 260 stream_skip(demuxer->stream,7); |
261 stream_read(demuxer->stream,buf,10); | |
12175 | 262 } |
263 } | |
264 } | |
265 | |
13299
6f8fe531dd73
avoid always skipping first junk with a "sync lost" message
reimar
parents:
12896
diff
changeset
|
266 // data starts 10 bytes before current pos but later |
6f8fe531dd73
avoid always skipping first junk with a "sync lost" message
reimar
parents:
12896
diff
changeset
|
267 // we seek 17 backwards |
6f8fe531dd73
avoid always skipping first junk with a "sync lost" message
reimar
parents:
12896
diff
changeset
|
268 stream_skip(demuxer->stream,7); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
269 } |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
270 |
12175 | 271 switch(priv->fps){ |
272 case 0x80: | |
273 sh_video->fps=30; | |
274 break; | |
275 case 0x81: | |
276 sh_video->fps=(float)30000.0/1001.0; | |
277 break; | |
278 case 0x82: | |
279 sh_video->fps=25; | |
280 break; | |
281 case 0x83: | |
282 sh_video->fps=(float)24000.0/1001.0; | |
283 break; | |
284 case 0x85: | |
285 sh_video->fps=(float)15000.0/1001.0; | |
286 break; | |
15991 | 287 case 0x89: |
288 sh_video->fps=(float)10000.0/1001.0; | |
289 break; | |
12175 | 290 default: |
291 sh_video->fps = (float)priv->fps; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
292 } |
12175 | 293 sh_video->frametime = (float)1.0 / (float)sh_video->fps; |
12198 | 294 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
295 } |
12175 | 296 |
13299
6f8fe531dd73
avoid always skipping first junk with a "sync lost" message
reimar
parents:
12896
diff
changeset
|
297 // seek to start of NSV header |
6f8fe531dd73
avoid always skipping first junk with a "sync lost" message
reimar
parents:
12896
diff
changeset
|
298 stream_seek(demuxer->stream,stream_tell(demuxer->stream)-17); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
299 |
12175 | 300 return demuxer; |
301 } | |
302 | |
16175 | 303 static int nsv_check_file ( demuxer_t* demuxer ) |
12175 | 304 { |
20473 | 305 uint32_t hdr = 0; |
16318 | 306 int i; |
12175 | 307 |
308 mp_msg ( MSGT_DEMUX, MSGL_V, "Checking for Nullsoft Streaming Video\n" ); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
309 |
16318 | 310 for (i = 0; i < HEADER_SEARCH_SIZE; i++) { |
20473 | 311 uint8_t c = stream_read_char(demuxer->stream); |
312 if (stream_eof(demuxer->stream)) | |
16318 | 313 return 0; |
20473 | 314 if (hdr == mmioFOURCC('s', 'V', 'S', 'N') || |
315 (hdr == mmioFOURCC('f', 'V', 'S', 'N') && !c)) { | |
316 stream_seek(demuxer->stream,stream_tell(demuxer->stream)-5); | |
16318 | 317 return DEMUXER_TYPE_NSV; |
318 } | |
20473 | 319 hdr = (hdr << 8) | c; |
16318 | 320 } |
321 | |
322 return 0; | |
12175 | 323 } |
324 | |
16175 | 325 static void demux_close_nsv(demuxer_t* demuxer) { |
12175 | 326 nsv_priv_t* priv = demuxer->priv; |
327 | |
328 free(priv); | |
329 | |
330 } | |
16175 | 331 |
332 | |
25707
d4fe6e23283e
Make all demuxer_desc_t const, thus moving them to .rodata
reimar
parents:
22605
diff
changeset
|
333 const demuxer_desc_t demuxer_desc_nsv = { |
16175 | 334 "NullsoftVideo demuxer", |
335 "nsv", | |
336 "Nullsoft Streaming Video", | |
337 "Reza Jelveh", | |
338 "nsv and nsa streaming files", | |
339 DEMUXER_TYPE_NSV, | |
16318 | 340 0, // safe but expensive autodetect |
16175 | 341 nsv_check_file, |
342 demux_nsv_fill_buffer, | |
343 demux_open_nsv, | |
344 demux_close_nsv, | |
345 demux_seek_nsv, | |
346 NULL | |
347 }; |