static int send_keepalive_packet(MMSTContext *mmst) { // respond to a keepalive with a keepalive... start_command_packet(mmst, CS_PKT_KEEPALIVE); insert_command_prefixes(&mmst->mms, 1, 0x100FFFF); return send_command_packet(mmst); }
static int send_close_packet(MMSTContext *mmst) { start_command_packet(mmst, CS_PKT_STREAM_CLOSE); insert_command_prefixes(&mmst->mms, 1, 1); return send_command_packet(mmst); }
static int send_media_file_request(MMSContext *mms) { start_command_packet(mms, CS_PKT_MEDIA_FILE_REQUEST); insert_command_prefixes(mms, 1, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0); mms_put_utf16(mms, mms->path + 1); // +1 for skip "/" return send_command_packet(mms); }
static int send_media_file_request(MMSTContext *mmst) { int ret; MMSContext *mms = &mmst->mms; start_command_packet(mmst, CS_PKT_MEDIA_FILE_REQUEST); insert_command_prefixes(mms, 1, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0); if ((ret = mms_put_utf16(mms, mmst->path + 1)) < 0) // +1 for skip "/" return ret; return send_command_packet(mmst); }
static int send_media_packet_request(MMSContext *mms) { start_command_packet(mms, CS_PKT_START_FROM_PKT_ID); insert_command_prefixes(mms, 1, 0x0001FFFF); bytestream_put_le64(&mms->write_out_ptr, 0); // seek timestamp bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); // unknown bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); // packet offset bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit bytestream_put_byte(&mms->write_out_ptr, 0x00); // stream time limit flag mms->packet_id++; // new packet_id bytestream_put_le32(&mms->write_out_ptr, mms->packet_id); return send_command_packet(mms); }
/** Send the initial handshake. */ static int send_startup_packet(MMSContext *mms) { char data_string[256]; // SubscriberName is defined in MS specification linked below. // The guid value can be any valid value. // http://download.microsoft.com/ // download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-WMSP%5D.pdf snprintf(data_string, sizeof(data_string), "NSPlayer/7.0.0.1956; {%s}; Host: %s", "7E667F5D-A661-495E-A512-F55686DDA178", mms->host); start_command_packet(mms, CS_PKT_INITIAL); insert_command_prefixes(mms, 0, 0x0004000b); bytestream_put_le32(&mms->write_out_ptr, 0x0003001c); mms_put_utf16(mms, data_string); return send_command_packet(mms); }
static int send_media_header_request(MMSContext *mms) { start_command_packet(mms, CS_PKT_MEDIA_HEADER_REQUEST); insert_command_prefixes(mms, 1, 0); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0x00800000); bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0); // the media preroll value in milliseconds? bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0x40AC2000); bytestream_put_le32(&mms->write_out_ptr, 2); bytestream_put_le32(&mms->write_out_ptr, 0); return send_command_packet(mms); }
static int send_protocol_select(MMSContext *mms) { char data_string[256]; start_command_packet(mms, CS_PKT_PROTOCOL_SELECT); insert_command_prefixes(mms, 0, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); // maxFunnelBytes bytestream_put_le32(&mms->write_out_ptr, 0x00989680); // maxbitRate bytestream_put_le32(&mms->write_out_ptr, 2); // funnelMode snprintf(data_string, sizeof(data_string), "\\\\%d.%d.%d.%d\\%s\\%d", (LOCAL_ADDRESS>>24)&0xff, (LOCAL_ADDRESS>>16)&0xff, (LOCAL_ADDRESS>>8)&0xff, LOCAL_ADDRESS&0xff, "TCP", // or UDP LOCAL_PORT); mms_put_utf16(mms, data_string); return send_command_packet(mms); }
static int send_time_test_data(MMSTContext *mmst) { start_command_packet(mmst, CS_PKT_TIMING_DATA_REQUEST); insert_command_prefixes(&mmst->mms, 0x00f0f0f0, 0x0004000b); return send_command_packet(mmst); }