* Apple HTTP Live Streaming Protocol Handler
* Copyright (c) 2010 Martin Storsjo
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
-#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
char line[1024];
const char *ptr;
- if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
+ if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
return ret;
read_chomp_line(in, line, sizeof(line));
free_segment_list(s);
s->finished = 0;
- while (!in->eof_reached) {
+ while (!url_feof(in)) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
int ret, i;
const char *nested_url;
- if (flags & (URL_WRONLY | URL_RDWR))
+ if (flags & AVIO_FLAG_WRITE)
return AVERROR(ENOSYS);
s = av_mallocz(sizeof(AppleHTTPContext));
av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
} else {
- av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri);
+ av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
ret = AVERROR(EINVAL);
goto fail;
}
}
if (s->n_segments == 0) {
- av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
+ av_log(h, AV_LOG_WARNING, "Empty playlist\n");
ret = AVERROR(EIO);
goto fail;
}
return ret;
}
if (s->cur_seq_no < s->start_seq_no) {
- av_log(NULL, AV_LOG_WARNING,
+ av_log(h, AV_LOG_WARNING,
"skipping %d segments ahead, expired from playlist\n",
s->start_seq_no - s->cur_seq_no);
s->cur_seq_no = s->start_seq_no;
goto retry;
}
url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
- av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
- ret = ffurl_open(&s->seg_hd, url, URL_RDONLY);
+ av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
+ ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ);
if (ret < 0) {
if (url_interrupt_cb())
return AVERROR_EXIT;
- av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url);
+ av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
s->cur_seq_no++;
goto retry;
}
}
URLProtocol ff_applehttp_protocol = {
- "applehttp",
- applehttp_open,
- applehttp_read,
- NULL, /* write */
- NULL, /* seek */
- applehttp_close,
- .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .name = "applehttp",
+ .url_open = applehttp_open,
+ .url_read = applehttp_read,
+ .url_close = applehttp_close,
+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
};