* MMS protocol over HTTP
* Copyright (c) 2010 Zhentan Feng <spyfeng at gmail dot com>
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
int res;
if (len > sizeof(mms->in_buffer)) {
av_log(NULL, AV_LOG_ERROR,
- "Data packet length %d exceeds the in_buffer size %d\n",
+ "Data packet length %d exceeds the in_buffer size %zu\n",
len, sizeof(mms->in_buffer));
return AVERROR(EIO);
}
res = url_read_complete(mms->mms_hd, mms->in_buffer, len);
- dprintf(NULL, "Data packet len = %d\n", len);
+ av_dlog(NULL, "Data packet len = %d\n", len);
if (res != len) {
av_log(NULL, AV_LOG_ERROR, "Read data packet failed!\n");
return AVERROR(EIO);
for (;;) {
len = 0;
- chunk_type = get_chunk_header(mmsh, &len);
- if (chunk_type < 0) {
- return chunk_type;
+ res = chunk_type = get_chunk_header(mmsh, &len);
+ if (res < 0) {
+ return res;
} else if (chunk_type == CHUNK_TYPE_ASF_HEADER){
// get asf header and stored it
if (!mms->header_parsed) {
if (mms->asf_header) {
if (len != mms->asf_header_size) {
mms->asf_header_size = len;
- dprintf(NULL, "Header len changed from %d to %d\n",
+ av_dlog(NULL, "Header len changed from %d to %d\n",
mms->asf_header_size, len);
av_freep(&mms->asf_header);
}
if (len) {
if (len > sizeof(mms->in_buffer)) {
av_log(NULL, AV_LOG_ERROR,
- "Other packet len = %d exceed the in_buffer size %d\n",
+ "Other packet len = %d exceed the in_buffer size %zu\n",
len, sizeof(mms->in_buffer));
return AVERROR(EIO);
}
av_log(NULL, AV_LOG_ERROR, "Read other chunk type data failed!\n");
return AVERROR(EIO);
} else {
- dprintf(NULL, "Skip chunk type %d \n", chunk_type);
+ av_dlog(NULL, "Skip chunk type %d \n", chunk_type);
continue;
}
}
{
int i, port, err;
char httpname[256], path[256], host[128], location[1024];
- char *stream_selection;
+ char *stream_selection = NULL;
char headers[1024];
MMSHContext *mmsh;
MMSContext *mms;
av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n");
goto fail;
}
- dprintf(NULL, "out_buffer is %s", headers);
+ av_dlog(NULL, "out_buffer is %s", headers);
ff_http_set_headers(mms->mms_hd, headers);
err = url_connect(mms->mms_hd);
goto fail;
}
- dprintf(NULL, "Connection successfully open\n");
+ av_dlog(NULL, "Connection successfully open\n");
return 0;
fail:
av_freep(&stream_selection);
mmsh_close(h);
- dprintf(NULL, "Connection failed with error %d\n", err);
+ av_dlog(NULL, "Connection failed with error %d\n", err);
return err;
}
return res;
}
-URLProtocol mmsh_protocol = {
+URLProtocol ff_mmsh_protocol = {
.name = "mmsh",
.url_open = mmsh_open,
.url_read = mmsh_read,