Commit 972bd8c8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Ogg: use b_force_backup as a boolean

parent 4de7c37a
...@@ -702,12 +702,14 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -702,12 +702,14 @@ static void Ogg_DecodePacket( demux_t *p_demux,
case VLC_CODEC_VORBIS: case VLC_CODEC_VORBIS:
case VLC_CODEC_SPEEX: case VLC_CODEC_SPEEX:
case VLC_CODEC_THEORA: case VLC_CODEC_THEORA:
if( p_stream->i_packets_backup == 3 ) p_stream->b_force_backup = 0; if( p_stream->i_packets_backup == 3 )
p_stream->b_force_backup = false;
b_xiph = true; b_xiph = true;
break; break;
case VLC_CODEC_OPUS: case VLC_CODEC_OPUS:
if( p_stream->i_packets_backup == 2 ) p_stream->b_force_backup = 0; if( p_stream->i_packets_backup == 2 )
p_stream->b_force_backup = false;
b_xiph = true; b_xiph = true;
break; break;
...@@ -715,11 +717,11 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -715,11 +717,11 @@ static void Ogg_DecodePacket( demux_t *p_demux,
if( !p_stream->fmt.audio.i_rate && p_stream->i_packets_backup == 2 ) if( !p_stream->fmt.audio.i_rate && p_stream->i_packets_backup == 2 )
{ {
Ogg_ReadFlacHeader( p_demux, p_stream, p_oggpacket ); Ogg_ReadFlacHeader( p_demux, p_stream, p_oggpacket );
p_stream->b_force_backup = 0; p_stream->b_force_backup = false;
} }
else if( p_stream->fmt.audio.i_rate ) else if( p_stream->fmt.audio.i_rate )
{ {
p_stream->b_force_backup = 0; p_stream->b_force_backup = false;
if( p_oggpacket->bytes >= 9 ) if( p_oggpacket->bytes >= 9 )
{ {
p_oggpacket->packet += 9; p_oggpacket->packet += 9;
...@@ -730,12 +732,13 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -730,12 +732,13 @@ static void Ogg_DecodePacket( demux_t *p_demux,
break; break;
case VLC_CODEC_KATE: case VLC_CODEC_KATE:
if( p_stream->i_packets_backup == p_stream->i_kate_num_headers ) p_stream->b_force_backup = 0; if( p_stream->i_packets_backup == p_stream->i_kate_num_headers )
p_stream->b_force_backup = false;
b_xiph = true; b_xiph = true;
break; break;
default: default:
p_stream->b_force_backup = 0; p_stream->b_force_backup = false;
b_xiph = false; b_xiph = false;
break; break;
} }
...@@ -1158,7 +1161,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) ...@@ -1158,7 +1161,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
/* Grrrr!!!! Did they really have to put all the /* Grrrr!!!! Did they really have to put all the
* important info in the second header packet!!! * important info in the second header packet!!!
* (STREAMINFO metadata is in the following packet) */ * (STREAMINFO metadata is in the following packet) */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
p_stream->fmt.i_cat = AUDIO_ES; p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_CODEC_FLAC; p_stream->fmt.i_codec = VLC_CODEC_FLAC;
...@@ -1175,7 +1178,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) ...@@ -1175,7 +1178,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
oggpacket.packet[5], oggpacket.packet[6], oggpacket.packet[5], oggpacket.packet[6],
i_packets ); i_packets );
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
p_stream->fmt.i_cat = AUDIO_ES; p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_CODEC_FLAC; p_stream->fmt.i_codec = VLC_CODEC_FLAC;
...@@ -1892,7 +1895,7 @@ static void Ogg_ReadTheoraHeader( demux_t *p_demux, logical_stream_t *p_stream, ...@@ -1892,7 +1895,7 @@ static void Ogg_ReadTheoraHeader( demux_t *p_demux, logical_stream_t *p_stream,
/* Signal that we want to keep a backup of the theora /* Signal that we want to keep a backup of the theora
* stream headers. They will be used when switching between * stream headers. They will be used when switching between
* audio streams. */ * audio streams. */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
/* Cheat and get additionnal info ;) */ /* Cheat and get additionnal info ;) */
bs_init( &bitstream, p_oggpacket->packet, p_oggpacket->bytes ); bs_init( &bitstream, p_oggpacket->packet, p_oggpacket->bytes );
...@@ -1960,7 +1963,7 @@ static void Ogg_ReadVorbisHeader( demux_t *p_demux, logical_stream_t *p_stream, ...@@ -1960,7 +1963,7 @@ static void Ogg_ReadVorbisHeader( demux_t *p_demux, logical_stream_t *p_stream,
/* Signal that we want to keep a backup of the vorbis /* Signal that we want to keep a backup of the vorbis
* stream headers. They will be used when switching between * stream headers. They will be used when switching between
* audio streams. */ * audio streams. */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
/* Cheat and get additionnal info ;) */ /* Cheat and get additionnal info ;) */
oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes); oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes);
...@@ -1990,7 +1993,7 @@ static void Ogg_ReadSpeexHeader( logical_stream_t *p_stream, ...@@ -1990,7 +1993,7 @@ static void Ogg_ReadSpeexHeader( logical_stream_t *p_stream,
/* Signal that we want to keep a backup of the speex /* Signal that we want to keep a backup of the speex
* stream headers. They will be used when switching between * stream headers. They will be used when switching between
* audio streams. */ * audio streams. */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
/* Cheat and get additionnal info ;) */ /* Cheat and get additionnal info ;) */
oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes); oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes);
...@@ -2016,7 +2019,7 @@ static void Ogg_ReadOpusHeader( demux_t *p_demux, ...@@ -2016,7 +2019,7 @@ static void Ogg_ReadOpusHeader( demux_t *p_demux,
/* Signal that we want to keep a backup of the opus /* Signal that we want to keep a backup of the opus
* stream headers. They will be used when switching between * stream headers. They will be used when switching between
* audio streams. */ * audio streams. */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
/* All OggOpus streams are timestamped at 48kHz and /* All OggOpus streams are timestamped at 48kHz and
* can be played at 48kHz. */ * can be played at 48kHz. */
...@@ -2088,7 +2091,7 @@ static void Ogg_ReadKateHeader( logical_stream_t *p_stream, ...@@ -2088,7 +2091,7 @@ static void Ogg_ReadKateHeader( logical_stream_t *p_stream,
/* Signal that we want to keep a backup of the kate /* Signal that we want to keep a backup of the kate
* stream headers. They will be used when switching between * stream headers. They will be used when switching between
* kate streams. */ * kate streams. */
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
/* Cheat and get additionnal info ;) */ /* Cheat and get additionnal info ;) */
oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes); oggpack_readinit( &opb, p_oggpacket->packet, p_oggpacket->bytes);
...@@ -2204,28 +2207,28 @@ static void Ogg_ReadAnnodexHeader( demux_t *p_demux, ...@@ -2204,28 +2207,28 @@ static void Ogg_ReadAnnodexHeader( demux_t *p_demux,
p_stream->fmt.i_cat = AUDIO_ES; p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_CODEC_VORBIS; p_stream->fmt.i_codec = VLC_CODEC_VORBIS;
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
} }
else if( !strncmp(content_type_string, "audio/x-speex", 13) ) else if( !strncmp(content_type_string, "audio/x-speex", 13) )
{ {
p_stream->fmt.i_cat = AUDIO_ES; p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_CODEC_SPEEX; p_stream->fmt.i_codec = VLC_CODEC_SPEEX;
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
} }
else if( !strncmp(content_type_string, "video/x-theora", 14) ) else if( !strncmp(content_type_string, "video/x-theora", 14) )
{ {
p_stream->fmt.i_cat = VIDEO_ES; p_stream->fmt.i_cat = VIDEO_ES;
p_stream->fmt.i_codec = VLC_CODEC_THEORA; p_stream->fmt.i_codec = VLC_CODEC_THEORA;
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
} }
else if( !strncmp(content_type_string, "video/x-xvid", 12) ) else if( !strncmp(content_type_string, "video/x-xvid", 12) )
{ {
p_stream->fmt.i_cat = VIDEO_ES; p_stream->fmt.i_cat = VIDEO_ES;
p_stream->fmt.i_codec = VLC_FOURCC( 'x','v','i','d' ); p_stream->fmt.i_codec = VLC_FOURCC( 'x','v','i','d' );
p_stream->b_force_backup = 1; p_stream->b_force_backup = true;
} }
else if( !strncmp(content_type_string, "video/mpeg", 10) ) else if( !strncmp(content_type_string, "video/mpeg", 10) )
{ {
...@@ -2284,7 +2287,7 @@ static bool Ogg_ReadDiracHeader( logical_stream_t *p_stream, ...@@ -2284,7 +2287,7 @@ static bool Ogg_ReadDiracHeader( logical_stream_t *p_stream,
/* Backing up stream headers is not required -- seqhdrs are repeated /* Backing up stream headers is not required -- seqhdrs are repeated
* thoughout the stream at suitable decoding start points */ * thoughout the stream at suitable decoding start points */
p_stream->b_force_backup = 0; p_stream->b_force_backup = false;
/* read in useful bits from sequence header */ /* read in useful bits from sequence header */
bs_init( &bs, p_oggpacket->packet, p_oggpacket->bytes ); bs_init( &bs, p_oggpacket->packet, p_oggpacket->bytes );
......
...@@ -42,7 +42,7 @@ typedef struct logical_stream_s ...@@ -42,7 +42,7 @@ typedef struct logical_stream_s
/* the header of some logical streams (eg vorbis) contain essential /* the header of some logical streams (eg vorbis) contain essential
* data for the decoder. We back them up here in case we need to re-feed * data for the decoder. We back them up here in case we need to re-feed
* them to the decoder. */ * them to the decoder. */
int b_force_backup; bool b_force_backup;
int i_packets_backup; int i_packets_backup;
void *p_headers; void *p_headers;
int i_headers; int i_headers;
......
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