[vlc-commits] Add Vorbis and VP8 codecs to live555.

Sébastien Escudier git at videolan.org
Thu Feb 28 15:46:16 CET 2013


vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Sun Feb 24 17:33:26 2013 +0100| [6daa02af1a81efa197ea5a8c8f5ff4b6ef526c92] | committer: Sébastien Escudier

Add Vorbis and VP8 codecs to live555.
Chained vorbis stream is not supported.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6daa02af1a81efa197ea5a8c8f5ff4b6ef526c92
---

 modules/access/live555.cpp |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 29a67f6..2344e40 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -61,6 +61,7 @@
 #include <GroupsockHelper.hh>
 #include <liveMedia.hh>
 #include <liveMedia_version.hh>
+#include <Base64.hh>
 
 extern "C" {
 #include "../access/mms/asf.h"  /* Who said ugly ? */
@@ -268,6 +269,8 @@ static void* TimeoutPrevention( void * );
 
 static unsigned char* parseH264ConfigStr( char const* configStr,
                                           unsigned int& configSize );
+static unsigned char* parseVorbisConfigStr( char const* configStr,
+                                            unsigned int& configSize );
 
 /*****************************************************************************
  * DemuxOpen:
@@ -959,6 +962,20 @@ static int SessionsSetup( demux_t *p_demux )
                         tk->fmt.audio.i_rate = 8000;
                     }
                 }
+                else if( !strcmp( sub->codecName(), "VORBIS" ) )
+                {
+                    tk->fmt.i_codec = VLC_CODEC_VORBIS;
+                    unsigned int i_extra;
+                    unsigned char *p_extra;
+                    if( ( p_extra=parseVorbisConfigStr( sub->fmtp_config(),
+                                                        i_extra ) ) )
+                    {
+                        tk->fmt.i_extra = i_extra;
+                        tk->fmt.p_extra = p_extra;
+                    }
+                    else
+                        msg_Warn( p_demux,"Missing or unsupported vorbis header." );
+                }
             }
             else if( !strcmp( sub->mediumName(), "video" ) )
             {
@@ -1050,6 +1067,10 @@ static int SessionsSetup( demux_t *p_demux )
                     tk->p_out_muxed = stream_DemuxNew( p_demux, "rawdv",
                                                        p_demux->out );
                 }
+                else if( !strcmp( sub->codecName(), "VP8" ) )
+                {
+                    tk->fmt.i_codec = VLC_CODEC_VP8;
+                }
             }
             else if( !strcmp( sub->mediumName(), "text" ) )
             {
@@ -2123,3 +2144,24 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
     free( dup );
     return cfg;
 }
+
+static uint8_t *parseVorbisConfigStr( char const* configStr,
+                                      unsigned int& configSize )
+{
+    configSize = 0;
+    if( configStr == NULL || *configStr == '\0' )
+        return NULL;
+    unsigned char *p_cfg = base64Decode( configStr, configSize );
+    uint8_t *p_extra = NULL;
+    /* skip header count, ident number and length (cf. RFC 5215) */
+    const unsigned int headerSkip = 9;
+    if( configSize > headerSkip && ((uint8_t*)p_cfg)[3] == 1 )
+    {
+        configSize -= headerSkip;
+        p_extra = (uint8_t*)xmalloc( configSize );
+        memcpy( p_extra, p_cfg+headerSkip, configSize );
+    }
+    delete[] p_cfg;
+    return p_extra;
+}
+



More information about the vlc-commits mailing list