[MPlayer-cvslog] r37547 - in trunk: libmpdemux/demux_lavf.c stream/network.c

rtogni subversion at mplayerhq.hu
Sun Oct 18 01:28:29 CEST 2015


Author: rtogni
Date: Sun Oct 18 01:28:29 2015
New Revision: 37547

Log:
Autodetect HLS/Applehttp streams and play them using libavformat demuxer.

This allows playback of hls streams (http://*.m3u8) without having to prefix
them with ffmpeg://

Modified:
   trunk/libmpdemux/demux_lavf.c
   trunk/stream/network.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sat Oct 17 22:13:20 2015	(r37546)
+++ trunk/libmpdemux/demux_lavf.c	Sun Oct 18 01:28:29 2015	(r37547)
@@ -79,6 +79,7 @@ typedef struct lavf_priv {
     int sstreams[MAX_S_STREAMS];
     int cur_program;
     int nb_streams_last;
+    int use_lavf_netstream;
 }lavf_priv_t;
 
 static int mp_read(void *opaque, uint8_t *buf, int size) {
@@ -204,8 +205,14 @@ static int lavf_check_file(demuxer_t *de
     if(!priv->avif){
         mp_msg(MSGT_HEADER,MSGL_V,"LAVF_check: no clue about this gibberish!\n");
         return 0;
-    }else
+    }else{
         mp_msg(MSGT_HEADER,MSGL_V,"LAVF_check: %s\n", priv->avif->long_name);
+        if (!strcmp(priv->avif->name, "hls,applehttp")) {
+            mp_msg(MSGT_HEADER,MSGL_V,"LAVF: network streaming with lavf\n");
+            avformat_network_init();
+            priv->use_lavf_netstream  = 1;
+        }
+    }
 
     return DEMUXER_TYPE_LAVF;
 }
@@ -557,6 +564,8 @@ static demuxer_t* demux_open_lavf(demuxe
             av_strlcpy(mp_filename, demuxer->stream->url + 9, sizeof(mp_filename));
         else if (!strncmp(demuxer->stream->url, "rtsp://", 7))
             av_strlcpy(mp_filename, demuxer->stream->url, sizeof(mp_filename));
+        else if (priv->use_lavf_netstream)
+            av_strlcpy(mp_filename, demuxer->stream->url, sizeof(mp_filename));
         else
             av_strlcat(mp_filename, demuxer->stream->url, sizeof(mp_filename));
     } else

Modified: trunk/stream/network.c
==============================================================================
--- trunk/stream/network.c	Sat Oct 17 22:13:20 2015	(r37546)
+++ trunk/stream/network.c	Sun Oct 18 01:28:29 2015	(r37547)
@@ -109,6 +109,9 @@ const mime_struct_t mime_type_table[] =
 	// NullSoft Streaming Video
 	{ "video/nsv", DEMUXER_TYPE_NSV},
 	{ "misc/ultravox", DEMUXER_TYPE_NSV},
+	// HLS Streaming/AppleHttp
+	{ "application/vnd.apple.mpegurl", DEMUXER_TYPE_LAVF},
+	{ "application/x-mpegURL", DEMUXER_TYPE_LAVF},
 	{ NULL, DEMUXER_TYPE_UNKNOWN},
 };
 


More information about the MPlayer-cvslog mailing list