[vlc-commits] mux: ogg: add daala support

Tristan Matthews git at videolan.org
Sun Sep 21 18:27:26 CEST 2014


vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Thu Sep 18 22:10:10 2014 -0400| [a2a352f34fe7ab58f12ff51c08c554546ee4ee86] | committer: Tristan Matthews

mux: ogg: add daala support

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

 modules/mux/ogg.c |   30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index c71662a..1045922 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -152,7 +152,7 @@ typedef struct
     mtime_t i_length;
     int     i_packet_no;
     int     i_serial_no;
-    int     i_keyframe_granule_shift; /* Theora only */
+    int     i_keyframe_granule_shift; /* Theora and Daala only */
     int     i_last_keyframe; /* dirac and theora */
     int     i_num_frames; /* Theora only */
     uint64_t u_last_granulepos; /* Used for correct EOS page */
@@ -439,6 +439,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             msg_Dbg( p_mux, "theora stream" );
             break;
 
+        case VLC_CODEC_DAALA:
+            msg_Dbg( p_mux, "daala stream" );
+            break;
+
         case VLC_CODEC_VP8:
             msg_Dbg( p_mux, "VP8 stream" );
             break;
@@ -746,6 +750,9 @@ static void OggGetSkeletonFisbone( uint8_t **pp_buffer, long *pi_size,
         case VLC_CODEC_THEORA:
             psz_value = "video/theora";
             break;
+        case VLC_CODEC_DAALA:
+            psz_value = "video/daala";
+            break;
         case VLC_CODEC_SPEEX:
             psz_value = "audio/speex";
             break;
@@ -994,7 +1001,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
             sout_input_t *p_input = p_mux->pp_inputs[i];
             p_stream = (ogg_stream_t*)p_input->p_sys;
 
-            bool video = ( p_stream->i_fourcc == VLC_CODEC_THEORA || p_stream->i_fourcc == VLC_CODEC_DIRAC );
+            bool video = ( p_stream->i_fourcc == VLC_CODEC_THEORA ||
+                           p_stream->i_fourcc == VLC_CODEC_DIRAC ||
+                           p_stream->i_fourcc == VLC_CODEC_DAALA );
             if( ( ( pass == 0 && !video ) || ( pass == 1 && video ) ) )
                 continue;
 
@@ -1009,9 +1018,10 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
             if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
                 p_stream->i_fourcc == VLC_CODEC_SPEEX ||
                 p_stream->i_fourcc == VLC_CODEC_OPUS ||
-                p_stream->i_fourcc == VLC_CODEC_THEORA )
+                p_stream->i_fourcc == VLC_CODEC_THEORA ||
+                p_stream->i_fourcc == VLC_CODEC_DAALA )
             {
-                /* First packet in order: vorbis/speex/theora info */
+                /* First packet in order: vorbis/speex/opus/theora/daala info */
                 unsigned pi_size[XIPH_MAX_HEADER_COUNT];
                 void     *pp_data[XIPH_MAX_HEADER_COUNT];
                 unsigned i_count;
@@ -1035,8 +1045,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
                 ogg_stream_packetin( &p_stream->os, &op );
                 p_og = OggStreamFlush( p_mux, &p_stream->os, 0 );
 
-                /* Get keyframe_granule_shift for theora granulepos calculation */
-                if( p_stream->i_fourcc == VLC_CODEC_THEORA )
+                /* Get keyframe_granule_shift for theora or daala granulepos calculation */
+                if( p_stream->i_fourcc == VLC_CODEC_THEORA ||
+                    p_stream->i_fourcc == VLC_CODEC_DAALA )
                 {
                     p_stream->i_keyframe_granule_shift =
                         ( (op.packet[40] & 0x03) << 3 ) | ( (op.packet[41] & 0xe0) >> 5 );
@@ -1172,7 +1183,8 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
         if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
             p_stream->i_fourcc == VLC_CODEC_SPEEX ||
             p_stream->i_fourcc == VLC_CODEC_OPUS ||
-            p_stream->i_fourcc == VLC_CODEC_THEORA )
+            p_stream->i_fourcc == VLC_CODEC_THEORA ||
+            p_stream->i_fourcc == VLC_CODEC_DAALA )
         {
             unsigned pi_size[XIPH_MAX_HEADER_COUNT];
             void     *pp_data[XIPH_MAX_HEADER_COUNT];
@@ -1573,6 +1585,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
         p_stream->i_fourcc != VLC_CODEC_SPEEX &&
         p_stream->i_fourcc != VLC_CODEC_OPUS &&
         p_stream->i_fourcc != VLC_CODEC_THEORA &&
+        p_stream->i_fourcc != VLC_CODEC_DAALA &&
         p_stream->i_fourcc != VLC_CODEC_VP8 &&
         p_stream->i_fourcc != VLC_CODEC_DIRAC )
     {
@@ -1614,7 +1627,8 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     }
     else if( p_stream->i_cat == VIDEO_ES )
     {
-        if( p_stream->i_fourcc == VLC_CODEC_THEORA )
+        if( p_stream->i_fourcc == VLC_CODEC_THEORA ||
+            p_stream->i_fourcc == VLC_CODEC_DAALA )
         {
             p_stream->i_num_frames++;
             if( p_data->i_flags & BLOCK_FLAG_TYPE_I )



More information about the vlc-commits mailing list