#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_bits.h>
#include "../codec/cc.h"
#include "packetizer_helper.h"
+#include "../demux/mpeg/mpeg_parser_helpers.h"
/*****************************************************************************
* Module descriptor
/* ref_idc == 0 for 6,9,10,11,12 */
};
-enum nal_priority_e
-{
- NAL_PRIORITY_DISPOSABLE = 0,
- NAL_PRIORITY_LOW = 1,
- NAL_PRIORITY_HIGH = 2,
- NAL_PRIORITY_HIGHEST = 3,
-};
-
#define BLOCK_FLAG_PRIVATE_AUD (1 << BLOCK_FLAG_PRIVATE_SHIFT)
static block_t *Packetize( decoder_t *, block_t ** );
static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
static int PacketizeValidate( void *p_private, block_t * );
-static block_t *ParseNALBlock( decoder_t *, bool *pb_used_ts, block_t * );
+static block_t *ParseNALBlock( decoder_t *, bool *pb_ts_used, block_t * );
static block_t *CreateAnnexbNAL( decoder_t *, const uint8_t *p, int );
static block_t *OutputPicture( decoder_t *p_dec );
if( p_sys->cc.i_data <= 0 )
return NULL;
- p_cc = block_New( p_dec, p_sys->cc.i_data);
+ p_cc = block_Alloc( p_sys->cc.i_data);
if( p_cc )
{
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
{
block_t *p_nal;
- p_nal = block_New( p_dec, 4 + i_size );
+ p_nal = block_Alloc( 4 + i_size );
if( !p_nal ) return NULL;
/* Add start code */
*pp_ret = dst;
if( dst )
- {
- while( src < end )
- {
- if( src < end - 3 && src[0] == 0x00 && src[1] == 0x00 &&
- src[2] == 0x03 )
- {
- *dst++ = 0x00;
- *dst++ = 0x00;
-
- src += 3;
- continue;
- }
- *dst++ = *src++;
- }
- }
- *pi_ret = dst - *pp_ret;
-}
-
-static inline int bs_read_ue( bs_t *s )
-{
- int i = 0;
-
- while( bs_read1( s ) == 0 && s->p < s->p_end && i < 32 )
- {
- i++;
- }
- return( ( 1 << i) - 1 + bs_read( s, i ) );
-}
-
-static inline int bs_read_se( bs_t *s )
-{
- int val = bs_read_ue( s );
-
- return val&0x01 ? (val+1)/2 : -(val/2);
+ *pi_ret = nal_decode(src, dst, i_src);
}
/*****************************************************************************
* ParseNALBlock: parses annexB type NALs
* All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
*****************************************************************************/
-static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_frag )
+static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_pic = NULL;
if( p_frag )
block_ChainAppend( &p_sys->p_frame, p_frag );
- *pb_used_ts = false;
+ *pb_ts_used = false;
if( p_sys->i_frame_dts <= VLC_TS_INVALID &&
p_sys->i_frame_pts <= VLC_TS_INVALID )
{
p_sys->i_frame_dts = i_frag_dts;
p_sys->i_frame_pts = i_frag_pts;
- *pb_used_ts = true;
+ *pb_ts_used = true;
}
return p_pic;
}