aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-20 21:38:11 +0000
committerGravatar bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-20 21:38:11 +0000
commitb1bee536f05c2fe75eb646959df2662abfd88116 (patch)
treec0639e554fd721c9f5f1e50dfc931861fb321911 /libmpdemux
parentef87ddc7a937a061011e896f87eed778e2236729 (diff)
Changed the asf_file_header_t struct to read all the fields properly.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4289 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/asf.h31
-rw-r--r--libmpdemux/asf_streaming.c14
-rw-r--r--libmpdemux/asfheader.c5
3 files changed, 41 insertions, 9 deletions
diff --git a/libmpdemux/asf.h b/libmpdemux/asf.h
index 5c4554fb87..dce8a1cfa2 100644
--- a/libmpdemux/asf.h
+++ b/libmpdemux/asf.h
@@ -48,6 +48,7 @@ typedef struct __attribute__((packed)) {
/////////////////////
// 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 @@ typedef struct __attribute__((packed)) {
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 @@ typedef enum {
(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 @@ typedef enum {
(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); \
diff --git a/libmpdemux/asf_streaming.c b/libmpdemux/asf_streaming.c
index 3d23b4296c..2fcc2b019f 100644
--- a/libmpdemux/asf_streaming.c
+++ b/libmpdemux/asf_streaming.c
@@ -209,15 +209,16 @@ asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) {
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 @@ asf_http_streaming_start( stream_t *stream ) {
} 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 );
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c
index c49084ca32..8b4856eadd 100644
--- a/libmpdemux/asfheader.c
+++ b/libmpdemux/asfheader.c
@@ -200,8 +200,9 @@ while(!stream_eof(demuxer->stream)){
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