Package: libmms0 Version: 0.3-2 Severity: normal Tags: patch Hi,
libmms does not support streams with id above 23, prohibiting playback of certain streams such as this one, mms://media.lightreading.com/drtv/2006/11/111687_01_256K.wmv GStreamer bug discussing the problem, http://bugzilla.gnome.org/show_bug.cgi?id=347151 Upstream bug and patch, http://sourceforge.net/tracker/index.php?func=detail&aid=1521441&group_id=101989&atid=630609 The attached patch is the one from upstream adjusted for the debian package and seems to work fine. -- System Information: Debian Release: 4.0 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-686 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Versions of packages libmms0 depends on: ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries ii libglib2.0-0 2.12.11-1 The GLib library of C routines libmms0 recommends no packages. -- no debconf information LocalWords: UTF
diff -urp ../libmms-0.3.orig/src/mms.c ./src/mms.c --- ../libmms-0.3.orig/src/mms.c 2006-07-13 14:32:20.000000000 +0200 +++ ./src/mms.c 2007-03-27 23:15:38.000000000 +0200 @@ -106,6 +106,13 @@ struct mms_packet_header_s { uint32_t packet_seq; }; +typedef struct mms_stream_s mms_stream_t; +struct mms_stream_s { + int stream_id; + int stream_type; + uint32_t bitrate; + uint32_t bitrate_pos; +}; struct mms_s { @@ -140,15 +147,12 @@ struct mms_s { uint32_t asf_header_read; int seq_num; int num_stream_ids; - int stream_ids[ASF_MAX_NUM_STREAMS]; - int stream_types[ASF_MAX_NUM_STREAMS]; + mms_stream_t streams[ASF_MAX_NUM_STREAMS]; off_t start_packet_seq; /* for live streams != 0, need to keep it around */ int need_discont; /* whether we need to set start_packet_seq */ uint32_t asf_packet_len; uint64_t file_len; char guid[37]; - uint32_t bitrates[ASF_MAX_NUM_STREAMS]; - uint32_t bitrates_pos[ASF_MAX_NUM_STREAMS]; int bandwidth; int has_audio; @@ -776,9 +780,9 @@ static void interp_asf_header (mms_t *th lprintf ("stream object, stream id: %d, type: %d, encrypted: %d\n", stream_id, type, encrypted); - if (this->num_stream_ids < ASF_MAX_NUM_STREAMS && stream_id < ASF_MAX_NUM_STREAMS) { - this->stream_types[stream_id] = type; - this->stream_ids[this->num_stream_ids] = stream_id; + if (this->num_stream_ids < ASF_MAX_NUM_STREAMS) { + this->streams[this->num_stream_ids].stream_type = type; + this->streams[this->num_stream_ids].stream_id = stream_id; this->num_stream_ids++; } else { lprintf ("too many streams, skipping\n"); @@ -796,12 +800,19 @@ static void interp_asf_header (mms_t *th lprintf ("streams %d\n", streams); for(j = 0; j < streams; j++) { + int stream_index; stream_id = LE_16(this->asf_header + i + 2 + j * 6); - lprintf ("stream id %d\n", stream_id); - this->bitrates[stream_id] = LE_32(this->asf_header + i + 4 + j * 6); - this->bitrates_pos[stream_id] = i + 4 + j * 6; - lprintf ("stream id %d, bitrate %d\n", stream_id, - this->bitrates[stream_id]); + lprintf ("stream id %d\n", stream_id); + for(stream_index = 0; stream_index < this->num_stream_ids; stream_index++) { + if (this->streams[stream_index].stream_id == stream_id) + break; + } + if (stream_index < this->num_stream_ids) { + this->streams[stream_index].bitrate = LE_32(this->asf_header + i + 4 + j * 6); + this->streams[stream_index].bitrate_pos = i + 4 + j * 6; + lprintf ("stream id %d, bitrate %d\n", stream_id, + this->[stream_index].bitrate); + } } } break; @@ -913,7 +924,6 @@ int static mms_choose_best_streams(mms_i int max_arate = 0; int min_vrate = 0; int min_bw_left = 0; - int stream_id; int bandwitdh_left; int res; @@ -922,12 +932,11 @@ int static mms_choose_best_streams(mms_i /* i've never seen more than one audio stream */ lprintf("num_stream_ids=%d\n", this->num_stream_ids); for (i = 0; i < this->num_stream_ids; i++) { - stream_id = this->stream_ids[i]; - switch (this->stream_types[stream_id]) { + switch (this->streams[i].stream_type) { case ASF_STREAM_TYPE_AUDIO: - if (this->bitrates[stream_id] > max_arate) { - audio_stream = stream_id; - max_arate = this->bitrates[stream_id]; + if (this->streams[i].bitrate > max_arate) { + audio_stream = this->streams[i].stream_id; + max_arate = this->streams[i].bitrate; } break; default: @@ -944,13 +953,12 @@ int static mms_choose_best_streams(mms_i min_bw_left = bandwitdh_left; for (i = 0; i < this->num_stream_ids; i++) { - stream_id = this->stream_ids[i]; - switch (this->stream_types[stream_id]) { + switch (this->streams[i].stream_type) { case ASF_STREAM_TYPE_VIDEO: - if (((bandwitdh_left - this->bitrates[stream_id]) < min_bw_left) && - (bandwitdh_left >= this->bitrates[stream_id])) { - video_stream = stream_id; - min_bw_left = bandwitdh_left - this->bitrates[stream_id]; + if (((bandwitdh_left - this->streams[i].bitrate) < min_bw_left) && + (bandwitdh_left >= this->streams[i].bitrate)) { + video_stream = this->streams[i].stream_id; + min_bw_left = bandwitdh_left - this->streams[i].bitrate; } break; default: @@ -961,13 +969,12 @@ int static mms_choose_best_streams(mms_i /* choose the lower bitrate of */ if (!video_stream && this->has_video) { for (i = 0; i < this->num_stream_ids; i++) { - stream_id = this->stream_ids[i]; - switch (this->stream_types[stream_id]) { + switch (this->streams[i].stream_type) { case ASF_STREAM_TYPE_VIDEO: - if ((this->bitrates[stream_id] < min_vrate) || + if ((this->streams[i].bitrate < min_vrate) || (!min_vrate)) { - video_stream = stream_id; - min_vrate = this->bitrates[stream_id]; + video_stream = this->streams[i].stream_id; + min_vrate = this->streams[i].bitrate; } break; default: @@ -982,10 +989,10 @@ int static mms_choose_best_streams(mms_i for (i = 1; i < this->num_stream_ids; i++) { this->scmd_body [ (i - 1) * 6 + 2 ] = 0xFF; this->scmd_body [ (i - 1) * 6 + 3 ] = 0xFF; - this->scmd_body [ (i - 1) * 6 + 4 ] = this->stream_ids[i] ; - this->scmd_body [ (i - 1) * 6 + 5 ] = this->stream_ids[i] >> 8; - if ((this->stream_ids[i] == audio_stream) || - (this->stream_ids[i] == video_stream)) { + this->scmd_body [ (i - 1) * 6 + 4 ] = this->streams[i].stream_id ; + this->scmd_body [ (i - 1) * 6 + 5 ] = this->streams[i].stream_id >> 8; + if ((this->streams[i].stream_id == audio_stream) || + (this->streams[i].stream_id == video_stream)) { this->scmd_body [ (i - 1) * 6 + 6 ] = 0x00; this->scmd_body [ (i - 1) * 6 + 7 ] = 0x00; } else { @@ -994,17 +1001,17 @@ int static mms_choose_best_streams(mms_i this->scmd_body [ (i - 1) * 6 + 7 ] = 0x00; /* forces the asf demuxer to not choose this stream */ - if (this->bitrates_pos[this->stream_ids[i]]) { - this->asf_header[this->bitrates_pos[this->stream_ids[i]]] = 0; - this->asf_header[this->bitrates_pos[this->stream_ids[i]] + 1] = 0; - this->asf_header[this->bitrates_pos[this->stream_ids[i]] + 2] = 0; - this->asf_header[this->bitrates_pos[this->stream_ids[i]] + 3] = 0; + if (this->streams[i].bitrate_pos) { + this->asf_header[this->streams[i].bitrate_pos ] = 0; + this->asf_header[this->streams[i].bitrate_pos + 1] = 0; + this->asf_header[this->streams[i].bitrate_pos + 2] = 0; + this->asf_header[this->streams[i].bitrate_pos + 3] = 0; } } } if (!send_command (io, this, 0x33, this->num_stream_ids, - 0xFFFF | this->stream_ids[0] << 16, + 0xFFFF | this->streams[0].stream_id << 16, this->num_stream_ids * 6 + 2)) { /* FIXME: de-xine-ification */ lprintf ( "***LOG:*** -- "