608
static void interp_stream_properties(mmsh_t *this, int i) {
615
guid = get_guid(this->asf_header, i);
617
case GUID_ASF_AUDIO_MEDIA:
618
type = ASF_STREAM_TYPE_AUDIO;
622
case GUID_ASF_VIDEO_MEDIA:
623
case GUID_ASF_JFIF_MEDIA:
624
case GUID_ASF_DEGRADABLE_JPEG_MEDIA:
625
type = ASF_STREAM_TYPE_VIDEO;
629
case GUID_ASF_COMMAND_MEDIA:
630
type = ASF_STREAM_TYPE_CONTROL;
634
type = ASF_STREAM_TYPE_UNKNOWN;
637
flags = LE_16(this->asf_header + i + 48);
638
stream_id = flags & 0x7F;
639
encrypted = flags >> 15;
641
lprintf ("stream object, stream id: %d, type: %d, encrypted: %d\n",
642
stream_id, type, encrypted);
644
this->stream_types[stream_id] = type;
645
this->stream_ids[this->num_stream_ids] = stream_id;
646
this->num_stream_ids++;
608
649
static void interp_header (mms_io_t *io, mmsh_t *this) {
653
694
case GUID_ASF_STREAM_PROPERTIES:
660
guid = get_guid(this->asf_header, i);
662
case GUID_ASF_AUDIO_MEDIA:
663
type = ASF_STREAM_TYPE_AUDIO;
667
case GUID_ASF_VIDEO_MEDIA:
668
case GUID_ASF_JFIF_MEDIA:
669
case GUID_ASF_DEGRADABLE_JPEG_MEDIA:
670
type = ASF_STREAM_TYPE_VIDEO;
674
case GUID_ASF_COMMAND_MEDIA:
675
type = ASF_STREAM_TYPE_CONTROL;
679
type = ASF_STREAM_TYPE_UNKNOWN;
682
flags = LE_16(this->asf_header + i + 48);
683
stream_id = flags & 0x7F;
684
encrypted = flags >> 15;
686
lprintf ("stream object, stream id: %d, type: %d, encrypted: %d\n",
687
stream_id, type, encrypted);
689
this->stream_types[stream_id] = type;
690
this->stream_ids[this->num_stream_ids] = stream_id;
691
this->num_stream_ids++;
695
interp_stream_properties(this, i);
696
698
case GUID_ASF_STREAM_BITRATE_PROPERTIES:
719
case GUID_ASF_HEADER_EXTENSION:
721
int size = LE_32(this->asf_header + i + 18);
724
lprintf("Extension header data size: %d\n", size);
726
while( (j+24) < length ) {
727
guid = get_guid(this->asf_header, i + j);
730
l = LE_64(this->asf_header + i + j);
734
case GUID_ASF_EXTENDED_STREAM_PROPERTIES:
736
int stream_no = LE_16(this->asf_header + i + j + 48);
737
int name_count = LE_16(this->asf_header + i + j + 60);
738
int ext_count = LE_16(this->asf_header + i + j + 62);
742
lprintf ("l: %d\n", l);
743
lprintf ("Stream No: %d\n", stream_no);
744
lprintf ("Name count: %d\n", name_count);
745
lprintf ("ext_count: %d\n", ext_count);
747
// Loop through the number of stream names
748
for(x=0; x<name_count; x++) {
752
lang_id_index = LE_16(this->asf_header + i + j + ext_j);
755
stream_name_len = LE_16(this->asf_header + i + j + ext_j);
756
ext_j += stream_name_len + 2;
758
lprintf ("Language id index: %d\n", lang_id_index);
759
lprintf ("Stream name Len: %d\n", stream_name_len);
762
// Loop through the number of extension system info
763
for(x=0; x<ext_count; x++) {
765
int len = LE_16(this->asf_header + i + j + ext_j);
769
lprintf ("ext_j: %d\n", ext_j);
770
// Finally, we arrive at the interesting point: The optional Stream Property Object
771
if( (ext_j+24) < l ) {
772
guid = get_guid(this->asf_header, i + j + ext_j);
773
if( guid == GUID_ASF_STREAM_PROPERTIES ) {
774
interp_stream_properties(this, i + j + ext_j + 24);
777
lprintf ("Sorry, field not long enough\n");
783
lprintf ("unknown object (%d)\n", guid);
717
795
case GUID_ASF_DATA:
718
796
this->asf_num_packets = LE_64(this->asf_header + i + 40 - 24);
719
797
lprintf("mmsh: num_packets: %d\n", (int)this->asf_num_packets);