Commit a2a352f3 authored by Tristan Matthews's avatar Tristan Matthews

mux: ogg: add daala support

parent e0a19237
...@@ -152,7 +152,7 @@ typedef struct ...@@ -152,7 +152,7 @@ typedef struct
mtime_t i_length; mtime_t i_length;
int i_packet_no; int i_packet_no;
int i_serial_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_last_keyframe; /* dirac and theora */
int i_num_frames; /* Theora only */ int i_num_frames; /* Theora only */
uint64_t u_last_granulepos; /* Used for correct EOS page */ 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 ) ...@@ -439,6 +439,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
msg_Dbg( p_mux, "theora stream" ); msg_Dbg( p_mux, "theora stream" );
break; break;
case VLC_CODEC_DAALA:
msg_Dbg( p_mux, "daala stream" );
break;
case VLC_CODEC_VP8: case VLC_CODEC_VP8:
msg_Dbg( p_mux, "VP8 stream" ); msg_Dbg( p_mux, "VP8 stream" );
break; break;
...@@ -746,6 +750,9 @@ static void OggGetSkeletonFisbone( uint8_t **pp_buffer, long *pi_size, ...@@ -746,6 +750,9 @@ static void OggGetSkeletonFisbone( uint8_t **pp_buffer, long *pi_size,
case VLC_CODEC_THEORA: case VLC_CODEC_THEORA:
psz_value = "video/theora"; psz_value = "video/theora";
break; break;
case VLC_CODEC_DAALA:
psz_value = "video/daala";
break;
case VLC_CODEC_SPEEX: case VLC_CODEC_SPEEX:
psz_value = "audio/speex"; psz_value = "audio/speex";
break; break;
...@@ -994,7 +1001,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux ) ...@@ -994,7 +1001,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
sout_input_t *p_input = p_mux->pp_inputs[i]; sout_input_t *p_input = p_mux->pp_inputs[i];
p_stream = (ogg_stream_t*)p_input->p_sys; 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 ) ) ) if( ( ( pass == 0 && !video ) || ( pass == 1 && video ) ) )
continue; continue;
...@@ -1009,9 +1018,10 @@ static bool OggCreateHeaders( sout_mux_t *p_mux ) ...@@ -1009,9 +1018,10 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
if( p_stream->i_fourcc == VLC_CODEC_VORBIS || if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
p_stream->i_fourcc == VLC_CODEC_SPEEX || p_stream->i_fourcc == VLC_CODEC_SPEEX ||
p_stream->i_fourcc == VLC_CODEC_OPUS || 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]; unsigned pi_size[XIPH_MAX_HEADER_COUNT];
void *pp_data[XIPH_MAX_HEADER_COUNT]; void *pp_data[XIPH_MAX_HEADER_COUNT];
unsigned i_count; unsigned i_count;
...@@ -1035,8 +1045,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux ) ...@@ -1035,8 +1045,9 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
ogg_stream_packetin( &p_stream->os, &op ); ogg_stream_packetin( &p_stream->os, &op );
p_og = OggStreamFlush( p_mux, &p_stream->os, 0 ); p_og = OggStreamFlush( p_mux, &p_stream->os, 0 );
/* Get keyframe_granule_shift for theora granulepos calculation */ /* Get keyframe_granule_shift for theora or daala granulepos calculation */
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_keyframe_granule_shift = p_stream->i_keyframe_granule_shift =
( (op.packet[40] & 0x03) << 3 ) | ( (op.packet[41] & 0xe0) >> 5 ); ( (op.packet[40] & 0x03) << 3 ) | ( (op.packet[41] & 0xe0) >> 5 );
...@@ -1172,7 +1183,8 @@ static bool OggCreateHeaders( sout_mux_t *p_mux ) ...@@ -1172,7 +1183,8 @@ static bool OggCreateHeaders( sout_mux_t *p_mux )
if( p_stream->i_fourcc == VLC_CODEC_VORBIS || if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
p_stream->i_fourcc == VLC_CODEC_SPEEX || p_stream->i_fourcc == VLC_CODEC_SPEEX ||
p_stream->i_fourcc == VLC_CODEC_OPUS || 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]; unsigned pi_size[XIPH_MAX_HEADER_COUNT];
void *pp_data[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 ) ...@@ -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_SPEEX &&
p_stream->i_fourcc != VLC_CODEC_OPUS && 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 &&
p_stream->i_fourcc != VLC_CODEC_VP8 && p_stream->i_fourcc != VLC_CODEC_VP8 &&
p_stream->i_fourcc != VLC_CODEC_DIRAC ) p_stream->i_fourcc != VLC_CODEC_DIRAC )
{ {
...@@ -1614,7 +1627,8 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -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 ) 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++; p_stream->i_num_frames++;
if( p_data->i_flags & BLOCK_FLAG_TYPE_I ) if( p_data->i_flags & BLOCK_FLAG_TYPE_I )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment