/*****************************************************************************
* Preamble
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
-#include <vlc_input.h>
#include <vlc_demux.h>
+#include <vlc_meta.h>
+#include <vlc_input.h>
#include <ogg/ogg.h>
/* bitrate */
int i_bitrate;
-
- /* attachments */
- int i_attachments;
- input_attachment_t **attachments;
};
/* OggDS headers for the new header format (used in ogm files) */
static int Open( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- input_thread_t *p_input;
demux_sys_t *p_sys;
const uint8_t *p_peek;
/* Begnning of stream, tell the demux to look for elementary streams. */
p_sys->i_eos = 0;
-
- p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );
- if( p_input )
- {
- if( !( input_GetItem( p_input )->p_meta->i_status & ITEM_PREPARSED ) )
- {
- p_demux->p_private = malloc( sizeof( demux_meta_t ) );
- if( !p_demux->p_private )
- {
- vlc_object_release( p_input );
- return VLC_ENOMEM;
- }
- module_t *p_meta = module_Need( p_demux, "meta reader", NULL, 0 );
- if( p_meta )
- {
- demux_meta_t *p_demux_meta = (demux_meta_t *)p_demux->p_private;
- vlc_meta_Merge( input_GetItem(p_input)->p_meta,
- p_demux_meta->p_meta );
- vlc_meta_Delete( p_demux_meta->p_meta );
- module_Unneed( p_demux, p_meta );
- p_sys->i_attachments = p_demux_meta->i_attachments;
- p_sys->attachments = p_demux_meta->attachments;
- }
- free( p_demux->p_private );
- }
- vlc_object_release( p_input );
- }
-
/* Initialize the Ogg physical bitstream parser */
ogg_sync_init( &p_sys->oy );
Ogg_EndOfStream( p_demux );
- int i;
- for( i = 0; i < p_sys->i_attachments; i++ )
- free( p_sys->attachments[i] );
- TAB_CLEAN( p_sys->i_attachments, p_sys->attachments);
-
free( p_sys );
}
{
if( p_stream->fmt.i_codec == VLC_FOURCC('t','h','e','o') &&
oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[1], "theora", 6 ) )
+ ! memcmp( oggpacket.packet, "\x80theora", 7 ) )
{
Ogg_ReadTheoraHeader( p_stream, &oggpacket );
p_stream->secondary_header_packets = 0;
}
else if( p_stream->fmt.i_codec == VLC_FOURCC('v','o','r','b') &&
oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[1], "vorbis", 6 ) )
+ ! memcmp( oggpacket.packet, "\x01vorbis", 7 ) )
{
Ogg_ReadVorbisHeader( p_stream, &oggpacket );
p_stream->secondary_header_packets = 0;
{
demux_sys_t *p_sys = p_demux->p_sys;
int64_t *pi64;
+ vlc_bool_t *pb_bool;
int i;
- input_attachment_t ***ppp_attach;
- int *pi_int;
switch( i_query )
{
+ case DEMUX_HAS_UNSUPPORTED_META:
+ pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
+ *pb_bool = VLC_TRUE;
+ return VLC_SUCCESS;
+
case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * );
*pi64 = p_sys->i_pcr;
}
ogg_sync_reset( &p_sys->oy );
- case DEMUX_GET_ATTACHMENTS:
- ppp_attach =
- (input_attachment_t***)va_arg( args, input_attachment_t*** );
- pi_int = (int*)va_arg( args, int * );
-
- if( p_sys->i_attachments <= 0 )
- return VLC_EGENERIC;
-
- *pi_int = p_sys->i_attachments;
- *ppp_attach = malloc( sizeof(input_attachment_t**) * p_sys->i_attachments );
- for( i = 0; i < p_sys->i_attachments; i++ )
- (*ppp_attach)[i] = vlc_input_attachment_Duplicate( p_sys->attachments[i] );
- return VLC_SUCCESS;
-
default:
return demux2_vaControlHelper( p_demux->s, 0, -1, p_sys->i_bitrate,
1, i_query, args );
}
if( p_oggpacket->bytes >= 7 &&
- ! memcmp ( &p_oggpacket->packet[0], "Annodex", 7 ) )
+ ! memcmp ( p_oggpacket->packet, "Annodex", 7 ) )
{
/* it's an Annodex packet -- skip it (do nothing) */
return;
}
else if( p_oggpacket->bytes >= 7 &&
- ! memcmp ( &p_oggpacket->packet[0], "AnxData", 7 ) )
+ ! memcmp ( p_oggpacket->packet, "AnxData", 7 ) )
{
/* it's an AnxData packet -- skip it (do nothing) */
return;
}
i_header_len++;
- if( p_block->i_buffer >= i_header_len )
+ if( p_block->i_buffer >= (unsigned int)i_header_len )
p_block->i_buffer -= i_header_len;
else
p_block->i_buffer = 0;
/* Check for Vorbis header */
if( oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[1], "vorbis", 6 ) )
+ ! memcmp( oggpacket.packet, "\x01vorbis", 7 ) )
{
Ogg_ReadVorbisHeader( p_stream, &oggpacket );
msg_Dbg( p_demux, "found vorbis header" );
}
/* Check for Speex header */
- else if( oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[0], "Speex", 5 ) )
+ else if( oggpacket.bytes >= 5 &&
+ ! memcmp( oggpacket.packet, "Speex", 5 ) )
{
Ogg_ReadSpeexHeader( p_stream, &oggpacket );
msg_Dbg( p_demux, "found speex header, channels: %i, "
}
/* Check for Flac header (< version 1.1.1) */
else if( oggpacket.bytes >= 4 &&
- ! memcmp( &oggpacket.packet[0], "fLaC", 4 ) )
+ ! memcmp( oggpacket.packet, "fLaC", 4 ) )
{
msg_Dbg( p_demux, "found FLAC header" );
}
/* Check for Theora header */
else if( oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[1], "theora", 6 ) )
+ ! memcmp( oggpacket.packet, "\x80theora", 7 ) )
{
Ogg_ReadTheoraHeader( p_stream, &oggpacket );
}
/* Check for Annodex header */
else if( oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[0], "Annodex", 7 ) )
+ ! memcmp( oggpacket.packet, "Annodex", 7 ) )
{
Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
&oggpacket );
}
/* Check for Annodex header */
else if( oggpacket.bytes >= 7 &&
- ! memcmp( &oggpacket.packet[0], "AnxData", 7 ) )
+ ! memcmp( oggpacket.packet, "AnxData", 7 ) )
{
Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
&oggpacket );
p_ogg->i_streams--;
}
}
+ else if( oggpacket.bytes >= 7 &&
+ ! memcmp( oggpacket.packet, "fishead", 7 ) )
+
+ {
+ /* Skeleton */
+ msg_Dbg( p_demux, "stream %d is a skeleton",
+ p_ogg->i_streams-1 );
+ /* FIXME: https://trac.videolan.org/vlc/ticket/1412 */
+ }
else
{
msg_Dbg( p_demux, "stream %d is of unknown type",
p_ogg->i_bitrate -= p_stream->fmt.i_bitrate;
ogg_stream_clear( &p_ogg->pp_stream[i_stream]->os );
- if( p_ogg->pp_stream[i_stream]->p_headers)
- free( p_ogg->pp_stream[i_stream]->p_headers );
+ free( p_ogg->pp_stream[i_stream]->p_headers );
es_format_Clean( &p_stream->fmt );
#undef p_stream
/* Reinit p_ogg */
- if( p_ogg->pp_stream ) free( p_ogg->pp_stream );
+ free( p_ogg->pp_stream );
p_ogg->pp_stream = NULL;
p_ogg->i_streams = 0;
}
ogg_packet *p_oggpacket )
{
if( p_oggpacket->bytes >= 28 &&
- !memcmp( &p_oggpacket->packet[0], "Annodex", 7 ) )
+ !memcmp( p_oggpacket->packet, "Annodex", 7 ) )
{
oggpack_buffer opb;
timebase_denominator = GetQWLE( &p_oggpacket->packet[24] );
}
else if( p_oggpacket->bytes >= 42 &&
- !memcmp( &p_oggpacket->packet[0], "AnxData", 7 ) )
+ !memcmp( p_oggpacket->packet, "AnxData", 7 ) )
{
uint64_t granule_rate_numerator;
uint64_t granule_rate_denominator;