Commit 1e9f16e2 authored by Gildas Bazin's avatar Gildas Bazin

* ALL: final improvements to the decoders/packetizers api.
   (There are still a few decoders/packetizers left to be converted but this shouldn't take too long).
* ALL: small improvements to the encoders api.
parent 1b973c94
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.41 2003/10/27 21:54:10 gbazin Exp $
* $Id: aout_internal.h,v 1.42 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -97,7 +97,7 @@ struct aout_fifo_t
/*****************************************************************************
* aout_filter_t : audio output filter
*****************************************************************************/
typedef struct aout_filter_t
struct aout_filter_t
{
VLC_COMMON_MEMBERS
......@@ -113,7 +113,7 @@ typedef struct aout_filter_t
struct aout_buffer_t * );
vlc_bool_t b_in_place;
vlc_bool_t b_continuity;
} aout_filter_t;
};
/*****************************************************************************
* aout_mixer_t : audio output mixer
......@@ -255,20 +255,10 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer );
/* From filters.c : */
int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int * pi_nb_filters,
const audio_sample_format_t * p_input_format,
const audio_sample_format_t * p_output_format );
void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters );
void aout_FiltersHintBuffers( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_alloc_t * p_first_alloc );
void aout_FiltersPlay( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_buffer_t ** pp_input_buffer );
VLC_EXPORT( int, aout_FiltersCreatePipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format ) );
VLC_EXPORT( void, aout_FiltersDestroyPipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters ) );
VLC_EXPORT( void, aout_FiltersPlay, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer ) );
void aout_FiltersHintBuffers( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_alloc_t * p_first_alloc );
/* From mixer.c : */
int aout_MixerNew( aout_instance_t * p_aout );
......
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.83 2003/10/08 21:01:07 gbazin Exp $
* $Id: audio_output.h,v 1.84 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -28,19 +28,24 @@
*****************************************************************************
* This structure defines a format for audio samples.
*****************************************************************************/
struct audio_sample_format_t
struct audio_format_t
{
vlc_fourcc_t i_format;
unsigned int i_rate;
/* Describes the channels configuration of the samples (ie. number of
* channels which are available in the buffer, and positions). */
uint32_t i_physical_channels;
/* Describes from which original channels, before downmixing, the
* buffer is derived. */
uint32_t i_original_channels;
/* Optional - for A/52, SPDIF and DTS types : */
/* Bytes used by one compressed frame, depends on bitrate. */
unsigned int i_bytes_per_frame;
/* Number of sampleframes contained in one compressed frame. */
unsigned int i_frame_length;
/* Please note that it may be completely arbitrary - buffers are not
......@@ -48,6 +53,12 @@ struct audio_sample_format_t
* just here for the division :
* buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
*/
/* FIXME ? (used by the codecs) */
int i_bitrate;
int i_channels;
int i_blockalign;
int i_bitspersample;
};
#define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.97 2003/11/06 16:36:41 nitrox Exp $
* $Id: input_ext-intf.h,v 1.98 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -26,6 +26,8 @@
#ifndef _VLC_INPUT_EXT_INTF_H
#define _VLC_INPUT_EXT_INTF_H 1
#include "ninput.h"
/*
* Communication input -> interface
*/
......@@ -65,6 +67,7 @@ struct es_descriptor_t
unsigned int i_pes_real_size; /* as indicated by the header */
/* Decoder information */
es_format_t fmt;
decoder_fifo_t * p_decoder_fifo;
void * p_waveformatex;
void * p_bitmapinfoheader;
......
......@@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.14 2003/11/13 17:59:34 gbazin Exp $
* $Id: ninput.h,v 1.15 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -24,6 +24,9 @@
#ifndef _NINPUT_H
#define _NINPUT_H 1
#include "audio_output.h"
#include "vlc_video.h"
enum es_extra_type_e
{
ES_EXTRA_TYPE_UNKNOWN,
......@@ -32,6 +35,12 @@ enum es_extra_type_e
ES_EXTRA_TYPE_SUBHEADER
};
typedef struct subs_format_t
{
char *psz_encoding;
} subs_format_t;
typedef struct
{
int i_cat;
......@@ -47,31 +56,16 @@ typedef struct
char *psz_language;
char *psz_description;
struct
{
int i_samplerate;
int i_channels;
int i_bitrate;
int i_blockalign;
int i_bitspersample;
} audio;
struct
{
int i_width;
int i_height;
int i_display_width;
int i_display_height;
} video;
struct
{
char *psz_encoding;
} subs;
audio_format_t audio;
video_format_t video;
subs_format_t subs;
int i_bitrate;
int i_extra_type;
int i_extra;
void *p_extra;
} es_format_t;
static inline void es_format_Init( es_format_t *fmt,
......@@ -84,18 +78,9 @@ static inline void es_format_Init( es_format_t *fmt,
fmt->psz_language = NULL;
fmt->psz_description = NULL;
fmt->audio.i_samplerate = 0;
fmt->audio.i_channels = 0;
fmt->audio.i_bitrate = 0;
fmt->audio.i_blockalign = 0;
fmt->audio.i_bitspersample = 0;
fmt->video.i_width = 0;
fmt->video.i_height = 0;
fmt->video.i_display_width = 0;
fmt->video.i_display_height = 0;
fmt->subs.psz_encoding = NULL;
memset( &fmt->audio, 0, sizeof(audio_format_t) );
memset( &fmt->video, 0, sizeof(video_format_t) );
memset( &fmt->subs, 0, sizeof(subs_format_t) );
fmt->i_extra_type = ES_EXTRA_TYPE_UNKNOWN;
fmt->i_extra = 0;
......
......@@ -2,7 +2,7 @@
* vlc_block_helper.h: Helper functions for data blocks management.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_block_helper.h,v 1.4 2003/10/23 20:51:20 gbazin Exp $
* $Id: vlc_block_helper.h,v 1.5 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -29,26 +29,38 @@ typedef struct block_bytestream_t
block_t *p_chain;
block_t *p_block;
int i_offset;
} block_bytestream_t;
#define block_BytestreamInit( a, b, c ) __block_BytestreamInit( VLC_OBJECT(a), b, c )
#define block_BytestreamInit( a ) __block_BytestreamInit( VLC_OBJECT(a) )
/*****************************************************************************
* block_bytestream_t management
*****************************************************************************/
static inline block_bytestream_t __block_BytestreamInit( vlc_object_t *p_obj,
block_t *p_block, int i_offset )
static inline block_bytestream_t __block_BytestreamInit( vlc_object_t *p_obj )
{
block_bytestream_t bytestream;
bytestream.i_offset = i_offset;
bytestream.p_block = p_block;
bytestream.p_chain = p_block;
bytestream.i_offset = 0;
bytestream.p_chain = bytestream.p_block = NULL;
return bytestream;
}
static inline block_t *block_BytestreamFlush( block_bytestream_t *p_bytestream)
static inline void block_BytestreamRelease( block_bytestream_t *p_bytestream )
{
while( p_bytestream->p_chain )
{
block_t *p_next;
p_next = p_bytestream->p_chain->p_next;
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_next;
}
p_bytestream->i_offset = 0;
p_bytestream->p_chain = p_bytestream->p_block = NULL;
}
static inline void block_BytestreamFlush( block_bytestream_t *p_bytestream )
{
while( p_bytestream->p_chain != p_bytestream->p_block )
{
......@@ -57,8 +69,54 @@ static inline block_t *block_BytestreamFlush( block_bytestream_t *p_bytestream)
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_next;
}
while( p_bytestream->p_block &&
(p_bytestream->p_block->i_buffer - p_bytestream->i_offset) == 0 )
{
block_t *p_next;
p_next = p_bytestream->p_chain->p_next;
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_bytestream->p_block = p_next;
p_bytestream->i_offset = 0;
}
}
return p_bytestream->p_chain;
static inline void block_BytestreamPush( block_bytestream_t *p_bytestream,
block_t *p_block )
{
block_ChainAppend( &p_bytestream->p_chain, p_block );
if( !p_bytestream->p_block ) p_bytestream->p_block = p_block;
}
static inline block_t *block_BytestreamPop( block_bytestream_t *p_bytestream )
{
block_t *p_block;
block_BytestreamFlush( p_bytestream );
p_block = p_bytestream->p_block;
if( p_block == NULL )
{
return NULL;
}
else if( !p_block->p_next )
{
p_block->p_buffer += p_bytestream->i_offset;
p_block->i_buffer -= p_bytestream->i_offset;
p_bytestream->i_offset = 0;
p_bytestream->p_chain = p_bytestream->p_block = NULL;
return p_block;
}
while( p_block->p_next && p_block->p_next->p_next )
p_block = p_block->p_next;
{
block_t *p_block_old = p_block;
p_block = p_block->p_next;
p_block_old->p_next = NULL;
}
return p_block;
}
static inline int block_SkipByte( block_bytestream_t *p_bytestream )
......@@ -151,6 +209,34 @@ static inline int block_GetByte( block_bytestream_t *p_bytestream,
return VLC_EGENERIC;
}
static inline int block_WaitBytes( block_bytestream_t *p_bytestream,
int i_data )
{
block_t *p_block;
int i_offset, i_copy, i_size;
/* Check we have that much data */
i_offset = p_bytestream->i_offset;
i_size = i_data;
i_copy = 0;
for( p_block = p_bytestream->p_block;
p_block != NULL; p_block = p_block->p_next )
{
i_copy = __MIN( i_size, p_block->i_buffer - i_offset );
i_size -= i_copy;
i_offset = 0;
if( !i_size ) break;
}
if( i_size )
{
/* Not enough data, bail out */
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
static inline int block_SkipBytes( block_bytestream_t *p_bytestream,
int i_data )
{
......
......@@ -2,7 +2,7 @@
* vlc_codec.h: codec related structures
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: vlc_codec.h,v 1.3 2003/11/05 18:59:01 gbazin Exp $
* $Id: vlc_codec.h,v 1.4 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -23,11 +23,15 @@
#ifndef _VLC_CODEC_H
#define _VLC_CODEC_H 1
#include "ninput.h"
/**
* \file
* This file defines the structure and types used by decoders and encoders
*/
typedef struct decoder_owner_sys_t decoder_owner_sys_t;
/**
* \defgroup decoder Decoder
*
......@@ -43,15 +47,39 @@ struct decoder_t
/* Module properties */
module_t * p_module;
decoder_sys_t * p_sys;
int ( * pf_init ) ( decoder_t * );
/* Deprecated */
int ( * pf_decode )( decoder_t *, block_t * );
int ( * pf_end ) ( decoder_t * );
decoder_fifo_t * p_fifo;
int ( * pf_run ) ( decoder_fifo_t * );
/* End deprecated */
/* Input properties */
decoder_fifo_t * p_fifo; /* stores the PES stream data */
picture_t * ( * pf_decode_video )( decoder_t *, block_t ** );
aout_buffer_t * ( * pf_decode_audio )( decoder_t *, block_t ** );
void ( * pf_decode_sub) ( decoder_t *, block_t ** );
block_t * ( * pf_packetize ) ( decoder_t *, block_t ** );
/* Tmp field for old decoder api */
int ( * pf_run ) ( decoder_fifo_t * );
/* Input format ie from demuxer (XXX: a lot of field could be invalid) */
es_format_t fmt_in;
/* Output format of decoder/packetizer */
es_format_t fmt_out;
/*
* Buffers allocation
*/
/* Audio output callbacks */
aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
void ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
/* Video output callbacks */
picture_t * ( * pf_vout_buffer_new) ( decoder_t * );
void ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
/* Private structure for the owner of the decoder */
decoder_owner_sys_t *p_owner;
};
/**
......@@ -79,22 +107,12 @@ struct encoder_t
block_t * ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
/* Properties of the input data fed to the encoder */
union {
audio_sample_format_t audio;
video_frame_format_t video;
} format;
es_format_t fmt_in;
/* Properties of the output of the encoder */
vlc_fourcc_t i_fourcc;
int i_bitrate;
int i_extra_data;
uint8_t *p_extra_data;
es_format_t fmt_out;
/* FIXME: move these to the ffmpeg encoder */
int i_frame_rate;
int i_frame_rate_base;
int i_aspect;
int i_key_int;
int i_b_frames;
int i_vtolerance;
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.85 2003/10/29 17:32:54 zorglub Exp $
* $Id: vlc_common.h,v 1.86 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -229,14 +229,17 @@ typedef struct aout_sys_t aout_sys_t;
typedef struct aout_fifo_t aout_fifo_t;
typedef struct aout_input_t aout_input_t;
typedef struct aout_buffer_t aout_buffer_t;
typedef struct audio_sample_format_t audio_sample_format_t;
typedef struct audio_format_t audio_format_t;
typedef audio_format_t audio_sample_format_t;
typedef struct audio_date_t audio_date_t;
typedef struct aout_filter_t aout_filter_t;
/* Video */
typedef struct vout_thread_t vout_thread_t;
typedef struct vout_sys_t vout_sys_t;
typedef struct chroma_sys_t chroma_sys_t;
typedef struct video_frame_format_t video_frame_format_t;
typedef struct video_format_t video_format_t;
typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t;
typedef struct picture_sys_t picture_sys_t;
typedef struct picture_heap_t picture_heap_t;
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_video.h,v 1.5 2003/10/24 21:27:06 gbazin Exp $
* $Id: vlc_video.h,v 1.6 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -28,7 +28,7 @@
/**
* Description of a video frame
*/
struct video_frame_format_t
struct video_format_t
{
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
......@@ -42,6 +42,8 @@ struct video_frame_format_t
unsigned int i_bits_per_pixel; /**< number of bits per pixel */
unsigned int i_frame_rate; /**< frame rate numerator */
unsigned int i_frame_rate_base; /**< frame rate denominator */
};
/**
......
/*****************************************************************************
* a52.c: A/52 basic parser
* a52.c: parse A/52 audio sync info and packetize the stream
*****************************************************************************
* Copyright (C) 2001-2002 VideoLAN
* $Id: a52.c,v 1.28 2003/10/23 20:51:20 gbazin Exp $
* $Id: a52.c,v 1.29 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -29,13 +29,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memcpy() */
#include <fcntl.h>
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include <vlc/input.h>
#include <vlc/aout.h>
#include <vlc/sout.h>
#include "vlc_block_helper.h"
......@@ -52,33 +49,16 @@ struct decoder_sys_t
/*
* Input properties
*/
int i_state;
int i_state;
block_t *p_chain;
block_bytestream_t bytestream;
/*
* Decoder output properties
*/
aout_instance_t * p_aout; /* opaque */
aout_input_t * p_aout_input; /* opaque */
audio_sample_format_t aout_format;
aout_buffer_t * p_aout_buffer; /* current aout buffer being filled */
/*
* Packetizer output properties
*/
sout_packetizer_input_t *p_sout_input;
sout_format_t sout_format;
sout_buffer_t * p_sout_buffer; /* current sout buffer */
/*
* Common properties
*/
uint8_t *p_out_buffer; /* output buffer */
audio_date_t end_date;
audio_date_t end_date;
mtime_t pts;
mtime_t i_pts;
int i_frame_size, i_bit_rate;
unsigned int i_rate, i_channels, i_channels_conf;
......@@ -89,7 +69,9 @@ enum {
STATE_NOSYNC,
STATE_SYNC,
STATE_HEADER,
STATE_DATA
STATE_NEXT_SYNC,
STATE_GET_DATA,
STATE_SEND_DATA
};
/****************************************************************************
......@@ -97,17 +79,14 @@ enum {
****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static int InitDecoder ( decoder_t * );
static int RunDecoder ( decoder_t *, block_t * );
static int EndDecoder ( decoder_t * );
static void CloseDecoder ( vlc_object_t * );
static void *DecodeBlock ( decoder_t *, block_t ** );
static int SyncInfo ( const byte_t *, int *, int *, int *,int * );
static int GetOutBuffer ( decoder_t *, uint8_t ** );
static int GetAoutBuffer( decoder_t *, aout_buffer_t ** );
static int GetSoutBuffer( decoder_t *, sout_buffer_t ** );
static int SendOutBuffer( decoder_t * );
static uint8_t *GetOutBuffer ( decoder_t *, void ** );
static aout_buffer_t *GetAoutBuffer( decoder_t * );
static block_t *GetSoutBuffer( decoder_t * );
/*****************************************************************************
* Module descriptor
......@@ -115,12 +94,12 @@ static int SendOutBuffer( decoder_t * );
vlc_module_begin();
set_description( _("A/52 parser") );
set_capability( "decoder", 100 );
set_callbacks( OpenDecoder, NULL );
set_callbacks( OpenDecoder, CloseDecoder );
add_submodule();
set_description( _("A/52 audio packetizer") );
set_capability( "packetizer", 10 );
set_callbacks( OpenPacketizer, NULL );
set_callbacks( OpenPacketizer, CloseDecoder );
vlc_module_end();
/*****************************************************************************
......@@ -129,25 +108,38 @@ vlc_module_end();
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ')
&& p_dec->p_fifo->i_fourcc != VLC_FOURCC('a','5','2','b') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('a','5','2',' ')
&& p_dec->fmt_in.i_codec != VLC_FOURCC('a','5','2','b') )
{
return VLC_EGENERIC;
}
p_dec->pf_init = InitDecoder;
p_dec->pf_decode = RunDecoder;
p_dec->pf_end = EndDecoder;
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys =
if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{
msg_Err( p_dec, "out of memory" );
return VLC_EGENERIC;
}
p_dec->p_sys->b_packetizer = VLC_FALSE;
/* Misc init */
p_sys->b_packetizer = VLC_FALSE;
p_sys->i_state = STATE_NOSYNC;
aout_DateSet( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit( p_dec );
/* Set output properties */
p_dec->fmt_out.i_cat = AUDIO_ES;
p_dec->fmt_out.i_codec = VLC_FOURCC('a','5','2',' ');
/* Set callback */
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
DecodeBlock;
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
DecodeBlock;
return VLC_SUCCESS;
}
......@@ -163,68 +155,38 @@ static int OpenPacketizer( vlc_object_t *p_this )
return i_ret;
}
/*****************************************************************************
* InitDecoder: Initalize the decoder
*****************************************************************************/
static int InitDecoder( decoder_t *p_dec )
{
p_dec->p_sys->i_state = STATE_NOSYNC;
p_dec->p_sys->p_out_buffer = NULL;
aout_DateSet( &p_dec->p_sys->end_date, 0 );
p_dec->p_sys->p_aout = NULL;
p_dec->p_sys->p_aout_input = NULL;
p_dec->p_sys->p_aout_buffer = NULL;
p_dec->p_sys->aout_format.i_format = VLC_FOURCC('a','5','2',' ');
p_dec->p_sys->p_sout_input = NULL;
p_dec->p_sys->p_sout_buffer = NULL;
p_dec->p_sys->sout_format.i_cat = AUDIO_ES;
p_dec->p_sys->sout_format.i_fourcc = VLC_FOURCC( 'a', '5', '2', ' ' );
p_dec->p_sys->p_chain = NULL;
return VLC_SUCCESS;
}
/****************************************************************************
* RunDecoder: the whole thing
* DecodeBlock: the whole thing
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
static int RunDecoder( decoder_t *p_dec, block_t *p_block )
static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[A52_HEADER_SIZE];
uint8_t *p_buf;
void *p_out_buffer;
if( !aout_DateGet( &p_sys->end_date ) && !p_block->i_pts )
if( !pp_block || !*pp_block ) return NULL;
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
/* We've just started the stream, wait for the first PTS. */
block_Release( p_block );
return VLC_SUCCESS;
block_Release( *pp_block );
return NULL;
}
if( p_block->b_discontinuity )
if( (*pp_block)->b_discontinuity )
{
p_sys->i_state = STATE_SYNC;
p_sys->i_state = STATE_NOSYNC;
}
if( p_sys->p_chain )
{
block_ChainAppend( &p_sys->p_chain, p_block );
}
else
{
block_ChainAppend( &p_sys->p_chain, p_block );
p_sys->bytestream = block_BytestreamInit( p_dec, p_sys->p_chain, 0 );
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );