2 * ASF file parser for DEMUXER v0.3
3 * copyright (c) 2001 A'rpi/ESP-team
5 * This file is part of MPlayer.
7 * MPlayer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * MPlayer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "stream/stream.h"
32 #include "asfheader.h"
34 #include "libmpcodecs/dec_audio.h"
35 #include "libvo/fastmemcpy.h"
36 #include "ffmpeg_files/intreadwrite.h"
38 // based on asf file-format doc by Eugene [http://divx.euro.ru]
41 * \brief reads int stored in number of bytes given by len
42 * \param ptr pointer to read from, is incremented appropriately
43 * \param len lowest 2 bits indicate number of bytes to read
44 * \param def default value to return if len is invalid
46 static inline unsigned read_varlen(uint8_t **ptr
, int len
, int def
) {
47 const uint8_t *p
= *ptr
;
50 case 1: *ptr
+= 1; return *p
;
51 case 2: *ptr
+= 2; return AV_RL16(p
);
52 case 3: *ptr
+= 4; return AV_RL32(p
);
58 * \brief checks if there is enough data to read the bytes given by len
59 * \param ptr pointer to read from
60 * \param endptr pointer to the end of the buffer
61 * \param len lowest 2 bits indicate number of bytes to read
63 static inline int check_varlen(uint8_t *ptr
, uint8_t *endptr
, int len
) {
64 return len
&3 ? ptr
+ (1<<((len
&3) - 1)) <= endptr
: 1;
67 static void asf_descrambling(unsigned char **src
,unsigned len
, struct asf_priv
* asf
){
69 unsigned char *s2
=*src
;
71 if (len
> UINT_MAX
- MP_INPUT_BUFFER_PADDING_SIZE
)
73 dst
= malloc(len
+ MP_INPUT_BUFFER_PADDING_SIZE
);
74 while(len
>=asf
->scrambling_h
*asf
->scrambling_w
*asf
->scrambling_b
+i
){
75 // mp_msg(MSGT_DEMUX,MSGL_DBG4,"descrambling! (w=%d b=%d)\n",w,asf_scrambling_b);
76 //i+=asf_scrambling_h*asf_scrambling_w;
77 for(x
=0;x
<asf
->scrambling_w
;x
++)
78 for(y
=0;y
<asf
->scrambling_h
;y
++){
79 fast_memcpy(dst
+i
,s2
+(y
*asf
->scrambling_w
+x
)*asf
->scrambling_b
,asf
->scrambling_b
);
82 s2
+=asf
->scrambling_h
*asf
->scrambling_w
*asf
->scrambling_b
;
84 //if(i<len) fast_memcpy(dst+i,src+i,len-i);
89 /*****************************************************************
90 * \brief initializes asf private data
93 static void init_priv (struct asf_priv
* asf
){
95 asf
->vid_ext_timing_index
=-1;
96 asf
->aud_ext_timing_index
=-1;
97 asf
->vid_ext_frame_index
=-1;
100 static void demux_asf_append_to_packet(demux_packet_t
* dp
,unsigned char *data
,int len
,int offs
)
102 if(dp
->len
!=offs
&& offs
!=-1) mp_msg(MSGT_DEMUX
,MSGL_V
,"warning! fragment.len=%d BUT next fragment offset=%d \n",dp
->len
,offs
);
103 dp
->buffer
=realloc(dp
->buffer
,dp
->len
+len
+MP_INPUT_BUFFER_PADDING_SIZE
);
104 fast_memcpy(dp
->buffer
+dp
->len
,data
,len
);
105 memset(dp
->buffer
+dp
->len
+len
, 0, MP_INPUT_BUFFER_PADDING_SIZE
);
106 mp_dbg(MSGT_DEMUX
,MSGL_DBG4
,"data appended! %d+%d\n",dp
->len
,len
);
110 static int demux_asf_read_packet(demuxer_t
*demux
,unsigned char *data
,int len
,int id
,int seq
,uint64_t time
,unsigned short dur
,int offs
,int keyframe
){
111 struct asf_priv
* asf
= demux
->priv
;
112 demux_stream_t
*ds
=NULL
;
115 mp_dbg(MSGT_DEMUX
,MSGL_DBG4
,"demux_asf.read_packet: id=%d seq=%d len=%d\n",id
,seq
,len
);
117 if(demux
->video
->id
==-1)
118 if(demux
->v_streams
[id
])
121 if(demux
->audio
->id
==-1)
122 if(demux
->a_streams
[id
])
125 if(id
==demux
->audio
->id
){
129 ds
->sh
=demux
->a_streams
[id
];
130 mp_msg(MSGT_DEMUX
,MSGL_V
,"Auto-selected ASF audio ID = %d\n",ds
->id
);
133 if(id
==demux
->video
->id
){
137 ds
->sh
=demux
->v_streams
[id
];
138 mp_msg(MSGT_DEMUX
,MSGL_V
,"Auto-selected ASF video ID = %d\n",ds
->id
);
144 demux_packet_t
* dp
=ds
->asf_packet
;
146 if (ds
==demux
->video
&& asf
->asf_is_dvr_ms
) {
147 if (asf
->new_vid_frame_seg
) {
148 dp
->pos
=demux
->filepos
;
150 } else seq
= ds
->asf_seq
;
151 } else close_seg
= ds
->asf_seq
!=seq
;
154 // closed segment, finalize packet:
156 if(asf
->scrambling_h
>1 && asf
->scrambling_w
>1 && asf
->scrambling_b
>0)
157 asf_descrambling(&ds
->asf_packet
->buffer
,ds
->asf_packet
->len
,asf
);
158 ds_add_packet(ds
,ds
->asf_packet
);
161 // append data to it!
162 demux_asf_append_to_packet(dp
,data
,len
,offs
);
167 // create new packet:
168 { demux_packet_t
* dp
;
170 mp_msg(MSGT_DEMUX
,MSGL_V
,"warning! broken fragment, %d bytes missing \n",offs
);
173 dp
=new_demux_packet(len
);
174 fast_memcpy(dp
->buffer
,data
,len
);
175 if (asf
->asf_is_dvr_ms
)
176 dp
->pts
=time
*0.0000001;
180 // if(ds==demux->video) printf("ASF time: %8d dur: %5d \n",time,dur);
181 dp
->pos
=demux
->filepos
;
192 /*****************************************************************
193 * \brief read the replicated data associated with each segment
194 * \parameter pp reference to replicated data
195 * \parameter id stream number
196 * \parameter seq media object number
197 * \parameter keyframe key frame indicator - set to zero if keyframe, non-zero otherwise
198 * \parameter seg_time set to payload time when valid, if audio or new video frame payload, zero otherwise
201 static void get_payload_extension_data(demuxer_t
*demux
, unsigned char** pp
, unsigned char id
, unsigned int seq
, int *keyframe
, uint64_t *seg_time
){
202 struct asf_priv
* asf
= demux
->priv
;
203 uint64_t payload_time
; //100ns units
204 int i
, ext_max
, ext_timing_index
;
207 if(demux
->video
->id
==-1)
208 if(demux
->v_streams
[id
])
211 if(demux
->audio
->id
==-1)
212 if(demux
->a_streams
[id
])
215 if (id
!=demux
->video
->id
&& id
!=demux
->audio
->id
) return;
217 if (id
==demux
->video
->id
) {
218 ext_max
= asf
->vid_repdata_count
;
219 ext_timing_index
= asf
->vid_ext_timing_index
;
221 ext_max
= asf
->aud_repdata_count
;
222 ext_timing_index
= asf
->aud_ext_timing_index
;
226 asf
->new_vid_frame_seg
= 0;
228 for (i
=0; i
<ext_max
; i
++) {
230 uint8_t segment_marker
;
232 if (id
==demux
->video
->id
)
233 payextsize
= asf
->vid_repdata_sizes
[i
];
235 payextsize
= asf
->aud_repdata_sizes
[i
];
237 if (payextsize
== 65535) {
238 payextsize
= AV_RL16(pi
);
242 // if this is the timing info extension then read the payload time
243 if (i
== ext_timing_index
)
244 payload_time
= AV_RL64(pi
+8);
246 // if this is the video frame info extension then
247 // set the keyframe indicator, the 'new frame segment' indicator
248 // and (initially) the 'frame time'
249 if (i
== asf
->vid_ext_frame_index
&& id
==demux
->video
->id
) {
250 segment_marker
= pi
[0];
251 // Known video stream segment_marker values that
252 // contain useful information:
254 // NTSC/ATSC (29.97fps): 0X4A 01001010
258 // PAL/ATSC (25fps): 0X3A 00111010
262 // ATSC progressive (29.97fps): 0X7A 01111010
266 // ^ this is new video frame marker
268 // ^^^^ these bits indicate the framerate
269 // 0X4 is 29.97i, 0X3 is 25i, 0X7 is 29.97p, ???=25p
271 // ^^^ these bits indicate the frame type:
273 // 010 and 011 probably mean P and B
275 asf
->new_vid_frame_seg
= (0X08 & segment_marker
) && seq
!= asf
->last_vid_seq
;
277 if (asf
->new_vid_frame_seg
) asf
->last_vid_seq
= seq
;
279 if (asf
->avg_vid_frame_time
== 0) {
280 // set the average frame time initially (in 100ns units).
281 // This is based on what works for known samples.
282 // It can be extended if more samples of different types can be obtained.
283 if (((segment_marker
& 0XF0) >> 4) == 4) {
284 asf
->avg_vid_frame_time
= (uint64_t)((1.001 / 30.0) * 10000000.0);
285 asf
->know_frame_time
=1;
286 } else if (((segment_marker
& 0XF0) >> 4) == 3) {
287 asf
->avg_vid_frame_time
= (uint64_t)(0.04 * 10000000.0);
288 asf
->know_frame_time
=1;
289 } else if (((segment_marker
& 0XF0) >> 4) == 6) {
290 asf
->avg_vid_frame_time
= (uint64_t)(0.02 * 10000000.0);
291 asf
->know_frame_time
=1;
292 } else if (((segment_marker
& 0XF0) >> 4) == 7) {
293 asf
->avg_vid_frame_time
= (uint64_t)((1.001 / 60.0) * 10000000.0);
294 asf
->know_frame_time
=1;
296 // we dont know the frame time initially so
297 // make a guess and then recalculate as we go.
298 asf
->avg_vid_frame_time
= (uint64_t)((1.001 / 60.0) * 10000000.0);
299 asf
->know_frame_time
=0;
302 *keyframe
= (asf
->new_vid_frame_seg
&& (segment_marker
& 0X07) == 1);
307 if (id
==demux
->video
->id
&& asf
->new_vid_frame_seg
) {
309 // Some samples only have timings on key frames and
310 // the rest contain non-cronological timestamps. Interpolating
311 // the values between key frames works for all samples.
313 asf
->found_first_key_frame
=1;
314 if (!asf
->know_frame_time
&& asf
->last_key_payload_time
> 0) {
315 // We dont know average frametime so recalculate.
316 // Giving precedence to the 'weight' of the existing
317 // average limits damage done to new value when there is
318 // a sudden time jump which happens occasionally.
319 asf
->avg_vid_frame_time
=
320 (0.9 * asf
->avg_vid_frame_time
) +
321 (0.1 * ((payload_time
- asf
->last_key_payload_time
) / asf
->vid_frame_ct
));
323 asf
->last_key_payload_time
= payload_time
;
324 asf
->vid_frame_ct
= 1;
325 *seg_time
= payload_time
;
327 *seg_time
= (asf
->last_key_payload_time
+ (asf
->avg_vid_frame_time
* (asf
->vid_frame_ct
-1)));
330 if (id
==demux
->audio
->id
) {
331 if (payload_time
!= -1)
332 asf
->last_aud_diff
= payload_time
- asf
->last_aud_pts
;
333 asf
->last_aud_pts
+= asf
->last_aud_diff
;
334 *seg_time
= asf
->last_aud_pts
;
337 //static int num_elementary_packets100=0;
338 //static int num_elementary_packets101=0;
341 // 0 = EOF or no stream found
342 // 1 = successfully read a packet
343 static int demux_asf_fill_buffer(demuxer_t
*demux
, demux_stream_t
*ds
){
344 struct asf_priv
* asf
= demux
->priv
;
346 demux
->filepos
=stream_tell(demux
->stream
);
347 // Brodcast stream have movi_start==movi_end
349 if((demux
->movi_start
< demux
->movi_end
) && (demux
->filepos
>=demux
->movi_end
)){
350 demux
->stream
->eof
=1;
354 stream_read(demux
->stream
,asf
->packet
,asf
->packetsize
);
355 if(demux
->stream
->eof
) return 0; // EOF
356 if(asf
->packetsize
< 2) return 0; // Packet too short
359 unsigned char* p
=asf
->packet
;
360 unsigned char* p_end
=asf
->packet
+asf
->packetsize
;
361 unsigned char flags
=p
[0];
362 unsigned char segtype
=p
[1];
366 unsigned long time
=0;
367 unsigned short duration
=0;
370 unsigned char segsizetype
=0x80;
373 if( mp_msg_test(MSGT_DEMUX
,MSGL_DBG2
) ){
375 for(i
=0;i
<FFMIN(16, asf
->packetsize
);i
++) printf(" %02X",asf
->packet
[i
]);
379 // skip ECC data if present by testing bit 7 of flags
380 // 1xxxbbbb -> ecc data present, skip bbbb byte(s)
381 // 0xxxxxxx -> payload parsing info starts
384 p
+= (flags
& 0x0f)+1;
385 if (p
+1 >= p_end
) return 0; // Packet too short
390 //if(segtype!=0x5d) printf("Warning! packet[4] != 0x5d \n");
392 p
+=2; // skip flags & segtype
394 // Read packet size (plen):
395 if(!check_varlen(p
, p_end
, flags
>> 5)) return 0; // Not enough data
396 plen
= read_varlen(&p
, flags
>> 5, 0);
399 if(!check_varlen(p
, p_end
, flags
>> 1)) return 0; // Not enough data
400 sequence
= read_varlen(&p
, flags
>> 1, 0);
402 // Read padding size (padding):
403 if(!check_varlen(p
, p_end
, flags
>> 3)) return 0; // Not enough data
404 padding
= read_varlen(&p
, flags
>> 3, 0);
406 if(((flags
>>5)&3)!=0){
407 // Explicit (absoulte) packet size
408 mp_dbg(MSGT_DEMUX
,MSGL_DBG2
,"Explicit packet size specified: %d \n",plen
);
409 if(plen
>asf
->packetsize
) mp_msg(MSGT_DEMUX
,MSGL_V
,"Warning! plen>packetsize! (%d>%d) \n",plen
,asf
->packetsize
);
411 // Padding (relative) size
412 plen
=asf
->packetsize
-padding
;
415 // Read time & duration:
416 if (p
+5 >= p_end
) return 0; // Packet too short
417 time
= AV_RL32(p
); p
+=4;
418 duration
= AV_RL16(p
); p
+=2;
420 // Read payload flags:
422 // multiple sub-packets
423 if (p
>= p_end
) return 0; // Packet too short
428 mp_dbg(MSGT_DEMUX
,MSGL_DBG4
,"%08"PRIu64
": flag=%02X segs=%d seq=%u plen=%u pad=%u time=%ld dur=%d\n",
429 (uint64_t)demux
->filepos
,flags
,segs
,sequence
,plen
,padding
,time
,duration
);
431 for(seg
=0;seg
<segs
;seg
++){
433 unsigned char streamno
;
435 unsigned int x
; // offset or timestamp
443 mp_msg(MSGT_DEMUX
,MSGL_V
,"Warning! invalid packet 1, aborting parsing...\n");
447 if( mp_msg_test(MSGT_DEMUX
,MSGL_DBG2
) ){
449 printf("seg %d:",seg
);
450 for(i
=0;i
<FFMIN(16, p_end
- p
);i
++) printf(" %02X",p
[i
]);
455 if(p
[0]&0x80) keyframe
=1;
458 // Read media object number (seq):
459 if(!check_varlen(p
, p_end
, segtype
>> 4)) break; // Not enough data
460 seq
= read_varlen(&p
, segtype
>> 4, 0);
462 // Read offset or timestamp:
463 if(!check_varlen(p
, p_end
, segtype
>> 2)) break; // Not enough data
464 x
= read_varlen(&p
, segtype
>> 2, 0);
466 // Read replic.data len:
467 if(!check_varlen(p
, p_end
, segtype
)) break; // Not enough data
468 rlen
= read_varlen(&p
, segtype
, 0);
470 // printf("### rlen=%d \n",rlen);
473 case 0x01: // 1 = special, means grouping
474 //printf("grouping: %02X \n",p[0]);
475 ++p
; // skip PTS delta
479 p
+=4; // skip object size
480 if (p
+3 >= p_end
) break; // Packet too short
481 time2
=AV_RL32(p
); // read PTS
482 if (asf
->asf_is_dvr_ms
)
483 get_payload_extension_data(demux
, &p
, streamno
, seq
, &keyframe
, &time2
);
486 mp_msg(MSGT_DEMUX
,MSGL_V
,"unknown segment type (rlen): 0x%02X \n",rlen
);
494 if(!check_varlen(p
, p_end
, segsizetype
)) break; // Not enough data
495 len
= read_varlen(&p
, segsizetype
, plen
-(p
-asf
->packet
));
498 len
=plen
-(p
-asf
->packet
);
500 if(len
<0 || (p
+len
)>p_end
){
501 mp_msg(MSGT_DEMUX
,MSGL_V
,"ASF_parser: warning! segment len=%d\n",len
);
504 mp_dbg(MSGT_DEMUX
,MSGL_DBG4
," seg #%d: streamno=%d seq=%d type=%02X len=%d\n",seg
,streamno
,seq
,rlen
,len
);
509 //printf("ASF_parser: warning! grouping (flag=1) not yet supported!\n",len);
510 //printf(" total: %d \n",len);
514 //printf(" group part: %d bytes\n",len2);
515 if(len2
> len
- 1 || len2
< 0) break; // Not enough data
516 len2
= FFMIN(len2
, asf
->packetsize
);
517 demux_asf_read_packet(demux
,p
,len2
,streamno
,seq
,x
,duration
,-1,keyframe
);
523 mp_msg(MSGT_DEMUX
,MSGL_V
,"ASF_parser: warning! groups total != len\n");
528 //printf("fragment offset: %d \n",sh->x);
530 if (!asf
->asf_is_dvr_ms
|| asf
->found_first_key_frame
) {
531 len
= FFMIN(len
, asf
->packetsize
);
532 demux_asf_read_packet(demux
,p
,len
,streamno
,seq
,time2
,duration
,x
,keyframe
);
542 mp_msg(MSGT_DEMUX
,MSGL_V
,"%08"PRIX64
": UNKNOWN TYPE %02X %02X %02X %02X %02X...\n",(int64_t)demux
->filepos
,asf
->packet
[0],asf
->packet
[1],asf
->packet
[2],asf
->packet
[3],asf
->packet
[4]);
546 #include "stheader.h"
548 static void demux_seek_asf(demuxer_t
*demuxer
,float rel_seek_secs
,float audio_delay
,int flags
){
549 struct asf_priv
* asf
= demuxer
->priv
;
550 demux_stream_t
*d_audio
=demuxer
->audio
;
551 demux_stream_t
*d_video
=demuxer
->video
;
552 sh_audio_t
*sh_audio
=d_audio
->sh
;
553 // sh_video_t *sh_video=d_video->sh;
555 //FIXME: OFF_T - didn't test ASF case yet (don't have a large asf...)
556 //FIXME: reports good or bad to steve@daviesfam.org please
558 //================= seek in ASF ==========================
559 float p_rate
=asf
->packetrate
; // packets / sec
560 off_t rel_seek_packs
=(flags
&SEEK_FACTOR
)? // FIXME: int may be enough?
561 (rel_seek_secs
*(demuxer
->movi_end
-demuxer
->movi_start
)/asf
->packetsize
):
562 (rel_seek_secs
*p_rate
);
563 off_t rel_seek_bytes
=rel_seek_packs
*asf
->packetsize
;
565 //printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
566 // printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
567 // rel_seek_secs,rel_seek_packs,rel_seek_bytes);
568 newpos
=((flags
&SEEK_ABSOLUTE
)?demuxer
->movi_start
:demuxer
->filepos
)+rel_seek_bytes
;
569 if(newpos
<0 || newpos
<demuxer
->movi_start
) newpos
=demuxer
->movi_start
;
570 // printf("\r -- asf: newpos=%d -- \n",newpos);
571 stream_seek(demuxer
->stream
,newpos
);
573 if (asf
->asf_is_dvr_ms
) asf
->dvr_last_vid_pts
= 0.0f
;
575 if (d_video
->id
>= 0)
576 ds_fill_buffer(d_video
);
578 ds_fill_buffer(d_audio
);
581 if (d_video
->id
>= 0)
583 if(sh_audio
&& !d_audio
->eof
){
584 float a_pts
=d_audio
->pts
;
585 a_pts
+=(ds_tell_pts(d_audio
)-sh_audio
->a_in_buffer_len
)/(float)sh_audio
->i_bps
;
587 if (d_video
->pts
> a_pts
){
588 skip_audio_frame(sh_audio
);
589 // if(!ds_fill_buffer(d_audio)) sh_audio=NULL; // skip audio. EOF?
593 if(d_video
->flags
&1) break; // found a keyframe!
594 if(!ds_fill_buffer(d_video
)) break; // skip frame. EOF?
600 static int demux_asf_control(demuxer_t
*demuxer
,int cmd
, void *arg
){
601 struct asf_priv
* asf
= demuxer
->priv
;
602 /* demux_stream_t *d_audio=demuxer->audio;
603 demux_stream_t *d_video=demuxer->video;
604 sh_audio_t *sh_audio=d_audio->sh;
605 sh_video_t *sh_video=d_video->sh;
608 case DEMUXER_CTRL_GET_TIME_LENGTH
:
609 *((double *)arg
)=asf
->movielength
;
610 return DEMUXER_CTRL_OK
;
612 case DEMUXER_CTRL_GET_PERCENT_POS
:
613 return DEMUXER_CTRL_DONTKNOW
;
616 return DEMUXER_CTRL_NOTIMPL
;
621 static demuxer_t
* demux_open_asf(demuxer_t
* demuxer
)
623 struct asf_priv
* asf
= demuxer
->priv
;
624 sh_audio_t
*sh_audio
=NULL
;
625 sh_video_t
*sh_video
=NULL
;
628 if(!asf
) return NULL
;
630 if (!read_asf_header(demuxer
,asf
))
632 stream_reset(demuxer
->stream
);
633 stream_seek(demuxer
->stream
,demuxer
->movi_start
);
634 // demuxer->idx_pos=0;
635 // demuxer->endpos=avi_header.movi_end;
636 if(demuxer
->video
->id
!= -2) {
637 if(!ds_fill_buffer(demuxer
->video
)){
638 mp_msg(MSGT_DEMUXER
, MSGL_WARN
, "ASF: %s",
639 mp_gtext("No video stream found.\n"));
640 demuxer
->video
->sh
=NULL
;
641 //printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
643 sh_video
=demuxer
->video
->sh
;sh_video
->ds
=demuxer
->video
;
644 sh_video
->fps
=1000.0f
; sh_video
->frametime
=0.001f
;
646 if (asf
->asf_is_dvr_ms
) {
647 sh_video
->bih
->biWidth
= 0;
648 sh_video
->bih
->biHeight
= 0;
653 if(demuxer
->audio
->id
!=-2){
654 mp_tmsg(MSGT_DEMUXER
,MSGL_V
,"ASF: Searching for audio stream (id:%d).\n",demuxer
->audio
->id
);
655 if(!ds_fill_buffer(demuxer
->audio
)){
656 mp_msg(MSGT_DEMUXER
, MSGL_INFO
, "ASF: %s",
657 mp_gtext("No audio stream found -> no sound.\n"));
658 demuxer
->audio
->sh
=NULL
;
660 sh_audio
=demuxer
->audio
->sh
;sh_audio
->ds
=demuxer
->audio
;
661 sh_audio
->format
=sh_audio
->wf
->wFormatTag
;
664 if(!demuxer
->stream
->seek
)
671 static void demux_close_asf(demuxer_t
*demuxer
) {
672 struct asf_priv
* asf
= demuxer
->priv
;
676 if (asf
->aud_repdata_sizes
)
677 free(asf
->aud_repdata_sizes
);
679 if (asf
->vid_repdata_sizes
)
680 free(asf
->vid_repdata_sizes
);
685 const demuxer_desc_t demuxer_desc_asf
= {
692 1, // safe autodetect
694 demux_asf_fill_buffer
,