Keep the old protocol name around for backwards compatibility until the next bump. Deprecate the method of implicitly assuming the nested protocol. For applehttp://server/path, it might have felt logical, but supporting hls://server/path isn't quite as intuitive. Therefore only support hls+http://server/path from now on. Using this protocol at all is discouraged, since the hls demuxer is more complete and fits into the architecture better. There have been cases where the protocol implementation worked better than the demuxer, but this should no longer be the case. Signed-off-by: Martin Storsjö <martin@martin.st>tags/n0.11
@@ -19,20 +19,19 @@ supported protocols. | |||||
A description of the currently available protocols follows. | A description of the currently available protocols follows. | ||||
@section applehttp | |||||
@section hls | |||||
Read Apple HTTP Live Streaming compliant segmented stream as | Read Apple HTTP Live Streaming compliant segmented stream as | ||||
a uniform one. The M3U8 playlists describing the segments can be | a uniform one. The M3U8 playlists describing the segments can be | ||||
remote HTTP resources or local files, accessed using the standard | remote HTTP resources or local files, accessed using the standard | ||||
file protocol. | file protocol. | ||||
HTTP is default, specific protocol can be declared by specifying | |||||
"+@var{proto}" after the applehttp URI scheme name, where @var{proto} | |||||
The nested protocol is declared by specifying | |||||
"+@var{proto}" after the hls URI scheme name, where @var{proto} | |||||
is either "file" or "http". | is either "file" or "http". | ||||
@example | @example | ||||
applehttp://host/path/to/remote/resource.m3u8 | |||||
applehttp+http://host/path/to/remote/resource.m3u8 | |||||
applehttp+file://path/to/local/resource.m3u8 | |||||
hls+http://host/path/to/remote/resource.m3u8 | |||||
hls+file://path/to/local/resource.m3u8 | |||||
@end example | @end example | ||||
@section concat | @section concat | ||||
@@ -329,11 +329,12 @@ OBJS-$(CONFIG_LIBRTMP) += librtmp.o | |||||
# protocols I/O | # protocols I/O | ||||
OBJS+= avio.o aviobuf.o | OBJS+= avio.o aviobuf.o | ||||
OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += applehttpproto.o | |||||
OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o | |||||
OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o | OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o | ||||
OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o | OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o | ||||
OBJS-$(CONFIG_FILE_PROTOCOL) += file.o | OBJS-$(CONFIG_FILE_PROTOCOL) += file.o | ||||
OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o | OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o | ||||
OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o | |||||
OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o | OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o | ||||
OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o | OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o | ||||
OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o | OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o | ||||
@@ -22,6 +22,7 @@ | |||||
#include "rtp.h" | #include "rtp.h" | ||||
#include "rdt.h" | #include "rdt.h" | ||||
#include "url.h" | #include "url.h" | ||||
#include "version.h" | |||||
#define REGISTER_MUXER(X,x) { \ | #define REGISTER_MUXER(X,x) { \ | ||||
extern AVOutputFormat ff_##x##_muxer; \ | extern AVOutputFormat ff_##x##_muxer; \ | ||||
@@ -238,11 +239,14 @@ void av_register_all(void) | |||||
REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe); | REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe); | ||||
/* protocols */ | /* protocols */ | ||||
#if FF_API_APPLEHTTP_PROTO | |||||
REGISTER_PROTOCOL (APPLEHTTP, applehttp); | REGISTER_PROTOCOL (APPLEHTTP, applehttp); | ||||
#endif | |||||
REGISTER_PROTOCOL (CONCAT, concat); | REGISTER_PROTOCOL (CONCAT, concat); | ||||
REGISTER_PROTOCOL (CRYPTO, crypto); | REGISTER_PROTOCOL (CRYPTO, crypto); | ||||
REGISTER_PROTOCOL (FILE, file); | REGISTER_PROTOCOL (FILE, file); | ||||
REGISTER_PROTOCOL (GOPHER, gopher); | REGISTER_PROTOCOL (GOPHER, gopher); | ||||
REGISTER_PROTOCOL (HLS, hls); | |||||
REGISTER_PROTOCOL (HTTP, http); | REGISTER_PROTOCOL (HTTP, http); | ||||
REGISTER_PROTOCOL (HTTPPROXY, httpproxy); | REGISTER_PROTOCOL (HTTPPROXY, httpproxy); | ||||
REGISTER_PROTOCOL (HTTPS, https); | REGISTER_PROTOCOL (HTTPS, https); | ||||
@@ -29,6 +29,7 @@ | |||||
#include "avformat.h" | #include "avformat.h" | ||||
#include "internal.h" | #include "internal.h" | ||||
#include "url.h" | #include "url.h" | ||||
#include "version.h" | |||||
#include <unistd.h> | #include <unistd.h> | ||||
/* | /* | ||||
@@ -195,11 +196,27 @@ static int applehttp_open(URLContext *h, const char *uri, int flags) | |||||
h->is_streamed = 1; | h->is_streamed = 1; | ||||
if (av_strstart(uri, "applehttp+", &nested_url)) { | |||||
if (av_strstart(uri, "hls+", &nested_url)) { | |||||
av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl)); | av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl)); | ||||
} else if (av_strstart(uri, "hls://", &nested_url)) { | |||||
av_log(h, AV_LOG_ERROR, | |||||
"No nested protocol specified. Specify e.g. hls+http://%s\n", | |||||
nested_url); | |||||
ret = AVERROR(EINVAL); | |||||
goto fail; | |||||
#if FF_API_APPLEHTTP_PROTO | |||||
} else if (av_strstart(uri, "applehttp+", &nested_url)) { | |||||
av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl)); | |||||
av_log(h, AV_LOG_WARNING, | |||||
"The applehttp protocol is deprecated, use hls+%s as url " | |||||
"instead.\n", nested_url); | |||||
} else if (av_strstart(uri, "applehttp://", &nested_url)) { | } else if (av_strstart(uri, "applehttp://", &nested_url)) { | ||||
av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl)); | av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl)); | ||||
av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl)); | av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl)); | ||||
av_log(h, AV_LOG_WARNING, | |||||
"The applehttp protocol is deprecated, use hls+http://%s as url " | |||||
"instead.\n", nested_url); | |||||
#endif | |||||
} else { | } else { | ||||
av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri); | av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri); | ||||
ret = AVERROR(EINVAL); | ret = AVERROR(EINVAL); | ||||
@@ -303,6 +320,7 @@ retry: | |||||
goto start; | goto start; | ||||
} | } | ||||
#if FF_API_APPLEHTTP_PROTO | |||||
URLProtocol ff_applehttp_protocol = { | URLProtocol ff_applehttp_protocol = { | ||||
.name = "applehttp", | .name = "applehttp", | ||||
.url_open = applehttp_open, | .url_open = applehttp_open, | ||||
@@ -311,3 +329,13 @@ URLProtocol ff_applehttp_protocol = { | |||||
.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, | .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, | ||||
.priv_data_size = sizeof(AppleHTTPContext), | .priv_data_size = sizeof(AppleHTTPContext), | ||||
}; | }; | ||||
#endif | |||||
URLProtocol ff_hls_protocol = { | |||||
.name = "hls", | |||||
.url_open = applehttp_open, | |||||
.url_read = applehttp_read, | |||||
.url_close = applehttp_close, | |||||
.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, | |||||
.priv_data_size = sizeof(AppleHTTPContext), | |||||
}; |
@@ -50,5 +50,8 @@ | |||||
#ifndef FF_API_CLOSE_INPUT_FILE | #ifndef FF_API_CLOSE_INPUT_FILE | ||||
#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) | #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) | ||||
#endif | #endif | ||||
#ifndef FF_API_APPLEHTTP_PROTO | |||||
#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55) | |||||
#endif | |||||
#endif /* AVFORMAT_VERSION_H */ | #endif /* AVFORMAT_VERSION_H */ |