[Mplayer-cvslog] CVS: main/libmpdemux asf.h,1.12,1.13 asf_streaming.c,1.20,1.21 asfheader.c,1.25,1.26
Bertrand Baudet
bertrand at mplayer.dev.hu
Sun Jan 20 22:38:18 CET 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv12853/libmpdemux
Modified Files:
asf.h asf_streaming.c asfheader.c
Log Message:
Changed the asf_file_header_t struct to read all the fields properly.
Index: asf.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- asf.h 24 Dec 2001 20:38:49 -0000 1.12
+++ asf.h 20 Jan 2002 21:38:11 -0000 1.13
@@ -48,6 +48,7 @@
/////////////////////
// ASF File Header
/////////////////////
+/* Bertrand -- 2002/01/19 -- Start --
typedef struct __attribute__((packed)) {
uint8_t client[16]; // Client GUID
uint64_t file_size;
@@ -62,6 +63,21 @@
uint32_t packetsize2; //Size of packet ( confirm ) UINT32 4
uint32_t frame_size; //Size of uncompressed video frame UINT32 4
} ASF_file_header_t;
+*/
+typedef struct __attribute__((packed)) {
+ uint8_t stream_id[16]; // stream GUID
+ uint64_t file_size;
+ uint64_t creation_time; //File creation time FILETIME 8
+ uint64_t num_packets; //Number of packets UINT64 8
+ uint64_t play_duration; //Timestamp of the end position UINT64 8
+ uint64_t send_duration; //Duration of the playback UINT64 8
+ uint64_t preroll; //Time to bufferize before playing UINT32 4
+ uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4
+ uint32_t min_packet_size; //Min size of the packet, in bytes UINT32 4
+ uint32_t max_packet_size; //Max size of the packet UINT32 4
+ uint32_t max_bitrate; //Maximum bitrate of the media (sum of all the stream)
+} ASF_file_header_t;
+// Bertrand -- 2002/01/19 -- End --
///////////////////////
// ASF Stream Header
@@ -138,6 +154,7 @@
(h)->stream_no = le2me_16((h)->stream_no); \
(h)->unk2 = le2me_32((h)->unk2); \
}
+/* Bertrand -- 2002/01/19 -- Start --
#define le2me_ASF_file_header_t(h) { \
(h)->file_size = le2me_64((h)->file_size); \
(h)->creat_time = le2me_64((h)->creat_time); \
@@ -151,6 +168,20 @@
(h)->packetsize2 = le2me_32((h)->packetsize2); \
(h)->frame_size = le2me_32((h)->frame_size); \
}
+*/
+#define le2me_ASF_file_header_t(h) { \
+ (h)->file_size = le2me_64((h)->file_size); \
+ (h)->creation_time = le2me_64((h)->creation_time); \
+ (h)->num_packets = le2me_64((h)->num_packets); \
+ (h)->play_duration = le2me_64((h)->play_duration); \
+ (h)->send_duration = le2me_64((h)->send_duration); \
+ (h)->preroll = le2me_64((h)->preroll); \
+ (h)->flags = le2me_32((h)->flags); \
+ (h)->min_packet_size = le2me_32((h)->min_packet_size); \
+ (h)->max_packet_size = le2me_32((h)->max_packet_size); \
+ (h)->max_bitrate = le2me_32((h)->max_bitrate); \
+}
+// Bertrand -- 2002/01/19 -- End --
#define le2me_ASF_content_description_t(h) { \
(h)->title_size = le2me_16((h)->title_size); \
(h)->author_size = le2me_16((h)->author_size); \
Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- asf_streaming.c 14 Jan 2002 01:12:44 -0000 1.20
+++ asf_streaming.c 20 Jan 2002 21:38:11 -0000 1.21
@@ -209,15 +209,16 @@
pos += sizeof(objh);
memcpy(&fileh,buffer + pos,sizeof(fileh));
le2me_ASF_file_header_t(&fileh);
+/*
if(fileh.packetsize != fileh.packetsize2) {
printf("Error packetsize check don't match\n");
return -1;
}
- asf_ctrl->packet_size = fileh.packetsize;
- // FIXME: preroll contains the amount of time to bufferize
- // before playing. To be able to do that we need to
- // read the timestamp of the first data packet and bufferize.
- streaming_ctrl->prebuffer_size = fileh.preroll;
+*/
+ asf_ctrl->packet_size = fileh.max_packet_size;
+ // before playing.
+ // preroll: time in ms to bufferize before playing
+ streaming_ctrl->prebuffer_size = (unsigned int)((double)((double)fileh.preroll/1000)*((double)fileh.max_bitrate/8));
pos += sizeof(fileh);
break;
case 0xB7DC0791 : // stream header
@@ -655,9 +656,8 @@
} else {
stream->streaming_ctrl->streaming_read = asf_http_streaming_read;
stream->streaming_ctrl->streaming_seek = asf_http_streaming_seek;
+ stream->streaming_ctrl->buffering = 1;
}
- stream->streaming_ctrl->prebuffer_size = 20000;
- stream->streaming_ctrl->buffering = 1;
stream->streaming_ctrl->status = streaming_playing_e;
http_free( http_hdr );
Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asfheader.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- asfheader.c 22 Nov 2001 15:30:54 -0000 1.25
+++ asfheader.c 20 Jan 2002 21:38:11 -0000 1.26
@@ -200,8 +200,9 @@
case ASF_GUID_PREFIX_file_header: // guid_file_header
stream_read(demuxer->stream,(char*) &fileh,sizeof(fileh));
le2me_ASF_file_header_t(&fileh);
- mp_msg(MSGT_HEADER,MSGL_V,"ASF: packets: %d flags: %d pack_size: %d frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
- asf_packetsize=fileh.packetsize;
+ //mp_msg(MSGT_HEADER,MSGL_V,"ASF: packets: %d flags: %d pack_size: %d frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
+ mp_msg(MSGT_HEADER,MSGL_V,"ASF: packets: %d flags: %d max_packet_size: %d min_packet_size: %d max_bitrate: %d preroll: %d\n",(int)fileh.num_packets,(int)fileh.flags,(int)fileh.min_packet_size,(int)fileh.max_packet_size,(int)fileh.max_bitrate,(int)fileh.preroll);
+ asf_packetsize=fileh.max_packet_size;
asf_packet=malloc(asf_packetsize); // !!!
break;
case ASF_GUID_PREFIX_data_chunk: // guid_data_chunk
More information about the MPlayer-cvslog
mailing list