Send a prepared MMST command packet. */
| 124 | |
| 125 | /** Send a prepared MMST command packet. */ |
| 126 | static int send_command_packet(MMSTContext *mmst) |
| 127 | { |
| 128 | MMSContext *mms = &mmst->mms; |
| 129 | int len= mms->write_out_ptr - mms->out_buffer; |
| 130 | int exact_length = FFALIGN(len, 8); |
| 131 | int first_length= exact_length - 16; |
| 132 | int len8= first_length/8; |
| 133 | int write_result; |
| 134 | |
| 135 | // update packet length fields. |
| 136 | AV_WL32(mms->out_buffer + 8, first_length); |
| 137 | AV_WL32(mms->out_buffer + 16, len8); |
| 138 | AV_WL32(mms->out_buffer + 32, len8-2); |
| 139 | memset(mms->write_out_ptr, 0, exact_length - len); |
| 140 | |
| 141 | // write it out. |
| 142 | write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length); |
| 143 | if(write_result != exact_length) { |
| 144 | av_log(mms->mms_hd, AV_LOG_ERROR, |
| 145 | "Failed to write data of length %d: %d (%s)\n", |
| 146 | exact_length, write_result, |
| 147 | write_result < 0 ? strerror(AVUNERROR(write_result)) : |
| 148 | "The server closed the connection"); |
| 149 | return AVERROR(EIO); |
| 150 | } |
| 151 | |
| 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | static int mms_put_utf16(MMSContext *mms, const uint8_t *src) |
| 156 | { |
no test coverage detected