diff options
author | Martin Storsjö <martin@martin.st> | 2012-02-14 12:00:49 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-02-14 20:05:32 +0200 |
commit | 8bdab32f4ee402bbd7bf5a61b0ccbcc59569bfb0 (patch) | |
tree | e2357084d8c632c275a36b540fb56588678b467d | |
parent | 65cd7bf32f384db919b81b07d8e3201d6af4fb06 (diff) | |
download | ffmpeg-8bdab32f4ee402bbd7bf5a61b0ccbcc59569bfb0.tar.gz |
libavformat: Rename the applehttp protocol to hls
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>
-rw-r--r-- | doc/protocols.texi | 11 | ||||
-rw-r--r-- | libavformat/Makefile | 3 | ||||
-rw-r--r-- | libavformat/allformats.c | 4 | ||||
-rw-r--r-- | libavformat/hlsproto.c (renamed from libavformat/applehttpproto.c) | 30 | ||||
-rw-r--r-- | libavformat/version.h | 3 |
5 files changed, 43 insertions, 8 deletions
diff --git a/doc/protocols.texi b/doc/protocols.texi index f5bb5324be..e00c1e11b2 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -19,20 +19,19 @@ supported protocols. A description of the currently available protocols follows. -@section applehttp +@section hls Read Apple HTTP Live Streaming compliant segmented stream as a uniform one. The M3U8 playlists describing the segments can be remote HTTP resources or local files, accessed using the standard 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". @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 @section concat diff --git a/libavformat/Makefile b/libavformat/Makefile index a54a8f569a..dd55e42db4 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -329,11 +329,12 @@ OBJS-$(CONFIG_LIBRTMP) += librtmp.o # protocols I/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_CRYPTO_PROTOCOL) += crypto.o OBJS-$(CONFIG_FILE_PROTOCOL) += file.o OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o +OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index af6ad97e92..a60688c362 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -22,6 +22,7 @@ #include "rtp.h" #include "rdt.h" #include "url.h" +#include "version.h" #define REGISTER_MUXER(X,x) { \ extern AVOutputFormat ff_##x##_muxer; \ @@ -238,11 +239,14 @@ void av_register_all(void) REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe); /* protocols */ +#if FF_API_APPLEHTTP_PROTO REGISTER_PROTOCOL (APPLEHTTP, applehttp); +#endif REGISTER_PROTOCOL (CONCAT, concat); REGISTER_PROTOCOL (CRYPTO, crypto); REGISTER_PROTOCOL (FILE, file); REGISTER_PROTOCOL (GOPHER, gopher); + REGISTER_PROTOCOL (HLS, hls); REGISTER_PROTOCOL (HTTP, http); REGISTER_PROTOCOL (HTTPPROXY, httpproxy); REGISTER_PROTOCOL (HTTPS, https); diff --git a/libavformat/applehttpproto.c b/libavformat/hlsproto.c index 46758ba30f..244f270398 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/hlsproto.c @@ -29,6 +29,7 @@ #include "avformat.h" #include "internal.h" #include "url.h" +#include "version.h" #include <unistd.h> /* @@ -195,11 +196,27 @@ static int applehttp_open(URLContext *h, const char *uri, int flags) 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)); + } 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)) { av_strlcpy(s->playlisturl, "http://", 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 { av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri); ret = AVERROR(EINVAL); @@ -303,6 +320,7 @@ retry: goto start; } +#if FF_API_APPLEHTTP_PROTO URLProtocol ff_applehttp_protocol = { .name = "applehttp", .url_open = applehttp_open, @@ -311,3 +329,13 @@ URLProtocol ff_applehttp_protocol = { .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, .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), +}; diff --git a/libavformat/version.h b/libavformat/version.h index 6f3b387ddc..443d752b8a 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,5 +50,8 @@ #ifndef FF_API_CLOSE_INPUT_FILE #define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) #endif +#ifndef FF_API_APPLEHTTP_PROTO +#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif #endif /* AVFORMAT_VERSION_H */ |