[vlc-devel] [PATCH 05/17] Packetizer: Use vlc_frame_t instead of block_t
Denis Charmet
typx at dinauz.org
Mon Apr 22 19:10:34 CEST 2019
---
modules/packetizer/a52.c | 94 +++++-----
modules/packetizer/av1.c | 150 ++++++++--------
modules/packetizer/avparser.c | 42 ++---
modules/packetizer/avparser.h | 1 -
modules/packetizer/copy.c | 94 +++++-----
modules/packetizer/dts.c | 94 +++++-----
modules/packetizer/flac.c | 86 ++++-----
modules/packetizer/h264.c | 238 ++++++++++++-------------
modules/packetizer/h264_nal.c | 2 +-
modules/packetizer/h264_nal.h | 12 +-
modules/packetizer/hevc.c | 194 ++++++++++----------
modules/packetizer/hxxx_common.c | 35 ++--
modules/packetizer/hxxx_common.h | 8 +-
modules/packetizer/hxxx_nal.c | 68 +++----
modules/packetizer/hxxx_nal.h | 2 +-
modules/packetizer/hxxx_sei.c | 2 +-
modules/packetizer/mjpeg.c | 22 +--
modules/packetizer/mlp.c | 72 ++++----
modules/packetizer/mpeg4audio.c | 182 +++++++++----------
modules/packetizer/mpeg4video.c | 80 ++++-----
modules/packetizer/mpegaudio.c | 104 +++++------
modules/packetizer/mpegvideo.c | 118 ++++++------
modules/packetizer/packetizer_helper.h | 98 +++++-----
modules/packetizer/vc1.c | 132 +++++++-------
24 files changed, 964 insertions(+), 966 deletions(-)
diff --git a/modules/packetizer/a52.c b/modules/packetizer/a52.c
index 91afafcf54..6ffd485d9c 100644
--- a/modules/packetizer/a52.c
+++ b/modules/packetizer/a52.c
@@ -34,7 +34,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_modules.h>
#include "a52.h"
@@ -59,7 +59,7 @@ typedef struct
*/
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
/*
* Common properties
@@ -80,17 +80,17 @@ static void PacketizeFlush( decoder_t *p_dec )
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
p_sys->i_state = STATE_NOSYNC;
p_sys->i_prev_bytestream_pts = VLC_TICK_INVALID;
- block_BytestreamEmpty( &p_sys->bytestream );
+ vlc_frame_BytestreamEmpty( &p_sys->bytestream );
}
-static block_t *GetOutBuffer( decoder_t *p_dec )
+static vlc_frame_t *GetOutBuffer( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
assert( p_sys->frame.i_rate > 0 );
- block_t *p_block = block_Alloc( p_sys->i_input_size );
- if( p_block == NULL )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( p_sys->i_input_size );
+ if( p_frame == NULL )
return NULL;
if( p_dec->fmt_out.audio.i_rate != p_sys->frame.i_rate )
@@ -103,15 +103,15 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
date_Init( &p_sys->end_date, p_sys->frame.i_rate, 1 );
}
- if( p_sys->bytestream.p_block->i_pts != date_Get( &p_sys->end_date ) &&
- p_sys->bytestream.p_block->i_pts != VLC_TICK_INVALID )
+ if( p_sys->bytestream.p_data->i_pts != date_Get( &p_sys->end_date ) &&
+ p_sys->bytestream.p_data->i_pts != VLC_TICK_INVALID )
{
/* Make sure we don't reuse the same pts twice
* as A/52 in PES sends multiple times the same pts */
- if( p_sys->bytestream.p_block->i_pts != p_sys->i_prev_bytestream_pts )
- date_Set( &p_sys->end_date, p_sys->bytestream.p_block->i_pts );
- p_sys->i_prev_bytestream_pts = p_sys->bytestream.p_block->i_pts;
- p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ if( p_sys->bytestream.p_data->i_pts != p_sys->i_prev_bytestream_pts )
+ date_Set( &p_sys->end_date, p_sys->bytestream.p_data->i_pts );
+ p_sys->i_prev_bytestream_pts = p_sys->bytestream.p_data->i_pts;
+ p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
}
p_dec->fmt_out.audio.i_rate = p_sys->frame.i_rate;
@@ -125,42 +125,42 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
p_dec->fmt_out.i_bitrate = p_sys->frame.i_bitrate;
- p_block->i_nb_samples = p_sys->frame.i_samples;
- p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
- if( p_block->i_pts != VLC_TICK_INVALID )
- p_block->i_length = date_Increment( &p_sys->end_date,
- p_block->i_nb_samples ) - p_block->i_pts;
+ p_frame->i_nb_samples = p_sys->frame.i_samples;
+ p_frame->i_pts = p_frame->i_dts = date_Get( &p_sys->end_date );
+ if( p_frame->i_pts != VLC_TICK_INVALID )
+ p_frame->i_length = date_Increment( &p_sys->end_date,
+ p_frame->i_nb_samples ) - p_frame->i_pts;
- return p_block;
+ return p_frame;
}
-static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *PacketizeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[VLC_A52_MIN_HEADER_SIZE];
- block_t *p_out_buffer;
+ vlc_frame_t *p_out_buffer;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if( p_block )
+ if( p_frame )
{
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = PacketizeBlock( p_dec, NULL );
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = PacketizeFrame( p_dec, NULL );
if(p_drain)
return p_drain;
PacketizeFlush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- block_BytestreamPush( &p_sys->bytestream, p_block );
+ vlc_frame_BytestreamPush( &p_sys->bytestream, p_frame );
}
while( 1 )
@@ -168,7 +168,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
switch( p_sys->i_state )
{
case STATE_NOSYNC:
- while( block_PeekBytes( &p_sys->bytestream, p_header, 2 )
+ while( vlc_frame_PeekBytes( &p_sys->bytestream, p_header, 2 )
== VLC_SUCCESS )
{
if( p_header[0] == 0x0b && p_header[1] == 0x77 )
@@ -176,11 +176,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_SYNC;
break;
}
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
}
if( p_sys->i_state != STATE_SYNC )
{
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
/* Need more data */
return NULL;
@@ -193,7 +193,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_HEADER:
/* Get A/52 frame header (VLC_A52_HEADER_SIZE bytes) */
- if( block_PeekBytes( &p_sys->bytestream, p_header,
+ if( vlc_frame_PeekBytes( &p_sys->bytestream, p_header,
VLC_A52_MIN_HEADER_SIZE ) != VLC_SUCCESS )
{
/* Need more data */
@@ -205,7 +205,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
VLC_A52_MIN_HEADER_SIZE ) != VLC_SUCCESS )
{
msg_Dbg( p_dec, "emulated sync word" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -214,7 +214,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
{
msg_Warn( p_dec, "starting with dependent stream, skip it" );
p_sys->i_state = STATE_NOSYNC;
- if( block_SkipBytes( &p_sys->bytestream,
+ if( vlc_frame_SkipBytes( &p_sys->bytestream,
p_sys->frame.i_size ) != VLC_SUCCESS )
return NULL;
break;
@@ -226,11 +226,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_NEXT_SYNC:
/* Check if next expected frame contains the sync word */
- if( block_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_input_size,
+ if( vlc_frame_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_input_size,
p_header, VLC_A52_MIN_HEADER_SIZE )
!= VLC_SUCCESS )
{
- if( p_block == NULL ) /* drain */
+ if( p_frame == NULL ) /* drain */
{
p_sys->i_state = STATE_GET_DATA;
break;
@@ -251,7 +251,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "emulated sync word "
"(no sync on following frame)" );
p_sys->i_state = STATE_NOSYNC;
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
break;
}
@@ -265,7 +265,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_GET_DATA:
/* Make sure we have enough data. */
- if( block_WaitBytes( &p_sys->bytestream,
+ if( vlc_frame_WaitBytes( &p_sys->bytestream,
p_sys->i_input_size ) != VLC_SUCCESS )
{
/* Need more data */
@@ -282,26 +282,26 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
/* Copy the whole frame into the buffer. When we reach this point
* we already know we have enough data available. */
- block_GetBytes( &p_sys->bytestream, p_out_buffer->p_buffer,
+ vlc_frame_GetBytes( &p_sys->bytestream, p_out_buffer->p_buffer,
p_out_buffer->i_buffer );
p_sys->i_state = STATE_NOSYNC;
if( p_out_buffer->i_dts == VLC_TICK_INVALID )
{
- block_Release( p_out_buffer );
+ vlc_frame_Release( p_out_buffer );
return NULL;
}
if( p_sys->b_discontuinity )
{
- p_out_buffer->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_out_buffer->i_flags |= FRAME_FLAG_DISCONTINUITY;
p_sys->b_discontuinity = false;
}
- /* So p_block doesn't get re-added several times */
- if( pp_block )
- *pp_block = block_BytestreamPop( &p_sys->bytestream );
+ /* So p_frame doesn't get re-added several times */
+ if( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop( &p_sys->bytestream );
return p_out_buffer;
}
@@ -313,7 +313,7 @@ static void Close( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease( &p_sys->bytestream );
+ vlc_frame_BytestreamRelease( &p_sys->bytestream );
free( p_sys );
}
@@ -344,7 +344,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_prev_bytestream_pts = VLC_TICK_INVALID;
memset(&p_sys->frame, 0, sizeof(vlc_a52_header_t));
- block_BytestreamInit( &p_sys->bytestream );
+ vlc_frame_BytestreamInit( &p_sys->bytestream );
/* Set output properties (Passthrough ONLY) */
p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
@@ -352,7 +352,7 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_rate = 0;
/* Set callback */
- p_dec->pf_packetize = PacketizeBlock;
+ p_dec->pf_packetize = PacketizeFrame;
p_dec->pf_flush = PacketizeFlush;
p_dec->pf_get_cc = NULL;
return VLC_SUCCESS;
diff --git a/modules/packetizer/av1.c b/modules/packetizer/av1.c
index 9782aaa3d5..60ce2c360e 100644
--- a/modules/packetizer/av1.c
+++ b/modules/packetizer/av1.c
@@ -29,10 +29,10 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "av1.h"
#include "av1_obu.h"
@@ -46,40 +46,40 @@ typedef struct
{
struct
{
- block_t *p_chain;
- block_t **pp_chain_last;
+ vlc_frame_t *p_chain;
+ vlc_frame_t **pp_chain_last;
} obus;
- block_t *p_sequence_header_block;
+ vlc_frame_t *p_sequence_header_frame;
av1_OBU_sequence_header_t *p_sequence_header;
struct
{
bool b_has_visible_frame;
struct
{
- block_t *p_chain;
- block_t **pp_chain_last;
+ vlc_frame_t *p_chain;
+ vlc_frame_t **pp_chain_last;
} pre, frame, post;
vlc_tick_t dts;
vlc_tick_t pts;
} tu;
uint32_t i_seen;
- int i_next_block_flags;
+ int i_next_frame_flags;
} av1_sys_t;
-#define BLOCK_FLAG_DROP (1 << BLOCK_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_DROP (1 << FRAME_FLAG_PRIVATE_SHIFT)
/****************************************************************************
* Helpers
****************************************************************************/
-static inline void InitQueue(block_t **pp_head, block_t ***ppp_tail)
+static inline void InitQueue(vlc_frame_t **pp_head, vlc_frame_t ***ppp_tail)
{
*pp_head = NULL;
*ppp_tail = pp_head;
}
-static bool block_Differs(const block_t *a, const block_t *b)
+static bool vlc_frame_Differs(const vlc_frame_t *a, const vlc_frame_t *b)
{
return (a->i_buffer != b->i_buffer ||
memcmp(a->p_buffer, b->p_buffer, a->i_buffer));
@@ -88,7 +88,7 @@ static bool block_Differs(const block_t *a, const block_t *b)
#define INITQ(name) InitQueue(&p_sys->name.p_chain, &p_sys->name.pp_chain_last)
#define PUSHQ(name,b) \
{\
- block_ChainLastAppend(&p_sys->name.pp_chain_last, b);\
+ vlc_frame_ChainLastAppend(&p_sys->name.pp_chain_last, b);\
if(p_sys->tu.dts == VLC_TICK_INVALID)\
p_sys->tu.dts = b->i_dts; p_sys->tu.pts = b->i_pts;\
}
@@ -156,34 +156,34 @@ static void UpdateDecoderFormat(decoder_t *p_dec)
AV1_create_DecoderConfigurationRecord((uint8_t **)&p_dec->fmt_out.p_extra,
p_sys->p_sequence_header,
1,
- (const uint8_t **)&p_sys->p_sequence_header_block->p_buffer,
- &p_sys->p_sequence_header_block->i_buffer);
+ (const uint8_t **)&p_sys->p_sequence_header_frame->p_buffer,
+ &p_sys->p_sequence_header_frame->i_buffer);
}
}
-static block_t * OutputQueues(decoder_t *p_dec, bool b_valid)
+static vlc_frame_t * OutputQueues(decoder_t *p_dec, bool b_valid)
{
av1_sys_t *p_sys = p_dec->p_sys;
- block_t *p_output = NULL;
- block_t **pp_output_last = &p_output;
- uint32_t i_flags = 0; /* Because block_ChainGather does not merge flags or times */
+ vlc_frame_t *p_output = NULL;
+ vlc_frame_t **pp_output_last = &p_output;
+ uint32_t i_flags = 0; /* Because vlc_frame_ChainGather does not merge flags or times */
if(p_sys->tu.pre.p_chain)
{
- block_ChainLastAppend(&pp_output_last, p_sys->tu.pre.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->tu.pre.p_chain);
INITQ(tu.pre);
}
if(p_sys->tu.frame.p_chain)
{
i_flags |= p_sys->tu.frame.p_chain->i_flags;
- block_ChainLastAppend(&pp_output_last, p_sys->tu.frame.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->tu.frame.p_chain);
INITQ(tu.frame);
}
if(p_sys->tu.post.p_chain)
{
- block_ChainLastAppend(&pp_output_last, p_sys->tu.post.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->tu.post.p_chain);
INITQ(tu.post);
}
@@ -193,11 +193,11 @@ static block_t * OutputQueues(decoder_t *p_dec, bool b_valid)
p_output->i_pts = p_sys->tu.pts;
p_output->i_flags |= i_flags;
if(!b_valid)
- p_output->i_flags |= BLOCK_FLAG_DROP;
+ p_output->i_flags |= FRAME_FLAG_DROP;
else
{
- p_output->i_flags |= p_sys->i_next_block_flags;
- p_sys->i_next_block_flags = 0;
+ p_output->i_flags |= p_sys->i_next_frame_flags;
+ p_sys->i_next_frame_flags = 0;
}
}
@@ -212,9 +212,9 @@ static block_t * OutputQueues(decoder_t *p_dec, bool b_valid)
/****************************************************************************
* Packetizer Helpers
****************************************************************************/
-static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
+static vlc_frame_t *GatherAndValidateChain(decoder_t *p_dec, vlc_frame_t *p_outputchain)
{
- block_t *p_output = NULL;
+ vlc_frame_t *p_output = NULL;
av1_sys_t *p_sys = p_dec->p_sys;
VLC_UNUSED(p_sys);
@@ -222,7 +222,7 @@ static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
{
#ifdef DEBUG_AV1_PACKETIZER
msg_Dbg(p_dec, "TU output %ld", p_outputchain->i_dts);
- for(block_t *p = p_outputchain; p; p=p->p_next)
+ for(vlc_frame_t *p = p_outputchain; p; p=p->p_next)
{
enum av1_obu_type_e OBUtype = AV1_OBUGetType(p->p_buffer);
if(OBUtype == AV1_OBU_FRAME || OBUtype == AV1_OBU_FRAME_HEADER)
@@ -245,26 +245,26 @@ static block_t *GatherAndValidateChain(decoder_t *p_dec, block_t *p_outputchain)
else msg_Dbg(p_dec, "OBU TYPE %d sz %ld dts %ld", OBUtype, p->i_buffer, p->i_dts);
}
#endif
- if(p_outputchain->i_flags & BLOCK_FLAG_DROP)
+ if(p_outputchain->i_flags & FRAME_FLAG_DROP)
p_output = p_outputchain; /* Avoid useless gather */
else
- p_output = block_ChainGather(p_outputchain);
+ p_output = vlc_frame_ChainGather(p_outputchain);
}
- if(p_output && (p_output->i_flags & BLOCK_FLAG_DROP))
+ if(p_output && (p_output->i_flags & FRAME_FLAG_DROP))
{
- block_ChainRelease(p_output); /* Chain! see above */
+ vlc_frame_ChainRelease(p_output); /* Chain! see above */
p_output = NULL;
}
return p_output;
}
-static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
+static vlc_frame_t *ParseOBUFrame(decoder_t *p_dec, vlc_frame_t *p_obu)
{
av1_sys_t *p_sys = p_dec->p_sys;
- block_t * p_output = NULL;
+ vlc_frame_t * p_output = NULL;
enum av1_obu_type_e OBUtype = AV1_OBUGetType(p_obu->p_buffer);
const bool b_base_layer = AV1_OBUIsBaseLayer(p_obu->p_buffer, p_obu->i_buffer);
@@ -278,12 +278,12 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
if(b_base_layer)
{
/* Save a copy for Extradata */
- if(!p_sys->p_sequence_header_block ||
- block_Differs(p_sys->p_sequence_header_block, p_obu))
+ if(!p_sys->p_sequence_header_frame ||
+ vlc_frame_Differs(p_sys->p_sequence_header_frame, p_obu))
{
- if(p_sys->p_sequence_header_block)
- block_Release(p_sys->p_sequence_header_block);
- p_sys->p_sequence_header_block = block_Duplicate(p_obu);
+ if(p_sys->p_sequence_header_frame)
+ vlc_frame_Release(p_sys->p_sequence_header_frame);
+ p_sys->p_sequence_header_frame = vlc_frame_Duplicate(p_obu);
}
if(p_sys->p_sequence_header)
@@ -295,7 +295,7 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
case AV1_OBU_TEMPORAL_DELIMITER:
{
- p_output = OutputQueues(p_dec, p_sys->p_sequence_header_block != NULL);
+ p_output = OutputQueues(p_dec, p_sys->p_sequence_header_frame != NULL);
PUSHQ(tu.pre, p_obu);
} break;
@@ -318,10 +318,10 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
{
case AV1_FRAME_TYPE_KEY:
case AV1_FRAME_TYPE_INTRA_ONLY:
- p_obu->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_obu->i_flags |= FRAME_FLAG_TYPE_I;
break;
case AV1_FRAME_TYPE_INTER:
- p_obu->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_obu->i_flags |= FRAME_FLAG_TYPE_P;
break;
default:
break;
@@ -357,7 +357,7 @@ static block_t *ParseOBUBlock(decoder_t *p_dec, block_t *p_obu)
case AV1_OBU_REDUNDANT_FRAME_HEADER:
case AV1_OBU_PADDING:
default:
- block_Release(p_obu);
+ vlc_frame_Release(p_obu);
break;
}
@@ -374,69 +374,69 @@ static void PacketizeFlush(decoder_t *p_dec)
{
av1_sys_t *p_sys = p_dec->p_sys;
- block_ChainRelease(OutputQueues(p_dec, false));
+ vlc_frame_ChainRelease(OutputQueues(p_dec, false));
if(p_sys->p_sequence_header)
{
AV1_release_sequence_header(p_sys->p_sequence_header);
p_sys->p_sequence_header = NULL;
}
- if(p_sys->p_sequence_header_block)
+ if(p_sys->p_sequence_header_frame)
{
- block_Release(p_sys->p_sequence_header_block);
- p_sys->p_sequence_header_block = NULL;
+ vlc_frame_Release(p_sys->p_sequence_header_frame);
+ p_sys->p_sequence_header_frame = NULL;
}
- block_ChainRelease(p_sys->obus.p_chain);
+ vlc_frame_ChainRelease(p_sys->obus.p_chain);
INITQ(obus);
p_sys->tu.dts = VLC_TICK_INVALID;
p_sys->tu.pts = VLC_TICK_INVALID;
p_sys->tu.b_has_visible_frame = false;
p_sys->i_seen = 0;
- p_sys->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags = FRAME_FLAG_DISCONTINUITY;
}
/****************************************************************************
* Packetize
****************************************************************************/
-static block_t *PacketizeOBU(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *PacketizeOBU(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
av1_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = pp_block ? *pp_block : NULL;
- if(p_block)
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
+ if(p_frame)
{
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = PacketizeOBU( p_dec, NULL );
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = PacketizeOBU( p_dec, NULL );
if(p_drain)
return p_drain;
PacketizeFlush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- if(!AV1_OBUIsValid(p_block->p_buffer, p_block->i_buffer))
+ if(!AV1_OBUIsValid(p_frame->p_buffer, p_frame->i_buffer))
{
msg_Warn(p_dec,"fed with invalid OBU");
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
- *pp_block = NULL;
- block_ChainLastAppend(&p_sys->obus.pp_chain_last, p_block);
+ *pp_frame = NULL;
+ vlc_frame_ChainLastAppend(&p_sys->obus.pp_chain_last, p_frame);
}
- block_t *p_output = NULL;
+ vlc_frame_t *p_output = NULL;
while(p_sys->obus.p_chain)
{
- block_t *p_frag = p_sys->obus.p_chain;
+ vlc_frame_t *p_frag = p_sys->obus.p_chain;
AV1_OBU_iterator_ctx_t it;
AV1_OBU_iterator_init(&it, p_frag->p_buffer, p_frag->i_buffer);
@@ -451,11 +451,11 @@ static block_t *PacketizeOBU(decoder_t *p_dec, block_t **pp_block)
p_sys->obus.pp_chain_last = &p_sys->obus.p_chain;
else
p_frag->p_next = NULL;
- block_Release(p_frag);
+ vlc_frame_Release(p_frag);
continue;
}
- block_t *p_obublock;
+ vlc_frame_t *p_obuframe;
if(i_obu == p_frag->i_buffer)
{
p_sys->obus.p_chain = p_frag->p_next;
@@ -463,30 +463,30 @@ static block_t *PacketizeOBU(decoder_t *p_dec, block_t **pp_block)
p_sys->obus.pp_chain_last = &p_sys->obus.p_chain;
else
p_frag->p_next = NULL;
- p_obublock = p_frag;
+ p_obuframe = p_frag;
}
else
{
- p_obublock = block_Alloc(i_obu);
- memcpy(p_obublock->p_buffer, p_frag->p_buffer, i_obu);
+ p_obuframe = vlc_frame_Alloc(i_obu);
+ memcpy(p_obuframe->p_buffer, p_frag->p_buffer, i_obu);
p_frag->i_buffer -= i_obu;
p_frag->p_buffer += i_obu;
- p_obublock->i_dts = p_frag->i_dts;
- p_obublock->i_pts = p_frag->i_pts;
- p_obublock->i_flags = p_frag->i_flags;
+ p_obuframe->i_dts = p_frag->i_dts;
+ p_obuframe->i_pts = p_frag->i_pts;
+ p_obuframe->i_flags = p_frag->i_flags;
p_frag->i_flags = 0;
p_frag->i_dts = VLC_TICK_INVALID;
p_frag->i_pts = VLC_TICK_INVALID;
}
- p_output = ParseOBUBlock(p_dec, p_obublock);
+ p_output = ParseOBUFrame(p_dec, p_obuframe);
if(p_output)
break;
}
- if(!p_output && pp_block == NULL)
- p_output = OutputQueues(p_dec, p_sys->p_sequence_header_block != NULL);
+ if(!p_output && pp_frame == NULL)
+ p_output = OutputQueues(p_dec, p_sys->p_sequence_header_frame != NULL);
if(p_output)
{
@@ -526,13 +526,13 @@ static int Open(vlc_object_t *p_this)
return VLC_ENOMEM;
INITQ(obus);
- p_sys->p_sequence_header_block = NULL;
+ p_sys->p_sequence_header_frame = NULL;
p_sys->p_sequence_header = NULL;
p_sys->tu.b_has_visible_frame = false;
p_sys->tu.dts = VLC_TICK_INVALID;
p_sys->tu.pts = VLC_TICK_INVALID;
p_sys->i_seen = 0;
- p_sys->i_next_block_flags = 0;
+ p_sys->i_next_frame_flags = 0;
INITQ(tu.pre);
INITQ(tu.frame);
INITQ(tu.post);
diff --git a/modules/packetizer/avparser.c b/modules/packetizer/avparser.c
index d498ff6eaa..8972db8ec3 100644
--- a/modules/packetizer/avparser.c
+++ b/modules/packetizer/avparser.c
@@ -31,7 +31,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include "../codec/avcodec/avcodec.h"
#include "../codec/avcodec/avcommon.h"
@@ -56,8 +56,8 @@ typedef struct
int i_offset;
} decoder_sys_t;
-static block_t * Packetize( decoder_t *, block_t ** );
-static block_t * PacketizeClosed( decoder_t *, block_t ** );
+static vlc_frame_t * Packetize( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t * PacketizeClosed( decoder_t *, vlc_frame_t ** );
/*****************************************************************************
* FlushPacketizer: reopen as there's no clean way to flush avparser
@@ -154,22 +154,22 @@ void avparser_ClosePacketizer( vlc_object_t *p_this )
/*****************************************************************************
* Packetize: packetize a frame
*****************************************************************************/
-static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize ( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( pp_block == NULL || *pp_block == NULL )
+ if( pp_frame == NULL || *pp_frame == NULL )
return NULL;
- if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
+ if( (*pp_frame)->i_flags&(FRAME_FLAG_CORRUPTED) )
{
- block_Release( *pp_block );
+ vlc_frame_Release( *pp_frame );
return NULL;
}
- block_t * p_block = *pp_block;
+ vlc_frame_t * p_frame = *pp_frame;
- uint8_t * p_indata = p_block->p_buffer + p_sys->i_offset;
- int i_inlen = p_block->i_buffer - p_sys->i_offset;
+ uint8_t * p_indata = p_frame->p_buffer + p_sys->i_offset;
+ int i_inlen = p_frame->i_buffer - p_sys->i_offset;
uint8_t * p_outdata;
int i_outlen;
@@ -178,41 +178,41 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
p_sys->i_offset += av_parser_parse2( p_sys->p_parser_ctx, p_sys->p_codec_ctx,
&p_outdata, &i_outlen, p_indata, i_inlen,
- TO_AV_TS(p_block->i_pts), TO_AV_TS(p_block->i_dts), -1);
+ TO_AV_TS(p_frame->i_pts), TO_AV_TS(p_frame->i_dts), -1);
if( unlikely( i_outlen <= 0 || !p_outdata ) )
goto out;
- block_t * p_ret = block_Alloc( i_outlen );
+ vlc_frame_t * p_ret = vlc_frame_Alloc( i_outlen );
if( unlikely ( !p_ret ) )
goto out;
memcpy( p_ret->p_buffer, p_outdata, i_outlen );
- p_ret->i_pts = p_block->i_pts;
- p_ret->i_dts = p_block->i_dts;
+ p_ret->i_pts = p_frame->i_pts;
+ p_ret->i_dts = p_frame->i_dts;
if( p_sys->p_parser_ctx->key_frame == 1 )
- p_ret->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_ret->i_flags |= FRAME_FLAG_TYPE_I;
- p_block->i_pts = p_block->i_dts = VLC_TICK_INVALID;
+ p_frame->i_pts = p_frame->i_dts = VLC_TICK_INVALID;
return p_ret;
out:
p_sys->i_offset = 0;
- block_Release( *pp_block );
- *pp_block = NULL;
+ vlc_frame_Release( *pp_frame );
+ *pp_frame = NULL;
return NULL;
}
/*****************************************************************************
* PacketizeClosed: packetizer called after a flush failed
*****************************************************************************/
-static block_t *PacketizeClosed ( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *PacketizeClosed ( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
(void) p_dec;
- if( pp_block != NULL && *pp_block != NULL )
- block_Release( *pp_block );
+ if( pp_frame != NULL && *pp_frame != NULL )
+ vlc_frame_Release( *pp_frame );
return NULL;
}
diff --git a/modules/packetizer/avparser.h b/modules/packetizer/avparser.h
index 320615a691..8685773441 100644
--- a/modules/packetizer/avparser.h
+++ b/modules/packetizer/avparser.h
@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
#include "../codec/avcodec/avcodec.h"
#include "../codec/avcodec/avcommon.h"
diff --git a/modules/packetizer/copy.c b/modules/packetizer/copy.c
index 2207bc73f0..ee5f349649 100644
--- a/modules/packetizer/copy.c
+++ b/modules/packetizer/copy.c
@@ -32,7 +32,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
/*****************************************************************************
@@ -54,15 +54,15 @@ vlc_module_end ()
*****************************************************************************/
typedef struct
{
- block_t *p_block;
- void (*pf_parse)( decoder_t *, block_t * );
+ vlc_frame_t *p_frame;
+ void (*pf_parse)( decoder_t *, vlc_frame_t * );
} decoder_sys_t;
-static block_t *Packetize ( decoder_t *, block_t ** );
-static block_t *PacketizeSub( decoder_t *, block_t ** );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t *PacketizeSub( decoder_t *, vlc_frame_t ** );
static void Flush( decoder_t * );
-static void ParseWMV3( decoder_t *, block_t * );
+static void ParseWMV3( decoder_t *, vlc_frame_t * );
/*****************************************************************************
* Open: probe the packetizer and return score
@@ -87,7 +87,7 @@ static int Open( vlc_object_t *p_this )
if (unlikely(p_sys == NULL))
return VLC_ENOMEM;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
switch( p_dec->fmt_in.i_codec )
{
case VLC_CODEC_WMV3:
@@ -133,9 +133,9 @@ static void Close( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_sys->p_block )
+ if( p_sys->p_frame )
{
- block_ChainRelease( p_sys->p_block );
+ vlc_frame_ChainRelease( p_sys->p_frame );
}
free( p_dec->p_sys );
@@ -144,52 +144,52 @@ static void Close( vlc_object_t *p_this )
static void Flush( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_ret = p_sys->p_block;
+ vlc_frame_t *p_ret = p_sys->p_frame;
if ( p_ret )
{
- block_Release( p_ret );
- p_sys->p_block = NULL;
+ vlc_frame_Release( p_ret );
+ p_sys->p_frame = NULL;
}
}
/*****************************************************************************
- * Packetize: packetize an unit (here copy a complete block )
+ * Packetize: packetize an unit (here copy a complete frame )
*****************************************************************************/
-static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize ( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_ret = p_sys->p_block;
+ vlc_frame_t *p_ret = p_sys->p_frame;
- if( pp_block == NULL || *pp_block == NULL )
+ if( pp_frame == NULL || *pp_frame == NULL )
return NULL;
- if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
+ if( (*pp_frame)->i_flags&(FRAME_FLAG_CORRUPTED) )
{
- block_Release( *pp_block );
+ vlc_frame_Release( *pp_frame );
return NULL;
}
- p_block = *pp_block;
- *pp_block = NULL;
+ p_frame = *pp_frame;
+ *pp_frame = NULL;
- if( p_block->i_dts == VLC_TICK_INVALID )
+ if( p_frame->i_dts == VLC_TICK_INVALID )
{
- p_block->i_dts = p_block->i_pts;
+ p_frame->i_dts = p_frame->i_pts;
}
- if( p_block->i_dts == VLC_TICK_INVALID )
+ if( p_frame->i_dts == VLC_TICK_INVALID )
{
msg_Dbg( p_dec, "need valid dts" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- if( p_ret != NULL && p_block->i_pts > p_ret->i_pts )
+ if( p_ret != NULL && p_frame->i_pts > p_ret->i_pts )
{
if (p_dec->fmt_in.i_codec != VLC_CODEC_OPUS)
- p_ret->i_length = p_block->i_pts - p_ret->i_pts;
+ p_ret->i_length = p_frame->i_pts - p_ret->i_pts;
}
- p_sys->p_block = p_block;
+ p_sys->p_frame = p_frame;
if( p_ret && p_sys->pf_parse )
p_sys->pf_parse( p_dec, p_ret );
@@ -197,40 +197,40 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
}
/*****************************************************************************
- * PacketizeSub: packetize an unit (here copy a complete block )
+ * PacketizeSub: packetize an unit (here copy a complete frame )
*****************************************************************************/
-static block_t *PacketizeSub( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *PacketizeSub( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
- if( pp_block == NULL || *pp_block == NULL )
+ if( pp_frame == NULL || *pp_frame == NULL )
return NULL;
- if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
+ if( (*pp_frame)->i_flags&(FRAME_FLAG_CORRUPTED) )
{
- block_Release( *pp_block );
+ vlc_frame_Release( *pp_frame );
return NULL;
}
- p_block = *pp_block;
- *pp_block = NULL;
+ p_frame = *pp_frame;
+ *pp_frame = NULL;
- if( p_block->i_dts == VLC_TICK_INVALID )
+ if( p_frame->i_dts == VLC_TICK_INVALID )
{
- p_block->i_dts = p_block->i_pts;
+ p_frame->i_dts = p_frame->i_pts;
}
- if( p_block->i_dts == VLC_TICK_INVALID )
+ if( p_frame->i_dts == VLC_TICK_INVALID )
{
msg_Dbg( p_dec, "need valid dts" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- return p_block;
+ return p_frame;
}
/* Parse WMV3 packet and extract frame type information */
-static void ParseWMV3( decoder_t *p_dec, block_t *p_block )
+static void ParseWMV3( decoder_t *p_dec, vlc_frame_t *p_frame )
{
bs_t s;
@@ -247,17 +247,17 @@ static void ParseWMV3( decoder_t *p_dec, block_t *p_block )
return;
/* Parse frame type */
- bs_init( &s, p_block->p_buffer, p_block->i_buffer );
+ bs_init( &s, p_frame->p_buffer, p_frame->i_buffer );
bs_skip( &s, b_frame_interpolation +
2 +
b_range_reduction );
- p_block->i_flags &= ~BLOCK_FLAG_TYPE_MASK;
+ p_frame->i_flags &= ~FRAME_FLAG_TYPE_MASK;
if( bs_read( &s, 1 ) )
- p_block->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_P;
else if( !b_has_frames || bs_read( &s, 1 ) )
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
else
- p_block->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_B;
}
diff --git a/modules/packetizer/dts.c b/modules/packetizer/dts.c
index 0500009d57..3ff415bbc3 100644
--- a/modules/packetizer/dts.c
+++ b/modules/packetizer/dts.c
@@ -31,7 +31,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_modules.h>
#include "dts_header.h"
@@ -56,7 +56,7 @@ typedef struct
*/
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
size_t i_next_offset;
/*
@@ -85,10 +85,10 @@ static void PacketizeFlush( decoder_t *p_dec )
p_sys->b_discontinuity = true;
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
p_sys->i_state = STATE_NOSYNC;
- block_BytestreamEmpty( &p_sys->bytestream );
+ vlc_frame_BytestreamEmpty( &p_sys->bytestream );
}
-static block_t *GetOutBuffer( decoder_t *p_dec )
+static vlc_frame_t *GetOutBuffer( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -115,49 +115,49 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
p_dec->fmt_out.i_bitrate = p_sys->first.i_bitrate;
- block_t *p_block = block_Alloc( p_sys->i_input_size );
- if( p_block == NULL )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( p_sys->i_input_size );
+ if( p_frame == NULL )
return NULL;
- p_block->i_nb_samples = p_sys->first.i_frame_length;
- p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
- p_block->i_length =
- date_Increment( &p_sys->end_date, p_block->i_nb_samples ) - p_block->i_pts;
- return p_block;
+ p_frame->i_nb_samples = p_sys->first.i_frame_length;
+ p_frame->i_pts = p_frame->i_dts = date_Get( &p_sys->end_date );
+ p_frame->i_length =
+ date_Increment( &p_sys->end_date, p_frame->i_nb_samples ) - p_frame->i_pts;
+ return p_frame;
}
-static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *PacketizeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[VLC_DTS_HEADER_SIZE];
- block_t *p_out_buffer;
+ vlc_frame_t *p_out_buffer;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if( p_block )
+ if( p_frame )
{
- if ( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) {
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = PacketizeBlock( p_dec, NULL );
+ if ( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) ) {
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = PacketizeFrame( p_dec, NULL );
if(p_drain)
return p_drain;
PacketizeFlush( p_dec );
- if ( p_block->i_flags & BLOCK_FLAG_CORRUPTED ) {
- block_Release( p_block );
+ if ( p_frame->i_flags & FRAME_FLAG_CORRUPTED ) {
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- if ( p_block->i_pts == VLC_TICK_INVALID &&
+ if ( p_frame->i_pts == VLC_TICK_INVALID &&
date_Get( &p_sys->end_date ) == VLC_TICK_INVALID ) {
/* We've just started the stream, wait for the first PTS. */
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- block_BytestreamPush( &p_sys->bytestream, p_block );
+ vlc_frame_BytestreamPush( &p_sys->bytestream, p_frame );
}
while( 1 )
@@ -165,7 +165,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
switch( p_sys->i_state )
{
case STATE_NOSYNC:
- while( block_PeekBytes( &p_sys->bytestream, p_header, 6 )
+ while( vlc_frame_PeekBytes( &p_sys->bytestream, p_header, 6 )
== VLC_SUCCESS )
{
if( vlc_dts_header_IsSync( p_header, 6 ) )
@@ -173,11 +173,11 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_SYNC;
break;
}
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
}
if( p_sys->i_state != STATE_SYNC )
{
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
/* Need more data */
return NULL;
@@ -186,7 +186,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_SYNC:
/* New frame, set the Presentation Time Stamp */
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts;
if( p_sys->i_pts != VLC_TICK_INVALID &&
p_sys->i_pts != date_Get( &p_sys->end_date ) )
{
@@ -197,7 +197,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_HEADER:
/* Get DTS frame header (VLC_DTS_HEADER_SIZE bytes) */
- if( block_PeekBytes( &p_sys->bytestream, p_header,
+ if( vlc_frame_PeekBytes( &p_sys->bytestream, p_header,
VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
{
/* Need more data */
@@ -209,7 +209,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
{
msg_Dbg( p_dec, "emulated sync word" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -223,7 +223,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_SYNC_SUBSTREAM_EXTENSIONS:
/* Peek into the substream extension (sync + header size < frame_size) */
- if( block_PeekOffsetBytes( &p_sys->bytestream,
+ if( vlc_frame_PeekOffsetBytes( &p_sys->bytestream,
p_sys->first.i_substream_header_size,
p_header,
VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
@@ -237,7 +237,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
VLC_DTS_HEADER_SIZE ) != VLC_SUCCESS )
{
msg_Dbg( p_dec, "emulated substream sync word, can't find extension" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -260,7 +260,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Warn( p_dec, "substream without the paired core stream, skip it" );
p_sys->i_state = STATE_NOSYNC;
p_dec->fmt_out.i_profile = PROFILE_DTS;
- if( block_SkipBytes( &p_sys->bytestream,
+ if( vlc_frame_SkipBytes( &p_sys->bytestream,
p_sys->first.i_frame_size ) != VLC_SUCCESS )
return NULL;
break;
@@ -269,12 +269,12 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
/* Check if next expected frame contains the sync word */
while( p_sys->i_state == STATE_NEXT_SYNC )
{
- if( block_PeekOffsetBytes( &p_sys->bytestream,
+ if( vlc_frame_PeekOffsetBytes( &p_sys->bytestream,
p_sys->i_next_offset, p_header,
VLC_DTS_HEADER_SIZE )
!= VLC_SUCCESS )
{
- if( p_block == NULL ) /* drain */
+ if( p_frame == NULL ) /* drain */
{
p_sys->i_state = STATE_GET_DATA;
break;
@@ -294,7 +294,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
{
/* Even frame size is likely incorrect FSIZE #18166 */
if( (p_sys->first.i_frame_size % 2) && p_sys->i_next_offset > 0 &&
- block_PeekOffsetBytes( &p_sys->bytestream,
+ vlc_frame_PeekOffsetBytes( &p_sys->bytestream,
p_sys->i_next_offset - 1, p_header,
VLC_DTS_HEADER_SIZE ) == 0 &&
vlc_dts_header_IsSync( p_header, VLC_DTS_HEADER_SIZE ) )
@@ -306,7 +306,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "emulated sync word "
"(no sync on following frame)" );
p_sys->i_state = STATE_NOSYNC;
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
break;
}
@@ -344,7 +344,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_GET_DATA:
/* Make sure we have enough data. */
- if( block_WaitBytes( &p_sys->bytestream,
+ if( vlc_frame_WaitBytes( &p_sys->bytestream,
p_sys->i_input_size ) != VLC_SUCCESS )
{
/* Need more data */
@@ -361,22 +361,22 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
/* Copy the whole frame into the buffer. When we reach this point
* we already know we have enough data available. */
- block_GetBytes( &p_sys->bytestream, p_out_buffer->p_buffer,
+ vlc_frame_GetBytes( &p_sys->bytestream, p_out_buffer->p_buffer,
p_out_buffer->i_buffer );
/* Make sure we don't reuse the same pts twice */
- if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ if( p_sys->i_pts == p_sys->bytestream.p_data->i_pts )
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
if( p_sys->b_discontinuity )
{
p_sys->b_discontinuity = false;
- p_out_buffer->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_out_buffer->i_flags |= FRAME_FLAG_DISCONTINUITY;
}
- /* So p_block doesn't get re-added several times */
- if( pp_block )
- *pp_block = block_BytestreamPop( &p_sys->bytestream );
+ /* So p_frame doesn't get re-added several times */
+ if( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
@@ -390,7 +390,7 @@ static void Close( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease( &p_sys->bytestream );
+ vlc_frame_BytestreamRelease( &p_sys->bytestream );
free( p_sys );
}
@@ -415,14 +415,14 @@ static int Open( vlc_object_t *p_this )
p_sys->b_discontinuity = false;
memset(&p_sys->first, 0, sizeof(vlc_dts_header_t));
memset(&p_sys->second, 0, sizeof(vlc_dts_header_t));
- block_BytestreamInit( &p_sys->bytestream );
+ vlc_frame_BytestreamInit( &p_sys->bytestream );
/* Set output properties (passthrough only) */
p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
p_dec->fmt_out.audio = p_dec->fmt_in.audio;
/* Set callback */
- p_dec->pf_packetize = PacketizeBlock;
+ p_dec->pf_packetize = PacketizeFrame;
p_dec->pf_flush = PacketizeFlush;
p_dec->pf_get_cc = NULL;
return VLC_SUCCESS;
diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
index 244e0302cb..66c9c8dae6 100644
--- a/modules/packetizer/flac.c
+++ b/modules/packetizer/flac.c
@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
#include "flac.h"
@@ -61,7 +61,7 @@ typedef struct
*/
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
size_t i_offset;
/*
@@ -82,7 +82,7 @@ typedef struct
size_t i_buf;
uint8_t *p_buf;
- int i_next_block_flags;
+ int i_next_frame_flags;
} decoder_sys_t;
static const int pi_channels_maps[9] =
@@ -278,7 +278,7 @@ static void Flush(decoder_t *p_dec)
p_sys->i_state = STATE_NOSYNC;
p_sys->i_offset = 0;
date_Set( &p_sys->pts, VLC_TICK_INVALID );
- block_BytestreamEmpty(&p_sys->bytestream);
+ vlc_frame_BytestreamEmpty(&p_sys->bytestream);
}
static const uint8_t * FLACStartcodeHelper(const uint8_t *p, const uint8_t *end)
@@ -303,21 +303,21 @@ static bool FLACStartcodeMatcher(uint8_t i, size_t i_pos, const uint8_t *p_start
}
/* */
-static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *Packetize(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[FLAC_HEADER_SIZE_MAX];
- block_t *out = NULL, *in = NULL;
+ vlc_frame_t *out = NULL, *in = NULL;
- if ( pp_block && *pp_block)
+ if ( pp_frame && *pp_frame)
{
- in = *pp_block;
- *pp_block = NULL;
- if (in->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
+ in = *pp_frame;
+ *pp_frame = NULL;
+ if (in->i_flags&(FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED)) {
Flush(p_dec);
- p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
- if (in->i_flags&BLOCK_FLAG_CORRUPTED) {
- block_Release(in);
+ p_sys->i_next_frame_flags |= FRAME_FLAG_DISCONTINUITY;
+ if (in->i_flags&FRAME_FLAG_CORRUPTED) {
+ vlc_frame_Release(in);
return NULL;
}
}
@@ -333,11 +333,11 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
}
if ( in )
- block_BytestreamPush(&p_sys->bytestream, in);
+ vlc_frame_BytestreamPush(&p_sys->bytestream, in);
while (1) switch (p_sys->i_state) {
case STATE_NOSYNC:
- if(block_FindStartcodeFromOffset(&p_sys->bytestream, &p_sys->i_offset,
+ if(vlc_frame_FindStartcodeFromOffset(&p_sys->bytestream, &p_sys->i_offset,
NULL, 2,
FLACStartcodeHelper,
FLACStartcodeMatcher) == VLC_SUCCESS)
@@ -345,8 +345,8 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
p_sys->i_state = STATE_SYNC;
}
- block_SkipBytes(&p_sys->bytestream, p_sys->i_offset);
- block_BytestreamFlush(&p_sys->bytestream);
+ vlc_frame_SkipBytes(&p_sys->bytestream, p_sys->i_offset);
+ vlc_frame_BytestreamFlush(&p_sys->bytestream);
p_sys->i_offset = 0;
if( p_sys->i_state != STATE_SYNC )
@@ -362,7 +362,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
case STATE_HEADER:
/* Get FLAC frame header (MAX_FLAC_HEADER_SIZE bytes) */
- if (block_PeekBytes(&p_sys->bytestream, p_header, FLAC_HEADER_SIZE_MAX))
+ if (vlc_frame_PeekBytes(&p_sys->bytestream, p_header, FLAC_HEADER_SIZE_MAX))
return NULL; /* Need more data */
/* Check if frame is valid and get frame info */
@@ -371,7 +371,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
flac_crc8, &p_sys->headerinfo);
if (!i_ret) {
msg_Dbg(p_dec, "emulated sync word");
- block_SkipByte(&p_sys->bytestream);
+ vlc_frame_SkipByte(&p_sys->bytestream);
p_sys->i_offset = 0;
p_sys->i_state = STATE_NOSYNC;
break;
@@ -391,14 +391,14 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
case STATE_NEXT_SYNC:
{
- if(block_FindStartcodeFromOffset(&p_sys->bytestream, &p_sys->i_offset,
+ if(vlc_frame_FindStartcodeFromOffset(&p_sys->bytestream, &p_sys->i_offset,
NULL, 2,
FLACStartcodeHelper,
FLACStartcodeMatcher) != VLC_SUCCESS)
{
- if( pp_block == NULL ) /* EOF/Drain */
+ if( pp_frame == NULL ) /* EOF/Drain */
{
- p_sys->i_offset = block_BytestreamRemaining( &p_sys->bytestream );
+ p_sys->i_offset = vlc_frame_BytestreamRemaining( &p_sys->bytestream );
p_sys->i_state = STATE_GET_DATA;
continue;
}
@@ -407,7 +407,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
/* Check next header */
uint8_t nextheader[FLAC_HEADER_SIZE_MAX];
- if (block_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_offset,
+ if (vlc_frame_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_offset,
nextheader, FLAC_HEADER_SIZE_MAX))
return NULL; /* Need more data */
@@ -439,13 +439,13 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
p_sys->stream_info.max_framesize < p_sys->i_offset )
{
/* Something went wrong, truncate stream head and restart */
- block_SkipBytes( &p_sys->bytestream, FLAC_HEADER_SIZE_MAX + 2 );
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_SkipBytes( &p_sys->bytestream, FLAC_HEADER_SIZE_MAX + 2 );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
p_sys->i_frame_size = 0;
p_sys->crc = 0;
p_sys->i_offset = 0;
p_sys->i_state = STATE_NOSYNC;
- p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags |= FRAME_FLAG_DISCONTINUITY;
break;
}
else
@@ -466,7 +466,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
}
/* Copy from previous sync point (frame_size) up to to current (offset) */
- block_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_frame_size,
+ vlc_frame_PeekOffsetBytes( &p_sys->bytestream, p_sys->i_frame_size,
&p_sys->p_buf[p_sys->i_frame_size],
p_sys->i_offset - p_sys->i_frame_size );
@@ -491,13 +491,13 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
p_sys->i_state = STATE_SEND_DATA;
/* clean */
- block_SkipBytes( &p_sys->bytestream, p_sys->i_offset );
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_SkipBytes( &p_sys->bytestream, p_sys->i_offset );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
p_sys->i_last_frame_size = p_sys->i_frame_size;
p_sys->i_offset = 0;
p_sys->crc = 0;
- if( block_BytestreamRemaining(&p_sys->bytestream) > 0 )
+ if( vlc_frame_BytestreamRemaining(&p_sys->bytestream) > 0 )
p_sys->i_state = STATE_SEND_DATA;
else
p_sys->i_state = STATE_NOSYNC;
@@ -509,21 +509,21 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
p_dec->fmt_out.audio.i_channels = p_sys->headerinfo.i_channels;
p_dec->fmt_out.audio.i_physical_channels = pi_channels_maps[p_sys->stream_info.channels];
- if( p_sys->bytestream.p_block->i_pts > date_Get( &p_sys->pts ) &&
- p_sys->bytestream.p_block->i_pts != VLC_TICK_INVALID )
+ if( p_sys->bytestream.p_data->i_pts > date_Get( &p_sys->pts ) &&
+ p_sys->bytestream.p_data->i_pts != VLC_TICK_INVALID )
{
date_Init( &p_sys->pts, p_sys->headerinfo.i_rate, 1 );
- date_Set( &p_sys->pts, p_sys->bytestream.p_block->i_pts );
- p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ date_Set( &p_sys->pts, p_sys->bytestream.p_data->i_pts );
+ p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
}
- out = block_heap_Alloc( p_sys->p_buf, p_sys->i_frame_size );
+ out = vlc_frame_heap_Alloc( p_sys->p_buf, p_sys->i_frame_size );
if( out )
{
out->i_dts = out->i_pts = date_Get( &p_sys->pts );
- out->i_flags = p_sys->i_next_block_flags;
- p_sys->i_next_block_flags = 0;
+ out->i_flags = p_sys->i_next_frame_flags;
+ p_sys->i_next_frame_flags = 0;
}
else
p_sys->p_buf = NULL;
@@ -540,9 +540,9 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
p_sys->i_offset = 0;
p_sys->i_state = STATE_NOSYNC;
- /* So p_block doesn't get re-added several times */
- if ( pp_block )
- *pp_block = block_BytestreamPop(&p_sys->bytestream);
+ /* So p_frame doesn't get re-added several times */
+ if ( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop(&p_sys->bytestream);
return out;
}
@@ -572,8 +572,8 @@ static int Open(vlc_object_t *p_this)
p_sys->headerinfo.i_pts = VLC_TICK_INVALID;
p_sys->i_buf = 0;
p_sys->p_buf = NULL;
- p_sys->i_next_block_flags = 0;
- block_BytestreamInit(&p_sys->bytestream);
+ p_sys->i_next_frame_flags = 0;
+ vlc_frame_BytestreamInit(&p_sys->bytestream);
date_Init( &p_sys->pts, 1, 1 );
/* */
@@ -594,7 +594,7 @@ static void Close(vlc_object_t *p_this)
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease(&p_sys->bytestream);
+ vlc_frame_BytestreamRelease(&p_sys->bytestream);
free(p_sys->p_buf);
free(p_sys);
}
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 13806a1ba8..6e861c8c1f 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -35,9 +35,9 @@
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_bits.h>
#include "h264_nal.h"
#include "h264_slice.h"
@@ -77,8 +77,8 @@ typedef struct
bool b_slice;
struct
{
- block_t *p_head;
- block_t **pp_append;
+ vlc_frame_t *p_head;
+ vlc_frame_t **pp_append;
} frame, leading;
/* a new sps/pps can be transmitted outside of iframes */
@@ -87,12 +87,12 @@ typedef struct
struct
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
h264_sequence_parameter_set_t *p_sps;
} sps[H264_SPS_ID_MAX + 1];
struct
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
h264_picture_parameter_set_t *p_pps;
} pps[H264_PPS_ID_MAX + 1];
const h264_sequence_parameter_set_t *p_active_sps;
@@ -110,7 +110,7 @@ typedef struct
h264_slice_t slice;
/* */
- int i_next_block_flags;
+ int i_next_frame_flags;
bool b_recovered;
unsigned i_recoveryfnum;
unsigned i_recoverystartfnum;
@@ -132,25 +132,25 @@ typedef struct
cc_storage_t *p_ccs;
} decoder_sys_t;
-#define BLOCK_FLAG_PRIVATE_AUD (1 << BLOCK_FLAG_PRIVATE_SHIFT)
-#define BLOCK_FLAG_PRIVATE_SEI (2 << BLOCK_FLAG_PRIVATE_SHIFT)
-#define BLOCK_FLAG_DROP (4 << BLOCK_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_PRIVATE_AUD (1 << FRAME_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_PRIVATE_SEI (2 << FRAME_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_DROP (4 << FRAME_FLAG_PRIVATE_SHIFT)
-static block_t *Packetize( decoder_t *, block_t ** );
-static block_t *PacketizeAVC1( decoder_t *, block_t ** );
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
+static vlc_frame_t *Packetize( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t *PacketizeAVC1( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
static void PacketizeFlush( decoder_t * );
static void PacketizeReset( void *p_private, bool b_broken );
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
-static int PacketizeValidate( void *p_private, block_t * );
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t * );
+static int PacketizeValidate( void *p_private, vlc_frame_t * );
-static block_t *ParseNALBlock( decoder_t *, bool *pb_ts_used, block_t * );
+static vlc_frame_t *ParseNALFrame( decoder_t *, bool *pb_ts_used, vlc_frame_t * );
-static block_t *OutputPicture( decoder_t *p_dec );
-static void PutSPS( decoder_t *p_dec, block_t *p_frag );
-static void PutPPS( decoder_t *p_dec, block_t *p_frag );
-static bool ParseSliceHeader( decoder_t *p_dec, const block_t *p_frag, h264_slice_t *p_slice );
+static vlc_frame_t *OutputPicture( decoder_t *p_dec );
+static void PutSPS( decoder_t *p_dec, vlc_frame_t *p_frag );
+static void PutPPS( decoder_t *p_dec, vlc_frame_t *p_frag );
+static bool ParseSliceHeader( decoder_t *p_dec, const vlc_frame_t *p_frag, h264_slice_t *p_slice );
static bool ParseSeiCallback( const hxxx_sei_data_t *, void * );
@@ -161,28 +161,28 @@ static const uint8_t p_h264_startcode[3] = { 0x00, 0x00, 0x01 };
*****************************************************************************/
static void StoreSPS( decoder_sys_t *p_sys, uint8_t i_id,
- block_t *p_block, h264_sequence_parameter_set_t *p_sps )
+ vlc_frame_t *p_frame, h264_sequence_parameter_set_t *p_sps )
{
- if( p_sys->sps[i_id].p_block )
- block_Release( p_sys->sps[i_id].p_block );
+ if( p_sys->sps[i_id].p_frame )
+ vlc_frame_Release( p_sys->sps[i_id].p_frame );
if( p_sys->sps[i_id].p_sps )
h264_release_sps( p_sys->sps[i_id].p_sps );
if( p_sys->sps[i_id].p_sps == p_sys->p_active_sps )
p_sys->p_active_sps = NULL;
- p_sys->sps[i_id].p_block = p_block;
+ p_sys->sps[i_id].p_frame = p_frame;
p_sys->sps[i_id].p_sps = p_sps;
}
static void StorePPS( decoder_sys_t *p_sys, uint8_t i_id,
- block_t *p_block, h264_picture_parameter_set_t *p_pps )
+ vlc_frame_t *p_frame, h264_picture_parameter_set_t *p_pps )
{
- if( p_sys->pps[i_id].p_block )
- block_Release( p_sys->pps[i_id].p_block );
+ if( p_sys->pps[i_id].p_frame )
+ vlc_frame_Release( p_sys->pps[i_id].p_frame );
if( p_sys->pps[i_id].p_pps )
h264_release_pps( p_sys->pps[i_id].p_pps );
if( p_sys->pps[i_id].p_pps == p_sys->p_active_pps )
p_sys->p_active_pps = NULL;
- p_sys->pps[i_id].p_block = p_block;
+ p_sys->pps[i_id].p_frame = p_frame;
p_sys->pps[i_id].p_pps = p_pps;
}
@@ -236,27 +236,27 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
if( p_dec->fmt_out.i_extra == 0 && p_pps )
{
- const block_t *p_spsblock = NULL;
- const block_t *p_ppsblock = NULL;
- for( size_t i=0; i<=H264_SPS_ID_MAX && !p_spsblock; i++ )
+ const vlc_frame_t *p_spsframe = NULL;
+ const vlc_frame_t *p_ppsframe = NULL;
+ for( size_t i=0; i<=H264_SPS_ID_MAX && !p_spsframe; i++ )
if( p_sps == p_sys->sps[i].p_sps )
- p_spsblock = p_sys->sps[i].p_block;
+ p_spsframe = p_sys->sps[i].p_frame;
- for( size_t i=0; i<=H264_PPS_ID_MAX && !p_ppsblock; i++ )
+ for( size_t i=0; i<=H264_PPS_ID_MAX && !p_ppsframe; i++ )
if( p_pps == p_sys->pps[i].p_pps )
- p_ppsblock = p_sys->pps[i].p_block;
+ p_ppsframe = p_sys->pps[i].p_frame;
- if( p_spsblock && p_ppsblock )
+ if( p_spsframe && p_ppsframe )
{
- size_t i_alloc = p_ppsblock->i_buffer + p_spsblock->i_buffer;
+ size_t i_alloc = p_ppsframe->i_buffer + p_spsframe->i_buffer;
p_dec->fmt_out.p_extra = malloc( i_alloc );
if( p_dec->fmt_out.p_extra )
{
uint8_t*p_buf = p_dec->fmt_out.p_extra;
p_dec->fmt_out.i_extra = i_alloc;
- memcpy( &p_buf[0], p_spsblock->p_buffer, p_spsblock->i_buffer );
- memcpy( &p_buf[p_spsblock->i_buffer], p_ppsblock->p_buffer,
- p_ppsblock->i_buffer );
+ memcpy( &p_buf[0], p_spsframe->p_buffer, p_spsframe->i_buffer );
+ memcpy( &p_buf[p_spsframe->i_buffer], p_ppsframe->p_buffer,
+ p_ppsframe->i_buffer );
}
}
}
@@ -293,8 +293,8 @@ static bool IsFirstVCLNALUnit( const h264_slice_t *p_prev, const h264_slice_t *p
static void DropStoredNAL( decoder_sys_t *p_sys )
{
- block_ChainRelease( p_sys->frame.p_head );
- block_ChainRelease( p_sys->leading.p_head );
+ vlc_frame_ChainRelease( p_sys->frame.p_head );
+ vlc_frame_ChainRelease( p_sys->leading.p_head );
p_sys->frame.p_head = NULL;
p_sys->frame.pp_append = &p_sys->frame.p_head;
p_sys->leading.p_head = NULL;
@@ -348,20 +348,20 @@ static int Open( vlc_object_t *p_this )
for( i = 0; i <= H264_SPS_ID_MAX; i++ )
{
p_sys->sps[i].p_sps = NULL;
- p_sys->sps[i].p_block = NULL;
+ p_sys->sps[i].p_frame = NULL;
}
p_sys->p_active_sps = NULL;
for( i = 0; i <= H264_PPS_ID_MAX; i++ )
{
p_sys->pps[i].p_pps = NULL;
- p_sys->pps[i].p_block = NULL;
+ p_sys->pps[i].p_frame = NULL;
}
p_sys->p_active_pps = NULL;
p_sys->i_recovery_frame_cnt = UINT_MAX;
h264_slice_init( &p_sys->slice );
- p_sys->i_next_block_flags = 0;
+ p_sys->i_next_frame_flags = 0;
p_sys->b_recovered = false;
p_sys->i_recoveryfnum = UINT_MAX;
p_sys->i_frame_dts = VLC_TICK_INVALID;
@@ -492,32 +492,32 @@ static void PacketizeFlush( decoder_t *p_dec )
/****************************************************************************
* Packetize: the whole thing
* Search for the startcodes 3 or more bytes
- * Feed ParseNALBlock ALWAYS with 4 byte startcode prepended NALs
+ * Feed ParseNALFrame ALWAYS with 4 byte startcode prepended NALs
****************************************************************************/
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return packetizer_Packetize( &p_sys->packetizer, pp_block );
+ return packetizer_Packetize( &p_sys->packetizer, pp_frame );
}
/****************************************************************************
- * PacketizeAVC1: Takes VCL blocks of data and creates annexe B type NAL stream
+ * PacketizeAVC1: Takes VCL frames of data and creates annexe B type NAL stream
* Will always use 4 byte 0 0 0 1 startcodes
* Will prepend a SPS and PPS before each keyframe
****************************************************************************/
-static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *PacketizeAVC1( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
return PacketizeXXC1( p_dec, p_sys->i_avcC_length_size,
- pp_block, ParseNALBlock );
+ pp_frame, ParseNALFrame );
}
/*****************************************************************************
* GetCc:
*****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
decoder_sys_t *p_sys = p_dec->p_sys;
return cc_storage_get_current( p_sys->p_ccs, p_desc );
@@ -555,22 +555,22 @@ static void PacketizeReset( void *p_private, bool b_broken )
h264_poc_context_init( &p_sys->pocctx );
p_sys->prevdatedpoc.pts = VLC_TICK_INVALID;
}
- p_sys->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags = FRAME_FLAG_DISCONTINUITY;
p_sys->b_recovered = false;
p_sys->i_recoveryfnum = UINT_MAX;
date_Set( &p_sys->dts, VLC_TICK_INVALID );
}
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t *p_frame )
{
decoder_t *p_dec = p_private;
/* Remove trailing 0 bytes */
- while( p_block->i_buffer > 5 && p_block->p_buffer[p_block->i_buffer-1] == 0x00 )
- p_block->i_buffer--;
+ while( p_frame->i_buffer > 5 && p_frame->p_buffer[p_frame->i_buffer-1] == 0x00 )
+ p_frame->i_buffer--;
- return ParseNALBlock( p_dec, pb_ts_used, p_block );
+ return ParseNALFrame( p_dec, pb_ts_used, p_frame );
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
VLC_UNUSED(p_private);
VLC_UNUSED(p_au);
@@ -578,19 +578,19 @@ static int PacketizeValidate( void *p_private, block_t *p_au )
}
/*****************************************************************************
- * ParseNALBlock: parses annexB type NALs
- * All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
+ * ParseNALFrame: parses annexB type NALs
+ * All p_frag frames are required to start with 0 0 0 1 4-byte startcode
*****************************************************************************/
-static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
+static vlc_frame_t *ParseNALFrame( decoder_t *p_dec, bool *pb_ts_used, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_pic = NULL;
+ vlc_frame_t *p_pic = NULL;
const int i_nal_type = p_frag->p_buffer[4]&0x1f;
const vlc_tick_t i_frag_dts = p_frag->i_dts;
const vlc_tick_t i_frag_pts = p_frag->i_pts;
- bool b_au_end = p_frag->i_flags & BLOCK_FLAG_AU_END;
- p_frag->i_flags &= ~BLOCK_FLAG_AU_END;
+ bool b_au_end = p_frag->i_flags & FRAME_FLAG_AU_END;
+ p_frag->i_flags &= ~FRAME_FLAG_AU_END;
if( p_sys->b_slice && (!p_sys->p_active_pps || !p_sys->p_active_sps) )
{
@@ -630,9 +630,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
if( b_new_picture )
{
/* Parse SEI for that frame now we should have matched SPS/PPS */
- for( block_t *p_sei = p_sys->leading.p_head; p_sei; p_sei = p_sei->p_next )
+ for( vlc_frame_t *p_sei = p_sys->leading.p_head; p_sei; p_sei = p_sei->p_next )
{
- if( (p_sei->i_flags & BLOCK_FLAG_PRIVATE_SEI) == 0 )
+ if( (p_sei->i_flags & FRAME_FLAG_PRIVATE_SEI) == 0 )
continue;
HxxxParse_AnnexB_SEI( p_sei->p_buffer, p_sei->i_buffer,
1 /* nal header */, ParseSeiCallback, p_dec );
@@ -652,7 +652,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
}
p_sys->b_slice = true;
- block_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
} break;
/*** Prefix NALs ***/
@@ -664,9 +664,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
/* clear junk if no pic, we're always the first nal */
DropStoredNAL( p_sys );
- p_frag->i_flags |= BLOCK_FLAG_PRIVATE_AUD;
+ p_frag->i_flags |= FRAME_FLAG_PRIVATE_AUD;
- block_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
break;
case H264_NAL_SPS:
@@ -691,8 +691,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
if( p_sys->b_slice )
p_pic = OutputPicture( p_dec );
- p_frag->i_flags |= BLOCK_FLAG_PRIVATE_SEI;
- block_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
+ p_frag->i_flags |= FRAME_FLAG_PRIVATE_SEI;
+ vlc_frame_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
break;
case H264_NAL_SPS_EXT:
@@ -704,7 +704,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
if( p_sys->b_slice )
p_pic = OutputPicture( p_dec );
- block_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->leading.pp_append, p_frag );
break;
/*** Suffix NALs ***/
@@ -712,10 +712,10 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
case H264_NAL_END_OF_SEQ:
case H264_NAL_END_OF_STREAM:
/* Early end of packetization */
- block_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
/* important for still pictures/menus */
- p_sys->i_next_block_flags |= BLOCK_FLAG_END_OF_SEQUENCE;
+ p_sys->i_next_frame_flags |= FRAME_FLAG_END_OF_SEQUENCE;
if( p_sys->b_slice )
p_pic = OutputPicture( p_dec );
break;
@@ -728,7 +728,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
case H264_NAL_RESERVED_22:
case H264_NAL_RESERVED_23:
default: /* others 24..31, including unknown */
- block_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->frame.pp_append, p_frag );
break;
}
@@ -748,9 +748,9 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_ts_used, block_t *p_fr
p_pic = OutputPicture( p_dec );
}
- if( p_pic && (p_pic->i_flags & BLOCK_FLAG_DROP) )
+ if( p_pic && (p_pic->i_flags & FRAME_FLAG_DROP) )
{
- block_Release( p_pic );
+ vlc_frame_Release( p_pic );
p_pic = NULL;
}
@@ -768,11 +768,11 @@ static bool CanSwapPTSwithDTS( const h264_slice_t *p_slice,
return p_sps->i_profile == PROFILE_H264_CAVLC_INTRA;
}
-static block_t *OutputPicture( decoder_t *p_dec )
+static vlc_frame_t *OutputPicture( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_pic = NULL;
- block_t **pp_pic_last = &p_pic;
+ vlc_frame_t *p_pic = NULL;
+ vlc_frame_t **pp_pic_last = &p_pic;
if( unlikely(!p_sys->frame.p_head) )
{
@@ -832,41 +832,41 @@ static block_t *OutputPicture( decoder_t *p_dec )
}
/* Gather PPS/SPS if required */
- block_t *p_xpsnal = NULL;
- block_t **pp_xpsnal_tail = &p_xpsnal;
+ vlc_frame_t *p_xpsnal = NULL;
+ vlc_frame_t **pp_xpsnal_tail = &p_xpsnal;
if( b_need_sps_pps || p_sys->b_new_sps || p_sys->b_new_pps )
{
for( int i = 0; i <= H264_SPS_ID_MAX && (b_need_sps_pps || p_sys->b_new_sps); i++ )
{
- if( p_sys->sps[i].p_block )
- block_ChainLastAppend( &pp_xpsnal_tail, block_Duplicate( p_sys->sps[i].p_block ) );
+ if( p_sys->sps[i].p_frame )
+ vlc_frame_ChainLastAppend( &pp_xpsnal_tail, vlc_frame_Duplicate( p_sys->sps[i].p_frame ) );
}
for( int i = 0; i < H264_PPS_ID_MAX && (b_need_sps_pps || p_sys->b_new_pps); i++ )
{
- if( p_sys->pps[i].p_block )
- block_ChainLastAppend( &pp_xpsnal_tail, block_Duplicate( p_sys->pps[i].p_block ) );
+ if( p_sys->pps[i].p_frame )
+ vlc_frame_ChainLastAppend( &pp_xpsnal_tail, vlc_frame_Duplicate( p_sys->pps[i].p_frame ) );
}
}
/* Now rebuild NAL Sequence, inserting PPS/SPS if any */
if( p_sys->leading.p_head &&
- (p_sys->leading.p_head->i_flags & BLOCK_FLAG_PRIVATE_AUD) )
+ (p_sys->leading.p_head->i_flags & FRAME_FLAG_PRIVATE_AUD) )
{
- block_t *p_au = p_sys->leading.p_head;
+ vlc_frame_t *p_au = p_sys->leading.p_head;
p_sys->leading.p_head = p_au->p_next;
p_au->p_next = NULL;
- block_ChainLastAppend( &pp_pic_last, p_au );
+ vlc_frame_ChainLastAppend( &pp_pic_last, p_au );
}
if( p_xpsnal )
- block_ChainLastAppend( &pp_pic_last, p_xpsnal );
+ vlc_frame_ChainLastAppend( &pp_pic_last, p_xpsnal );
if( p_sys->leading.p_head )
- block_ChainLastAppend( &pp_pic_last, p_sys->leading.p_head );
+ vlc_frame_ChainLastAppend( &pp_pic_last, p_sys->leading.p_head );
assert( p_sys->frame.p_head );
if( p_sys->frame.p_head )
- block_ChainLastAppend( &pp_pic_last, p_sys->frame.p_head );
+ vlc_frame_ChainLastAppend( &pp_pic_last, p_sys->frame.p_head );
/* Reset chains, now empty */
p_sys->frame.p_head = NULL;
@@ -874,7 +874,7 @@ static block_t *OutputPicture( decoder_t *p_dec )
p_sys->leading.p_head = NULL;
p_sys->leading.pp_append = &p_sys->leading.p_head;
- p_pic = block_ChainGather( p_pic );
+ p_pic = vlc_frame_ChainGather( p_pic );
if( !p_pic )
{
@@ -884,9 +884,9 @@ static block_t *OutputPicture( decoder_t *p_dec )
}
/* clear up flags gathered */
- p_pic->i_flags &= ~BLOCK_FLAG_PRIVATE_MASK;
+ p_pic->i_flags &= ~FRAME_FLAG_PRIVATE_MASK;
- /* for PTS Fixup, interlaced fields (multiple AU/block) */
+ /* for PTS Fixup, interlaced fields (multiple AU/frame) */
int tFOC = 0, bFOC = 0, PictureOrderCount = 0;
h264_compute_poc( p_sps, &p_sys->slice, &p_sys->pocctx, &PictureOrderCount, &tFOC, &bFOC );
@@ -899,33 +899,33 @@ static block_t *OutputPicture( decoder_t *p_dec )
/* Top and Bottom field slices */
case 1:
case 2:
- p_pic->i_flags |= BLOCK_FLAG_SINGLE_FIELD;
- p_pic->i_flags |= (!p_sys->slice.i_bottom_field_flag) ? BLOCK_FLAG_TOP_FIELD_FIRST
- : BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_SINGLE_FIELD;
+ p_pic->i_flags |= (!p_sys->slice.i_bottom_field_flag) ? FRAME_FLAG_TOP_FIELD_FIRST
+ : FRAME_FLAG_BOTTOM_FIELD_FIRST;
break;
/* Each of the following slices contains multiple fields */
case 3:
- p_pic->i_flags |= BLOCK_FLAG_TOP_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_TOP_FIELD_FIRST;
break;
case 4:
- p_pic->i_flags |= BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_BOTTOM_FIELD_FIRST;
break;
case 5:
- p_pic->i_flags |= BLOCK_FLAG_TOP_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_TOP_FIELD_FIRST;
break;
case 6:
- p_pic->i_flags |= BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_BOTTOM_FIELD_FIRST;
break;
default:
break;
}
}
- /* set dts/pts to current block timestamps */
+ /* set dts/pts to current frame timestamps */
p_pic->i_dts = p_sys->i_frame_dts;
p_pic->i_pts = p_sys->i_frame_pts;
- /* Fixup missing timestamps after split (multiple AU/block)*/
+ /* Fixup missing timestamps after split (multiple AU/frame)*/
if( p_pic->i_dts == VLC_TICK_INVALID )
p_pic->i_dts = date_Get( &p_sys->dts );
@@ -1005,7 +1005,7 @@ static block_t *OutputPicture( decoder_t *p_dec )
/* save for next pic fixups */
if( date_Get( &p_sys->dts ) != VLC_TICK_INVALID )
{
- if( p_sys->i_next_block_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( p_sys->i_next_frame_flags & FRAME_FLAG_DISCONTINUITY )
date_Set( &p_sys->dts, VLC_TICK_INVALID );
else
date_Increment( &p_sys->dts, i_num_clock_ts );
@@ -1013,20 +1013,20 @@ static block_t *OutputPicture( decoder_t *p_dec )
if( p_pic )
{
- p_pic->i_flags |= p_sys->i_next_block_flags;
- p_sys->i_next_block_flags = 0;
+ p_pic->i_flags |= p_sys->i_next_frame_flags;
+ p_sys->i_next_frame_flags = 0;
}
switch( p_sys->slice.type )
{
case H264_SLICE_TYPE_P:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_P;
break;
case H264_SLICE_TYPE_B:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_B;
break;
case H264_SLICE_TYPE_I:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_I;
default:
break;
}
@@ -1034,12 +1034,12 @@ static block_t *OutputPicture( decoder_t *p_dec )
if( !p_sys->b_recovered )
{
if( p_sys->i_recoveryfnum != UINT_MAX ) /* recovering from SEI */
- p_pic->i_flags |= BLOCK_FLAG_PREROLL;
+ p_pic->i_flags |= FRAME_FLAG_PREROLL;
else
- p_pic->i_flags |= BLOCK_FLAG_DROP;
+ p_pic->i_flags |= FRAME_FLAG_DROP;
}
- p_pic->i_flags &= ~BLOCK_FLAG_PRIVATE_AUD;
+ p_pic->i_flags &= ~FRAME_FLAG_PRIVATE_AUD;
/* reset after output */
ResetOutputVariables( p_sys );
@@ -1050,7 +1050,7 @@ static block_t *OutputPicture( decoder_t *p_dec )
return p_pic;
}
-static void PutSPS( decoder_t *p_dec, block_t *p_frag )
+static void PutSPS( decoder_t *p_dec, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -1059,7 +1059,7 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
if( !hxxx_strip_AnnexB_startcode( &p_buffer, &i_buffer ) )
{
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return;
}
@@ -1067,7 +1067,7 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
if( !p_sps )
{
msg_Warn( p_dec, "invalid SPS" );
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return;
}
@@ -1078,7 +1078,7 @@ static void PutSPS( decoder_t *p_dec, block_t *p_frag )
StoreSPS( p_sys, p_sps->i_id, p_frag, p_sps );
}
-static void PutPPS( decoder_t *p_dec, block_t *p_frag )
+static void PutPPS( decoder_t *p_dec, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
const uint8_t *p_buffer = p_frag->p_buffer;
@@ -1086,7 +1086,7 @@ static void PutPPS( decoder_t *p_dec, block_t *p_frag )
if( !hxxx_strip_AnnexB_startcode( &p_buffer, &i_buffer ) )
{
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return;
}
@@ -1094,7 +1094,7 @@ static void PutPPS( decoder_t *p_dec, block_t *p_frag )
if( !p_pps )
{
msg_Warn( p_dec, "invalid PPS" );
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return;
}
@@ -1118,7 +1118,7 @@ static void GetSPSPPS( uint8_t i_pps_id, void *priv,
*pp_sps = p_sys->sps[(*pp_pps)->i_sps_id].p_sps;
}
-static bool ParseSliceHeader( decoder_t *p_dec, const block_t *p_frag, h264_slice_t *p_slice )
+static bool ParseSliceHeader( decoder_t *p_dec, const vlc_frame_t *p_frag, h264_slice_t *p_slice )
{
decoder_sys_t *p_sys = p_dec->p_sys;
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 0cf35899ab..6df0a9142c 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -639,7 +639,7 @@ IMPL_h264_generic_decode( h264_decode_sps, h264_sequence_parameter_set_t,
IMPL_h264_generic_decode( h264_decode_pps, h264_picture_parameter_set_t,
h264_parse_picture_parameter_set_rbsp, h264_release_pps )
-block_t *h264_NAL_to_avcC( uint8_t i_nal_length_size,
+vlc_frame_t *h264_NAL_to_avcC( uint8_t i_nal_length_size,
const uint8_t **pp_sps_buf,
const size_t *p_sps_size, uint8_t i_sps_count,
const uint8_t **pp_pps_buf,
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index b3a3001f23..4bfad3580f 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -170,12 +170,12 @@ bool h264_AnnexB_get_spspps( const uint8_t *p_buf, size_t i_buf,
const uint8_t **pp_ext, size_t *p_ext_size );
/* Create a AVCDecoderConfigurationRecord from non prefixed SPS/PPS
- * Returns a valid block_t on success, must be freed with block_Release */
-block_t *h264_NAL_to_avcC( uint8_t i_nal_length_size,
- const uint8_t **pp_sps_buf,
- const size_t *p_sps_size, uint8_t i_sps_count,
- const uint8_t **pp_pps_buf,
- const size_t *p_pps_size, uint8_t i_pps_count );
+ * Returns a valid vlc_frame_t on success, must be freed with vlc_frame_Release */
+vlc_frame_t *h264_NAL_to_avcC( uint8_t i_nal_length_size,
+ const uint8_t **pp_sps_buf,
+ const size_t *p_sps_size, uint8_t i_sps_count,
+ const uint8_t **pp_pps_buf,
+ const size_t *p_pps_size, uint8_t i_pps_count );
/* Convert AVCDecoderConfigurationRecord SPS/PPS to Annex B format */
uint8_t * h264_avcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 8cba9a66b7..36334c0a4f 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -31,10 +31,10 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
#include "startcode_helper.h"
#include "hevc_nal.h"
@@ -64,7 +64,7 @@ vlc_module_end ()
****************************************************************************/
struct hevc_tuple_s
{
- block_t *p_nal;
+ vlc_frame_t *p_nal;
void *p_decoded;
};
@@ -75,8 +75,8 @@ typedef struct
struct
{
- block_t *p_chain;
- block_t **pp_chain_last;
+ vlc_frame_t *p_chain;
+ vlc_frame_t **pp_chain_last;
} frame, pre, post;
uint8_t i_nal_length_size;
@@ -107,35 +107,35 @@ typedef struct
cc_storage_t *p_ccs;
} decoder_sys_t;
-static block_t *PacketizeAnnexB(decoder_t *, block_t **);
-static block_t *PacketizeHVC1(decoder_t *, block_t **);
+static vlc_frame_t *PacketizeAnnexB(decoder_t *, vlc_frame_t **);
+static vlc_frame_t *PacketizeHVC1(decoder_t *, vlc_frame_t **);
static void PacketizeFlush( decoder_t * );
static void PacketizeReset(void *p_private, bool b_broken);
-static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *);
-static block_t *ParseNALBlock(decoder_t *, bool *pb_ts_used, block_t *);
-static int PacketizeValidate(void *p_private, block_t *);
+static vlc_frame_t *PacketizeParse(void *p_private, bool *pb_ts_used, vlc_frame_t *);
+static vlc_frame_t *ParseNALFrame(decoder_t *, bool *pb_ts_used, vlc_frame_t *);
+static int PacketizeValidate(void *p_private, vlc_frame_t *);
static bool ParseSEICallback( const hxxx_sei_data_t *, void * );
-static block_t *GetCc( decoder_t *, decoder_cc_desc_t * );
-static block_t *GetXPSCopy(decoder_sys_t *);
+static vlc_frame_t *GetCc( decoder_t *, decoder_cc_desc_t * );
+static vlc_frame_t *GetXPSCopy(decoder_sys_t *);
-#define BLOCK_FLAG_DROP (1 << BLOCK_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_DROP (1 << FRAME_FLAG_PRIVATE_SHIFT)
static const uint8_t p_hevc_startcode[3] = {0x00, 0x00, 0x01};
/****************************************************************************
* Helpers
****************************************************************************/
-static inline void InitQueue( block_t **pp_head, block_t ***ppp_tail )
+static inline void InitQueue( vlc_frame_t **pp_head, vlc_frame_t ***ppp_tail )
{
*pp_head = NULL;
*ppp_tail = pp_head;
}
#define INITQ(name) InitQueue(&p_sys->name.p_chain, &p_sys->name.pp_chain_last)
-static block_t * OutputQueues(decoder_sys_t *p_sys, bool b_valid)
+static vlc_frame_t * OutputQueues(decoder_sys_t *p_sys, bool b_valid)
{
- block_t *p_output = NULL;
- block_t **pp_output_last = &p_output;
- uint32_t i_flags = 0; /* Because block_ChainGather does not merge flags or times */
+ vlc_frame_t *p_output = NULL;
+ vlc_frame_t **pp_output_last = &p_output;
+ uint32_t i_flags = 0; /* Because vlc_frame_ChainGather does not merge flags or times */
if(p_sys->pre.p_chain)
{
@@ -145,22 +145,22 @@ static block_t * OutputQueues(decoder_sys_t *p_sys, bool b_valid)
if(p_sys->pre.p_chain->i_buffer >= 5 &&
hevc_getNALType(&p_sys->pre.p_chain->p_buffer[4]) == HEVC_NAL_AUD)
{
- block_t *p_au = p_sys->pre.p_chain;
+ vlc_frame_t *p_au = p_sys->pre.p_chain;
p_sys->pre.p_chain = p_sys->pre.p_chain->p_next;
p_au->p_next = NULL;
- block_ChainLastAppend(&pp_output_last, p_au);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_au);
}
- block_ChainLastAppend(&pp_output_last, GetXPSCopy(p_sys));
+ vlc_frame_ChainLastAppend(&pp_output_last, GetXPSCopy(p_sys));
}
if(p_sys->pre.p_chain)
- block_ChainLastAppend(&pp_output_last, p_sys->pre.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->pre.p_chain);
INITQ(pre);
}
if(p_sys->frame.p_chain)
{
i_flags |= p_sys->frame.p_chain->i_flags;
- block_ChainLastAppend(&pp_output_last, p_sys->frame.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->frame.p_chain);
p_output->i_dts = date_Get(&p_sys->dts);
p_output->i_pts = p_sys->pts;
INITQ(frame);
@@ -169,7 +169,7 @@ static block_t * OutputQueues(decoder_sys_t *p_sys, bool b_valid)
if(p_sys->post.p_chain)
{
i_flags |= p_sys->post.p_chain->i_flags;
- block_ChainLastAppend(&pp_output_last, p_sys->post.p_chain);
+ vlc_frame_ChainLastAppend(&pp_output_last, p_sys->post.p_chain);
INITQ(post);
}
@@ -177,7 +177,7 @@ static block_t * OutputQueues(decoder_sys_t *p_sys, bool b_valid)
{
p_output->i_flags |= i_flags;
if(!b_valid)
- p_output->i_flags |= BLOCK_FLAG_DROP;
+ p_output->i_flags |= FRAME_FLAG_DROP;
}
return p_output;
@@ -276,16 +276,16 @@ static void Close(vlc_object_t *p_this)
decoder_sys_t *p_sys = p_dec->p_sys;
packetizer_Clean(&p_sys->packetizer);
- block_ChainRelease(p_sys->frame.p_chain);
- block_ChainRelease(p_sys->pre.p_chain);
- block_ChainRelease(p_sys->post.p_chain);
+ vlc_frame_ChainRelease(p_sys->frame.p_chain);
+ vlc_frame_ChainRelease(p_sys->pre.p_chain);
+ vlc_frame_ChainRelease(p_sys->post.p_chain);
for(unsigned i=0;i<=HEVC_PPS_ID_MAX; i++)
{
if(p_sys->rg_pps[i].p_decoded)
hevc_rbsp_release_pps(p_sys->rg_pps[i].p_decoded);
if(p_sys->rg_pps[i].p_nal)
- block_Release(p_sys->rg_pps[i].p_nal);
+ vlc_frame_Release(p_sys->rg_pps[i].p_nal);
}
for(unsigned i=0;i<=HEVC_SPS_ID_MAX; i++)
@@ -293,7 +293,7 @@ static void Close(vlc_object_t *p_this)
if(p_sys->rg_sps[i].p_decoded)
hevc_rbsp_release_sps(p_sys->rg_sps[i].p_decoded);
if(p_sys->rg_sps[i].p_nal)
- block_Release(p_sys->rg_sps[i].p_nal);
+ vlc_frame_Release(p_sys->rg_sps[i].p_nal);
}
for(unsigned i=0;i<=HEVC_VPS_ID_MAX; i++)
@@ -301,7 +301,7 @@ static void Close(vlc_object_t *p_this)
if(p_sys->rg_vps[i].p_decoded)
hevc_rbsp_release_vps(p_sys->rg_vps[i].p_decoded);
if(p_sys->rg_vps[i].p_nal)
- block_Release(p_sys->rg_vps[i].p_nal);
+ vlc_frame_Release(p_sys->rg_vps[i].p_nal);
}
hevc_release_sei_pic_timing( p_sys->p_timing );
@@ -314,19 +314,19 @@ static void Close(vlc_object_t *p_this)
/****************************************************************************
* Packetize
****************************************************************************/
-static block_t *PacketizeHVC1(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *PacketizeHVC1(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
return PacketizeXXC1( p_dec, p_sys->i_nal_length_size,
- pp_block, ParseNALBlock );
+ pp_frame, ParseNALFrame );
}
-static block_t *PacketizeAnnexB(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *PacketizeAnnexB(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return packetizer_Packetize(&p_sys->packetizer, pp_block);
+ return packetizer_Packetize(&p_sys->packetizer, pp_frame);
}
static void PacketizeFlush( decoder_t *p_dec )
@@ -339,7 +339,7 @@ static void PacketizeFlush( decoder_t *p_dec )
/*****************************************************************************
* GetCc:
*****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
decoder_sys_t *p_sys = p_dec->p_sys;
return cc_storage_get_current( p_sys->p_ccs, p_desc );
@@ -355,9 +355,9 @@ static void PacketizeReset(void *p_private, bool b_broken)
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_out = OutputQueues(p_sys, false);
+ vlc_frame_t *p_out = OutputQueues(p_sys, false);
if(p_out)
- block_ChainRelease(p_out);
+ vlc_frame_ChainRelease(p_out);
p_sys->sets = MISSING;
p_sys->b_recovery_point = false;
@@ -366,7 +366,7 @@ static void PacketizeReset(void *p_private, bool b_broken)
}
static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
- const block_t *p_nalb)
+ const vlc_frame_t *p_nalb)
{
decoder_sys_t *p_sys = p_dec->p_sys;
struct hevc_tuple_s *p_tuple;
@@ -435,7 +435,7 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
/* Free raw stored version */
if(p_tuple->p_nal)
{
- block_Release(p_tuple->p_nal);
+ vlc_frame_Release(p_tuple->p_nal);
p_tuple->p_nal = NULL;
}
@@ -475,7 +475,7 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
if(p_tuple->p_decoded && pp_active) /* restore active by id */
*pp_active = p_tuple->p_decoded;
- p_tuple->p_nal = block_Duplicate((block_t *)p_nalb);
+ p_tuple->p_nal = vlc_frame_Duplicate((vlc_frame_t *)p_nalb);
return true;
}
@@ -483,19 +483,19 @@ static bool InsertXPS(decoder_t *p_dec, uint8_t i_nal_type, uint8_t i_id,
return false;
}
-static block_t *GetXPSCopy(decoder_sys_t *p_sys)
+static vlc_frame_t *GetXPSCopy(decoder_sys_t *p_sys)
{
- block_t *p_chain = NULL;
- block_t **pp_append = &p_chain;
+ vlc_frame_t *p_chain = NULL;
+ vlc_frame_t **pp_append = &p_chain;
struct hevc_tuple_s *xpstype[3] = {p_sys->rg_vps, p_sys->rg_sps, p_sys->rg_pps};
size_t xpsmax[3] = {HEVC_VPS_ID_MAX, HEVC_SPS_ID_MAX, HEVC_PPS_ID_MAX};
for(size_t i=0; i<3; i++)
for(size_t j=0; j<xpsmax[i]; j++)
{
- block_t *p_dup;
+ vlc_frame_t *p_dup;
if(xpstype[i]->p_nal &&
- (p_dup = block_Duplicate(xpstype[i]->p_nal)))
- block_ChainLastAppend(&pp_append, p_dup);
+ (p_dup = vlc_frame_Duplicate(xpstype[i]->p_nal)))
+ vlc_frame_ChainLastAppend(&pp_append, p_dup);
};
return p_chain;
}
@@ -520,17 +520,17 @@ static bool XPSReady(decoder_sys_t *p_sys)
return false;
}
-static void AppendAsAnnexB(const block_t *p_block,
+static void AppendAsAnnexB(const vlc_frame_t *p_frame,
uint8_t **pp_dst, size_t *pi_dst)
{
- if(SIZE_MAX - p_block->i_buffer < *pi_dst )
+ if(SIZE_MAX - p_frame->i_buffer < *pi_dst )
return;
- size_t i_realloc = p_block->i_buffer + *pi_dst;
+ size_t i_realloc = p_frame->i_buffer + *pi_dst;
uint8_t *p_realloc = realloc(*pp_dst, i_realloc);
if(p_realloc)
{
- memcpy(&p_realloc[*pi_dst], p_block->p_buffer, p_block->i_buffer);
+ memcpy(&p_realloc[*pi_dst], p_frame->p_buffer, p_frame->i_buffer);
*pi_dst = i_realloc;
*pp_dst = p_realloc;
}
@@ -651,7 +651,7 @@ static void ParseStoredSEI( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- for( block_t *p_nal = p_sys->pre.p_chain;
+ for( vlc_frame_t *p_nal = p_sys->pre.p_chain;
p_nal; p_nal = p_nal->p_next )
{
if( p_nal->i_buffer < 5 )
@@ -665,17 +665,17 @@ static void ParseStoredSEI( decoder_t *p_dec )
}
}
-static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
+static vlc_frame_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, vlc_frame_t *p_frag)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_outputchain = NULL;
+ vlc_frame_t *p_outputchain = NULL;
const uint8_t *p_buffer = p_frag->p_buffer;
size_t i_buffer = p_frag->i_buffer;
if(unlikely(!hxxx_strip_AnnexB_startcode(&p_buffer, &i_buffer) || i_buffer < 3))
{
- block_ChainLastAppend(&p_sys->frame.pp_chain_last, p_frag); /* might be corrupted */
+ vlc_frame_ChainLastAppend(&p_sys->frame.pp_chain_last, p_frag); /* might be corrupted */
return NULL;
}
@@ -711,7 +711,7 @@ static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
case HEVC_NAL_IDR_W_RADL:
case HEVC_NAL_IDR_N_LP:
case HEVC_NAL_CRA:
- p_frag->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frag->i_flags |= FRAME_FLAG_TYPE_I;
break;
default:
@@ -724,18 +724,18 @@ static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
switch(type)
{
case HEVC_SLICE_TYPE_B:
- p_frag->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_frag->i_flags |= FRAME_FLAG_TYPE_B;
break;
case HEVC_SLICE_TYPE_P:
- p_frag->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frag->i_flags |= FRAME_FLAG_TYPE_P;
break;
case HEVC_SLICE_TYPE_I:
- p_frag->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frag->i_flags |= FRAME_FLAG_TYPE_I;
break;
}
}
}
- else p_frag->i_flags |= BLOCK_FLAG_TYPE_B;
+ else p_frag->i_flags |= FRAME_FLAG_TYPE_B;
}
break;
}
@@ -747,7 +747,7 @@ static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
if(p_sys->sets == MISSING && i_layer == 0 && XPSReady(p_sys))
p_sys->sets = COMPLETE;
- if(p_sys->sets != MISSING && (p_frag->i_flags & BLOCK_FLAG_TYPE_I))
+ if(p_sys->sets != MISSING && (p_frag->i_flags & FRAME_FLAG_TYPE_I))
{
p_sys->b_recovery_point = true; /* won't care about SEI recovery */
}
@@ -755,15 +755,15 @@ static block_t *ParseVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_frag)
if(!p_sys->b_recovery_point) /* content will be dropped */
cc_storage_reset(p_sys->p_ccs);
- block_ChainLastAppend(&p_sys->frame.pp_chain_last, p_frag);
+ vlc_frame_ChainLastAppend(&p_sys->frame.pp_chain_last, p_frag);
return p_outputchain;
}
-static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nalb)
+static vlc_frame_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, vlc_frame_t *p_nalb)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_ret = NULL;
+ vlc_frame_t *p_ret = NULL;
if(p_sys->post.p_chain || p_sys->frame.p_chain)
p_ret = OutputQueues(p_sys, p_sys->sets != MISSING &&
@@ -789,7 +789,7 @@ static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
InsertXPS(p_dec, i_nal_type, i_id, p_nalb);
if(p_sys->sets != SENT) /* will store/inject on first recovery point */
{
- block_Release(p_nalb);
+ vlc_frame_Release(p_nalb);
return p_ret;
}
break;
@@ -801,17 +801,17 @@ static block_t * ParseAUHead(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
break;
}
- block_ChainLastAppend(&p_sys->pre.pp_chain_last, p_nalb);
+ vlc_frame_ChainLastAppend(&p_sys->pre.pp_chain_last, p_nalb);
return p_ret;
}
-static block_t * ParseAUTail(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nalb)
+static vlc_frame_t * ParseAUTail(decoder_t *p_dec, uint8_t i_nal_type, vlc_frame_t *p_nalb)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_ret = NULL;
+ vlc_frame_t *p_ret = NULL;
- block_ChainLastAppend(&p_sys->post.pp_chain_last, p_nalb);
+ vlc_frame_ChainLastAppend(&p_sys->post.pp_chain_last, p_nalb);
switch(i_nal_type)
{
@@ -820,7 +820,7 @@ static block_t * ParseAUTail(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
p_ret = OutputQueues(p_sys, p_sys->sets != MISSING &&
p_sys->b_recovery_point);
if( p_ret )
- p_ret->i_flags |= BLOCK_FLAG_END_OF_SEQUENCE;
+ p_ret->i_flags |= FRAME_FLAG_END_OF_SEQUENCE;
break;
case HEVC_NAL_SUFF_SEI:
@@ -835,9 +835,9 @@ static block_t * ParseAUTail(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
return p_ret;
}
-static block_t * ParseNonVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_nalb)
+static vlc_frame_t * ParseNonVCL(decoder_t *p_dec, uint8_t i_nal_type, vlc_frame_t *p_nalb)
{
- block_t *p_ret = NULL;
+ vlc_frame_t *p_ret = NULL;
if ( (i_nal_type >= HEVC_NAL_VPS && i_nal_type <= HEVC_NAL_AUD) ||
i_nal_type == HEVC_NAL_PREF_SEI ||
@@ -854,28 +854,28 @@ static block_t * ParseNonVCL(decoder_t *p_dec, uint8_t i_nal_type, block_t *p_na
return p_ret;
}
-static block_t *GatherAndValidateChain(block_t *p_outputchain)
+static vlc_frame_t *GatherAndValidateChain(vlc_frame_t *p_outputchain)
{
- block_t *p_output = NULL;
+ vlc_frame_t *p_output = NULL;
if(p_outputchain)
{
- if(p_outputchain->i_flags & BLOCK_FLAG_DROP)
+ if(p_outputchain->i_flags & FRAME_FLAG_DROP)
p_output = p_outputchain; /* Avoid useless gather */
else
- p_output = block_ChainGather(p_outputchain);
+ p_output = vlc_frame_ChainGather(p_outputchain);
}
- if(p_output && (p_output->i_flags & BLOCK_FLAG_DROP))
+ if(p_output && (p_output->i_flags & FRAME_FLAG_DROP))
{
- block_ChainRelease(p_output); /* Chain! see above */
+ vlc_frame_ChainRelease(p_output); /* Chain! see above */
p_output = NULL;
}
return p_output;
}
-static void SetOutputBlockProperties(decoder_t *p_dec, block_t *p_output)
+static void SetOutputFrameProperties(decoder_t *p_dec, vlc_frame_t *p_output)
{
decoder_sys_t *p_sys = p_dec->p_sys;
/* Set frame duration */
@@ -891,20 +891,20 @@ static void SetOutputBlockProperties(decoder_t *p_dec, block_t *p_output)
}
p_sys->pts = VLC_TICK_INVALID;
}
- p_output->i_flags &= ~BLOCK_FLAG_AU_END;
+ p_output->i_flags &= ~FRAME_FLAG_AU_END;
hevc_release_sei_pic_timing(p_sys->p_timing);
p_sys->p_timing = NULL;
}
/*****************************************************************************
- * ParseNALBlock: parses annexB type NALs
- * All p_frag blocks are required to start with 0 0 0 1 4-byte startcode
+ * ParseNALFrame: parses annexB type NALs
+ * All p_frag frames are required to start with 0 0 0 1 4-byte startcode
*****************************************************************************/
-static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag)
+static vlc_frame_t *ParseNALFrame(decoder_t *p_dec, bool *pb_ts_used, vlc_frame_t *p_frag)
{
decoder_sys_t *p_sys = p_dec->p_sys;
*pb_ts_used = false;
- bool b_au_end = p_frag->i_flags & BLOCK_FLAG_AU_END;
+ bool b_au_end = p_frag->i_flags & FRAME_FLAG_AU_END;
if(p_sys->b_need_ts)
{
@@ -919,27 +919,27 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
if(unlikely(p_frag->i_buffer < 5))
{
msg_Warn(p_dec,"NAL too small");
- block_Release(p_frag);
+ vlc_frame_Release(p_frag);
return NULL;
}
if(p_frag->p_buffer[4] & 0x80)
{
msg_Warn(p_dec,"Forbidden zero bit not null, corrupted NAL");
- block_Release(p_frag);
+ vlc_frame_Release(p_frag);
return GatherAndValidateChain(OutputQueues(p_sys, false)); /* will drop */
}
/* Get NALU type */
const vlc_tick_t dts = p_frag->i_dts, pts = p_frag->i_pts;
- block_t * p_output = NULL;
+ vlc_frame_t * p_output = NULL;
uint8_t i_nal_type = hevc_getNALType(&p_frag->p_buffer[4]);
if (i_nal_type < HEVC_NAL_VPS)
{
/* NAL is a VCL NAL */
p_output = ParseVCL(p_dec, i_nal_type, p_frag);
- if (p_output && (p_output->i_flags & BLOCK_FLAG_DROP))
+ if (p_output && (p_output->i_flags & FRAME_FLAG_DROP))
msg_Info(p_dec, "Waiting for VPS/SPS/PPS");
}
else
@@ -960,7 +960,7 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
p_sys->sets = SENT;
}
- SetOutputBlockProperties( p_dec, p_output );
+ SetOutputFrameProperties( p_dec, p_output );
if (dts != VLC_TICK_INVALID)
date_Set(&p_sys->dts, dts);
p_sys->pts = pts;
@@ -970,23 +970,23 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
return p_output;
}
-static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *p_block)
+static vlc_frame_t *PacketizeParse(void *p_private, bool *pb_ts_used, vlc_frame_t *p_frame)
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
/* Remove trailing 0 bytes */
- while (p_block->i_buffer > 5 && p_block->p_buffer[p_block->i_buffer-1] == 0x00 )
- p_block->i_buffer--;
+ while (p_frame->i_buffer > 5 && p_frame->p_buffer[p_frame->i_buffer-1] == 0x00 )
+ p_frame->i_buffer--;
- p_block = ParseNALBlock( p_dec, pb_ts_used, p_block );
- if( p_block )
- cc_storage_commit( p_sys->p_ccs, p_block );
+ p_frame = ParseNALFrame( p_dec, pb_ts_used, p_frame );
+ if( p_frame )
+ cc_storage_commit( p_sys->p_ccs, p_frame );
- return p_block;
+ return p_frame;
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
VLC_UNUSED(p_private);
VLC_UNUSED(p_au);
diff --git a/modules/packetizer/hxxx_common.c b/modules/packetizer/hxxx_common.c
index 3ba7cbcb03..3906a2b7b9 100644
--- a/modules/packetizer/hxxx_common.c
+++ b/modules/packetizer/hxxx_common.c
@@ -22,7 +22,6 @@
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
#include <vlc_codec.h>
#include "hxxx_common.h"
@@ -72,7 +71,7 @@ void cc_storage_append( cc_storage_t *p_ccs, bool b_top_field_first,
cc_Extract( &p_ccs->next, CC_PAYLOAD_GA94, b_top_field_first, p_buf, i_buf );
}
-void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic )
+void cc_storage_commit( cc_storage_t *p_ccs, vlc_frame_t *p_pic )
{
p_ccs->i_pts = p_pic->i_pts;
p_ccs->i_dts = p_pic->i_dts;
@@ -81,20 +80,20 @@ void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic )
cc_Flush( &p_ccs->next );
}
-block_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t *p_desc )
+vlc_frame_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t *p_desc )
{
- block_t *p_block;
+ vlc_frame_t *p_block;
if( !p_ccs->current.b_reorder && p_ccs->current.i_data <= 0 )
return NULL;
- p_block = block_Alloc( p_ccs->current.i_data);
+ p_block = vlc_frame_Alloc( p_ccs->current.i_data);
if( p_block )
{
memcpy( p_block->p_buffer, p_ccs->current.p_data, p_ccs->current.i_data );
p_block->i_dts =
p_block->i_pts = p_ccs->current.b_reorder ? p_ccs->i_pts : p_ccs->i_dts;
- p_block->i_flags = p_ccs->i_flags & BLOCK_FLAG_TYPE_MASK;
+ p_block->i_flags = p_ccs->i_flags & FRAME_FLAG_TYPE_MASK;
p_desc->i_608_channels = p_ccs->current.i_608channels;
p_desc->i_708_channels = p_ccs->current.i_708channels;
@@ -110,18 +109,18 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t *p_desc
* Will always use 4 byte 0 0 0 1 startcodes
* Will prepend a SPS and PPS before each keyframe
****************************************************************************/
-block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
- block_t **pp_block, pf_annexb_nal_packetizer pf_nal_parser )
+vlc_frame_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
+ vlc_frame_t **pp_block, pf_annexb_nal_packetizer pf_nal_parser )
{
- block_t *p_block;
- block_t *p_ret = NULL;
+ vlc_frame_t *p_block;
+ vlc_frame_t *p_ret = NULL;
uint8_t *p;
if( !pp_block || !*pp_block )
return NULL;
- if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
+ if( (*pp_block)->i_flags&(FRAME_FLAG_CORRUPTED) )
{
- block_Release( *pp_block );
+ vlc_frame_Release( *pp_block );
return NULL;
}
@@ -150,19 +149,19 @@ block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
}
/* Convert AVC to AnnexB */
- block_t *p_nal;
+ vlc_frame_t *p_nal;
/* If data exactly match remaining bytes (1 NAL only or trailing one) */
if( i_size == p_block->p_buffer + p_block->i_buffer - p )
{
p_block->i_buffer = i_size;
p_block->p_buffer = p;
- p_nal = block_Realloc( p_block, 4, i_size );
+ p_nal = vlc_frame_Realloc( p_block, 4, i_size );
if( p_nal )
p_block = NULL;
}
else
{
- p_nal = block_Alloc( 4 + i_size );
+ p_nal = vlc_frame_Alloc( 4 + i_size );
if( p_nal )
{
p_nal->i_dts = p_block->i_dts;
@@ -183,10 +182,10 @@ block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
p_nal->p_buffer[3] = 0x01;
/* Parse the NAL */
- block_t *p_pic;
+ vlc_frame_t *p_pic;
if( ( p_pic = pf_nal_parser( p_dec, &b_dummy, p_nal ) ) )
{
- block_ChainAppend( &p_ret, p_pic );
+ vlc_frame_ChainAppend( &p_ret, p_pic );
}
if( !p_block )
@@ -194,7 +193,7 @@ block_t *PacketizeXXC1( decoder_t *p_dec, uint8_t i_nal_length_size,
}
if( p_block )
- block_Release( p_block );
+ vlc_frame_Release( p_block );
return p_ret;
}
diff --git a/modules/packetizer/hxxx_common.h b/modules/packetizer/hxxx_common.h
index eff2f0b3c2..b03af720ad 100644
--- a/modules/packetizer/hxxx_common.h
+++ b/modules/packetizer/hxxx_common.h
@@ -31,14 +31,14 @@ void cc_storage_delete( cc_storage_t *p_ccs );
void cc_storage_reset( cc_storage_t *p_ccs );
void cc_storage_append( cc_storage_t *p_ccs, bool b_top_field_first,
const uint8_t *p_buf, size_t i_buf );
-void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic );
+void cc_storage_commit( cc_storage_t *p_ccs, vlc_frame_t *p_pic );
-block_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t * );
+vlc_frame_t * cc_storage_get_current( cc_storage_t *p_ccs, decoder_cc_desc_t * );
/* */
-typedef block_t * (*pf_annexb_nal_packetizer)(decoder_t *, bool *, block_t *);
-block_t *PacketizeXXC1( decoder_t *, uint8_t, block_t **, pf_annexb_nal_packetizer );
+typedef vlc_frame_t * (*pf_annexb_nal_packetizer)(decoder_t *, bool *, vlc_frame_t *);
+vlc_frame_t *PacketizeXXC1( decoder_t *, uint8_t, vlc_frame_t **, pf_annexb_nal_packetizer );
#endif // HXXX_COMMON_H
diff --git a/modules/packetizer/hxxx_nal.c b/modules/packetizer/hxxx_nal.c
index 73450606e3..31a413c827 100644
--- a/modules/packetizer/hxxx_nal.c
+++ b/modules/packetizer/hxxx_nal.c
@@ -21,14 +21,14 @@
#include "hxxx_nal.h"
-#include <vlc_block.h>
+#include <vlc_frame.h>
-static bool block_WillRealloc( block_t *p_block, ssize_t i_prebody, size_t i_body )
+static bool vlc_frame_WillRealloc( vlc_frame_t *p_frame, ssize_t i_prebody, size_t i_body )
{
if( i_prebody <= 0 && i_body <= (size_t)(-i_prebody) )
return false;
else
- return ( i_prebody + i_body <= p_block->i_size );
+ return ( i_prebody + i_body <= p_frame->i_size );
}
static inline void hxxx_WritePrefix( uint8_t i_nal_length_size, uint8_t *p_dest, uint32_t i_payload )
@@ -41,7 +41,7 @@ static inline void hxxx_WritePrefix( uint8_t i_nal_length_size, uint8_t *p_dest,
*p_dest = i_payload;
}
-block_t *hxxx_AnnexB_to_xVC( block_t *p_block, uint8_t i_nal_length_size )
+vlc_frame_t *hxxx_AnnexB_to_xVC( vlc_frame_t *p_frame, uint8_t i_nal_length_size )
{
unsigned i_nalcount = 0;
unsigned i_list = 16;
@@ -52,15 +52,15 @@ block_t *hxxx_AnnexB_to_xVC( block_t *p_block, uint8_t i_nal_length_size )
off_t move; /* move offset */
} *p_list = NULL;
- if(!p_block->i_buffer || p_block->p_buffer[0])
+ if(!p_frame->i_buffer || p_frame->p_buffer[0])
goto error;
if(! (p_list = vlc_alloc( i_list, sizeof(*p_list) )) )
goto error;
/* Search all startcode of size 3 */
- const uint8_t *p_buf = p_block->p_buffer;
- const uint8_t *p_end = &p_block->p_buffer[p_block->i_buffer];
+ const uint8_t *p_buf = p_frame->p_buffer;
+ const uint8_t *p_end = &p_frame->p_buffer[p_frame->i_buffer];
unsigned i_bitflow = 0;
off_t i_move = 0;
while( p_buf != p_end )
@@ -101,57 +101,57 @@ block_t *hxxx_AnnexB_to_xVC( block_t *p_block, uint8_t i_nal_length_size )
if( !i_nalcount )
goto error;
- /* Optimization for 1 NAL block only case */
- if( i_nalcount == 1 && block_WillRealloc( p_block, p_list[0].move, p_block->i_buffer ) )
+ /* Optimization for 1 NAL frame only case */
+ if( i_nalcount == 1 && vlc_frame_WillRealloc( p_frame, p_list[0].move, p_frame->i_buffer ) )
{
- uint32_t i_payload = p_block->i_buffer - p_list[0].prefix;
- block_t *p_newblock = block_Realloc( p_block, p_list[0].move, p_block->i_buffer );
- if( unlikely(!p_newblock) )
+ uint32_t i_payload = p_frame->i_buffer - p_list[0].prefix;
+ vlc_frame_t *p_newframe = vlc_frame_Realloc( p_frame, p_list[0].move, p_frame->i_buffer );
+ if( unlikely(!p_newframe) )
goto error;
- p_block = p_newblock;
- hxxx_WritePrefix( i_nal_length_size, p_block->p_buffer , i_payload );
+ p_frame = p_newframe;
+ hxxx_WritePrefix( i_nal_length_size, p_frame->p_buffer , i_payload );
free( p_list );
- return p_block;
+ return p_frame;
}
- block_t *p_release = NULL;
+ vlc_frame_t *p_release = NULL;
const uint8_t *p_source = NULL;
const uint8_t *p_sourceend = NULL;
uint8_t *p_dest = NULL;
- const size_t i_dest = p_block->i_buffer + p_list[i_nalcount - 1].move;
+ const size_t i_dest = p_frame->i_buffer + p_list[i_nalcount - 1].move;
if( p_list[i_nalcount - 1].move != 0 || i_nal_length_size != 4 ) /* We'll need to grow or shrink */
{
/* If we grow in size, try using realloc to avoid memcpy */
- if( p_list[i_nalcount - 1].move > 0 && block_WillRealloc( p_block, 0, i_dest ) )
+ if( p_list[i_nalcount - 1].move > 0 && vlc_frame_WillRealloc( p_frame, 0, i_dest ) )
{
- uint32_t i_sizebackup = p_block->i_buffer;
- block_t *p_newblock = block_Realloc( p_block, 0, i_dest );
- if( unlikely(!p_newblock) )
+ uint32_t i_sizebackup = p_frame->i_buffer;
+ vlc_frame_t *p_newframe = vlc_frame_Realloc( p_frame, 0, i_dest );
+ if( unlikely(!p_newframe) )
goto error;
- p_block = p_newblock;
- p_sourceend = &p_block->p_buffer[i_sizebackup];
- p_source = p_dest = p_block->p_buffer;
+ p_frame = p_newframe;
+ p_sourceend = &p_frame->p_buffer[i_sizebackup];
+ p_source = p_dest = p_frame->p_buffer;
}
else
{
- block_t *p_newblock = block_Alloc( i_dest );
- if( unlikely(!p_newblock) )
+ vlc_frame_t *p_newframe = vlc_frame_Alloc( i_dest );
+ if( unlikely(!p_newframe) )
goto error;
- p_release = p_block; /* Will be released after use */
+ p_release = p_frame; /* Will be released after use */
p_source = p_release->p_buffer;
p_sourceend = &p_release->p_buffer[p_release->i_buffer];
- p_block = p_newblock;
- p_dest = p_newblock->p_buffer;
+ p_frame = p_newframe;
+ p_dest = p_newframe->p_buffer;
}
}
else
{
- p_source = p_dest = p_block->p_buffer;
- p_sourceend = &p_block->p_buffer[p_block->i_buffer];
+ p_source = p_dest = p_frame->p_buffer;
+ p_sourceend = &p_frame->p_buffer[p_frame->i_buffer];
}
if(!p_dest)
@@ -174,12 +174,12 @@ block_t *hxxx_AnnexB_to_xVC( block_t *p_block, uint8_t i_nal_length_size )
}
if( p_release )
- block_Release( p_release );
+ vlc_frame_Release( p_release );
free( p_list );
- return p_block;
+ return p_frame;
error:
free( p_list );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
diff --git a/modules/packetizer/hxxx_nal.h b/modules/packetizer/hxxx_nal.h
index 81ef497f49..3d0ea78aa8 100644
--- a/modules/packetizer/hxxx_nal.h
+++ b/modules/packetizer/hxxx_nal.h
@@ -120,6 +120,6 @@ static inline bool hxxx_annexb_iterate_next( hxxx_iterator_ctx_t *p_ctx, const u
}
/* Takes any AnnexB NAL buffer and converts it to prefixed size (AVC/HEVC) */
-block_t *hxxx_AnnexB_to_xVC( block_t *p_block, uint8_t i_nal_length_size );
+vlc_frame_t *hxxx_AnnexB_to_xVC( vlc_frame_t *p_frame, uint8_t i_nal_length_size );
#endif // HXXX_NAL_H
diff --git a/modules/packetizer/hxxx_sei.c b/modules/packetizer/hxxx_sei.c
index 79cfa91b3d..61d8917456 100644
--- a/modules/packetizer/hxxx_sei.c
+++ b/modules/packetizer/hxxx_sei.c
@@ -22,7 +22,7 @@
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
#include "hxxx_sei.h"
diff --git a/modules/packetizer/mjpeg.c b/modules/packetizer/mjpeg.c
index 5f4e6ff8f3..8ffb656e55 100644
--- a/modules/packetizer/mjpeg.c
+++ b/modules/packetizer/mjpeg.c
@@ -28,9 +28,9 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
/*****************************************************************************
@@ -39,7 +39,7 @@
typedef struct
{
packetizer_t packetizer;
- int i_next_block_flags;
+ int i_next_frame_flags;
date_t date;
} decoder_sys_t;
@@ -62,7 +62,7 @@ static inline const uint8_t * startcode_Find( const uint8_t *p, const uint8_t *e
/*****************************************************************************
* Packetize:
*****************************************************************************/
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
return packetizer_Packetize( &p_sys->packetizer, pp_block );
@@ -73,7 +73,7 @@ static void PacketizeFlush( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
date_Set( &p_sys->date, VLC_TICK_INVALID );
- p_sys->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags = FRAME_FLAG_DISCONTINUITY;
packetizer_Flush( &p_sys->packetizer );
}
@@ -87,10 +87,10 @@ static void PacketizeReset( void *p_private, bool b_broken )
decoder_sys_t *p_sys = p_dec->p_sys;
date_Set( &p_sys->date, VLC_TICK_INVALID );
- p_sys->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags = FRAME_FLAG_DISCONTINUITY;
}
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t *p_block )
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -144,13 +144,13 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_bl
*pb_ts_used = true;
- p_block->i_flags = p_sys->i_next_block_flags | BLOCK_FLAG_TYPE_I;
- p_sys->i_next_block_flags = 0;
+ p_block->i_flags = p_sys->i_next_frame_flags | FRAME_FLAG_TYPE_I;
+ p_sys->i_next_frame_flags = 0;
return p_block;
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
VLC_UNUSED(p_private);
VLC_UNUSED(p_au);
@@ -185,7 +185,7 @@ static int Open( vlc_object_t *p_this )
if( !p_dec->p_sys )
return VLC_ENOMEM;
- p_sys->i_next_block_flags = 0;
+ p_sys->i_next_frame_flags = 0;
if( p_dec->fmt_in.video.i_frame_rate &&
p_dec->fmt_in.video.i_frame_rate_base )
diff --git a/modules/packetizer/mlp.c b/modules/packetizer/mlp.c
index 308e7fca04..7b3a755eec 100644
--- a/modules/packetizer/mlp.c
+++ b/modules/packetizer/mlp.c
@@ -30,7 +30,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_bits.h>
#include <assert.h>
@@ -76,7 +76,7 @@ typedef struct
*/
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
/*
* Common properties
@@ -258,46 +258,46 @@ static void Flush( decoder_t *p_dec )
p_sys->b_mlp = false;
p_sys->i_state = STATE_NOSYNC;
p_sys->b_discontinuity = true;
- block_BytestreamEmpty( &p_sys->bytestream );
+ vlc_frame_BytestreamEmpty( &p_sys->bytestream );
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
}
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[MLP_HEADER_SIZE];
- block_t *p_out_buffer;
+ vlc_frame_t *p_out_buffer;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if ( p_block )
+ if ( p_frame )
{
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = Packetize( p_dec, NULL );
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = Packetize( p_dec, NULL );
if( p_drain )
return p_drain;
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- if( p_block->i_pts == VLC_TICK_INVALID &&
+ if( p_frame->i_pts == VLC_TICK_INVALID &&
date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
msg_Dbg( p_dec, "waiting for PTS" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- block_BytestreamPush( &p_sys->bytestream, p_block );
+ vlc_frame_BytestreamPush( &p_sys->bytestream, p_frame );
}
for( ;; )
@@ -305,7 +305,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
switch( p_sys->i_state )
{
case STATE_NOSYNC:
- while( !block_PeekBytes( &p_sys->bytestream, p_header, MLP_HEADER_SIZE ) )
+ while( !vlc_frame_PeekBytes( &p_sys->bytestream, p_header, MLP_HEADER_SIZE ) )
{
if( SyncInfo( p_header, &p_sys->b_mlp, &p_sys->mlp ) > 0 )
{
@@ -317,11 +317,11 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_SYNC;
break;
}
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
}
if( p_sys->i_state != STATE_SYNC )
{
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
/* Need more data */
return NULL;
@@ -330,7 +330,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
case STATE_SYNC:
/* New frame, set the Presentation Time Stamp */
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts;
if( p_sys->i_pts != VLC_TICK_INVALID &&
p_sys->i_pts != date_Get( &p_sys->end_date ) )
{
@@ -341,7 +341,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
case STATE_HEADER:
/* Get a MLP header */
- if( block_PeekBytes( &p_sys->bytestream, p_header, MLP_HEADER_SIZE ) )
+ if( vlc_frame_PeekBytes( &p_sys->bytestream, p_header, MLP_HEADER_SIZE ) )
{
/* Need more data */
return NULL;
@@ -354,7 +354,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if( p_sys->i_frame_size <= 0 )
{
msg_Dbg( p_dec, "emulated sync word" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->b_mlp = false;
p_sys->i_state = STATE_NOSYNC;
break;
@@ -364,10 +364,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
case STATE_NEXT_SYNC:
/* Check if next expected frame contains the sync word */
- if( block_PeekOffsetBytes( &p_sys->bytestream,
+ if( vlc_frame_PeekOffsetBytes( &p_sys->bytestream,
p_sys->i_frame_size, p_header, MLP_HEADER_SIZE ) )
{
- if( p_block == NULL ) /* drain */
+ if( p_frame == NULL ) /* drain */
{
p_sys->i_state = STATE_GET_DATA;
break;
@@ -384,7 +384,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
"(no sync on following frame)" );
p_sys->b_mlp = false;
p_sys->i_state = STATE_NOSYNC;
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
break;
}
p_sys->i_state = STATE_GET_DATA;
@@ -392,7 +392,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
case STATE_GET_DATA:
/* Make sure we have enough data. */
- if( block_WaitBytes( &p_sys->bytestream, p_sys->i_frame_size ) )
+ if( vlc_frame_WaitBytes( &p_sys->bytestream, p_sys->i_frame_size ) )
{
/* Need more data */
return NULL;
@@ -403,18 +403,18 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
case STATE_SEND_DATA:
/* When we reach this point we already know we have enough
* data available. */
- p_out_buffer = block_Alloc( p_sys->i_frame_size );
+ p_out_buffer = vlc_frame_Alloc( p_sys->i_frame_size );
if( !p_out_buffer )
return NULL;
/* Copy the whole frame into the buffer */
- block_GetBytes( &p_sys->bytestream,
+ vlc_frame_GetBytes( &p_sys->bytestream,
p_out_buffer->p_buffer, p_out_buffer->i_buffer );
/* Just ignore (E)AC3 frames */
if( SyncInfoDolby( p_out_buffer->p_buffer ) > 0 )
{
- block_Release( p_out_buffer );
+ vlc_frame_Release( p_out_buffer );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -442,18 +442,18 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
date_Increment( &p_sys->end_date, p_sys->mlp.i_samples ) - p_out_buffer->i_pts;
/* Make sure we don't reuse the same pts twice */
- if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ if( p_sys->i_pts == p_sys->bytestream.p_data->i_pts )
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
if( p_sys->b_discontinuity )
{
- p_out_buffer->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_out_buffer->i_flags |= FRAME_FLAG_DISCONTINUITY;
p_sys->b_discontinuity = false;
}
- /* So p_block doesn't get re-added several times */
- if( pp_block )
- *pp_block = block_BytestreamPop( &p_sys->bytestream );
+ /* So p_frame doesn't get re-added several times */
+ if( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
@@ -482,7 +482,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_state = STATE_NOSYNC;
date_Init( &p_sys->end_date, 1, 1 );
- block_BytestreamInit( &p_sys->bytestream );
+ vlc_frame_BytestreamInit( &p_sys->bytestream );
p_sys->b_mlp = false;
p_sys->b_discontinuity = false;
@@ -502,7 +502,7 @@ static void Close( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease( &p_sys->bytestream );
+ vlc_frame_BytestreamRelease( &p_sys->bytestream );
free( p_sys );
}
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index eaf9b545d5..ff26a02e0b 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -32,10 +32,10 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
#include "mpeg4audio.h"
@@ -122,7 +122,7 @@ typedef struct
int i_state;
int i_type;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
/*
* Common properties
@@ -215,7 +215,7 @@ static int AOTtoAACProfile(uint8_t i_object_type)
static int OpenPacketizer(vlc_object_t *);
static void ClosePacketizer(vlc_object_t *);
-static block_t *Packetize (decoder_t *, block_t **);
+static vlc_frame_t *Packetize (decoder_t *, vlc_frame_t **);
static void Flush( decoder_t * );
static int Mpeg4ReadAudioSpecificConfig(bs_t *s, mpeg4_asc_t *p_cfg, bool);
@@ -249,7 +249,7 @@ static int OpenPacketizer(vlc_object_t *p_this)
/* Misc init */
p_sys->i_state = STATE_NOSYNC;
p_sys->b_discontuinity = false;
- block_BytestreamInit(&p_sys->bytestream);
+ vlc_frame_BytestreamInit(&p_sys->bytestream);
p_sys->b_latm_cfg = false;
p_sys->i_warnings = 0;
@@ -347,49 +347,49 @@ static void ClosePacketizer(vlc_object_t *p_this)
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease(&p_sys->bytestream);
+ vlc_frame_BytestreamRelease(&p_sys->bytestream);
free(p_sys);
}
/****************************************************************************
- * ForwardRawBlock:
+ * ForwardRawFrame:
****************************************************************************
* This function must be fed with complete frames.
****************************************************************************/
-static block_t *ForwardRawBlock(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *ForwardRawFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
- if (!pp_block || !*pp_block)
+ if (!pp_frame || !*pp_frame)
return NULL;
- p_block = *pp_block;
- *pp_block = NULL; /* Don't reuse this block */
+ p_frame = *pp_frame;
+ *pp_frame = NULL; /* Don't reuse this frame */
vlc_tick_t i_diff = 0;
- if (p_block->i_pts != VLC_TICK_INVALID &&
- p_block->i_pts != date_Get(&p_sys->end_date))
+ if (p_frame->i_pts != VLC_TICK_INVALID &&
+ p_frame->i_pts != date_Get(&p_sys->end_date))
{
if(date_Get(&p_sys->end_date) != VLC_TICK_INVALID)
- i_diff = llabs( date_Get(&p_sys->end_date) - p_block->i_pts );
- date_Set(&p_sys->end_date, p_block->i_pts);
+ i_diff = llabs( date_Get(&p_sys->end_date) - p_frame->i_pts );
+ date_Set(&p_sys->end_date, p_frame->i_pts);
}
- p_block->i_pts = p_block->i_dts = date_Get(&p_sys->end_date);
+ p_frame->i_pts = p_frame->i_dts = date_Get(&p_sys->end_date);
/* Might not be known due to missing extradata,
- will be set to block pts above */
- if(p_dec->fmt_out.audio.i_frame_length && p_block->i_pts != VLC_TICK_INVALID)
+ will be set to frame pts above */
+ if(p_dec->fmt_out.audio.i_frame_length && p_frame->i_pts != VLC_TICK_INVALID)
{
- p_block->i_length = date_Increment(&p_sys->end_date,
- p_dec->fmt_out.audio.i_frame_length) - p_block->i_pts;
+ p_frame->i_length = date_Increment(&p_sys->end_date,
+ p_dec->fmt_out.audio.i_frame_length) - p_frame->i_pts;
- if( i_diff > p_block->i_length )
+ if( i_diff > p_frame->i_length )
p_sys->b_discontuinity = true;
}
- return p_block;
+ return p_frame;
}
/****************************************************************************
@@ -423,7 +423,7 @@ static int ADTSSyncInfo(decoder_t * p_dec, const uint8_t * p_buf,
i_frame_size = ((p_buf[3] & 0x03) << 11) | (p_buf[4] << 3) |
((p_buf[5] >> 5) /*& 0x7*/);
//uint16_t buffer_fullness = ((p_buf[5] & 0x1f) << 6) | (p_buf[6] >> 2);
- unsigned short i_raw_blocks_in_frame = p_buf[6] & 0x03;
+ unsigned short i_raw_frames_in_frame = p_buf[6] & 0x03;
if (!*pi_sample_rate || !i_frame_size) {
msg_Warn(p_dec, "Invalid ADTS header");
@@ -432,30 +432,30 @@ static int ADTSSyncInfo(decoder_t * p_dec, const uint8_t * p_buf,
*pi_frame_length = 1024;
- if (i_raw_blocks_in_frame == 0) {
+ if (i_raw_frames_in_frame == 0) {
if (b_crc) {
WARN_ONCE(WARN_CRC_UNSUPPORTED, "ADTS CRC not supported");
//uint16_t crc = (p_buf[7] << 8) | p_buf[8];
}
} else {
- msg_Err(p_dec, "Multiple blocks per frame in ADTS not supported");
+ msg_Err(p_dec, "Multiple frames per frame in ADTS not supported");
return 0;
#if 0
int i;
const uint8_t *p_pos = p_buf + 7;
- uint16_t crc_block;
- uint16_t i_block_pos[3];
+ uint16_t crc_frame;
+ uint16_t i_frame_pos[3];
if (b_crc) {
- for (i = 0 ; i < i_raw_blocks_in_frame ; i++) {
- /* the 1st block's position is known ... */
- i_block_pos[i] = (*p_pos << 8) | *(p_pos+1);
+ for (i = 0 ; i < i_raw_frames_in_frame ; i++) {
+ /* the 1st frame's position is known ... */
+ i_frame_pos[i] = (*p_pos << 8) | *(p_pos+1);
p_pos += 2;
}
- crc_block = (*p_pos << 8) | *(p_pos+1);
+ crc_frame = (*p_pos << 8) | *(p_pos+1);
p_pos += 2;
}
- for (i = 0 ; i <= i_raw_blocks_in_frame ; i++) {
- //read 1 block
+ for (i = 0 ; i <= i_raw_frames_in_frame ; i++) {
+ //read 1 frame
if (b_crc) {
WARN_ONCE(WARN_CRC_UNSUPPORTED, "ADTS CRC not supported");
//uint16_t crc = (*p_pos << 8) | *(p_pos+1);
@@ -1092,7 +1092,7 @@ static int LOASParse(decoder_t *p_dec, uint8_t *p_buffer, int i_buffer)
/*****************************************************************************
*
*****************************************************************************/
-static void SetupOutput(decoder_t *p_dec, block_t *p_block)
+static void SetupOutput(decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -1114,21 +1114,21 @@ static void SetupOutput(decoder_t *p_dec, block_t *p_block)
p_dec->fmt_out.audio.i_physical_channels = p_sys->i_channels_conf;
#endif
- p_block->i_pts = p_block->i_dts = date_Get(&p_sys->end_date);
+ p_frame->i_pts = p_frame->i_dts = date_Get(&p_sys->end_date);
- p_block->i_length =
- date_Increment(&p_sys->end_date, p_sys->i_frame_length) - p_block->i_pts;
+ p_frame->i_length =
+ date_Increment(&p_sys->end_date, p_sys->i_frame_length) - p_frame->i_pts;
}
/*****************************************************************************
- * FlushStreamBlock:
+ * FlushStreamFrame:
*****************************************************************************/
static void Flush(decoder_t *p_dec)
{
decoder_sys_t *p_sys = p_dec->p_sys;
p_sys->i_state = STATE_NOSYNC;
- block_BytestreamEmpty(&p_sys->bytestream);
+ vlc_frame_BytestreamEmpty(&p_sys->bytestream);
date_Set(&p_sys->end_date, VLC_TICK_INVALID);
p_sys->b_discontuinity = true;
}
@@ -1144,26 +1144,26 @@ static inline bool HasLoasHeader( const uint8_t *p_header )
}
/****************************************************************************
- * PacketizeStreamBlock: ADTS/LOAS packetizer
+ * PacketizeStreamFrame: ADTS/LOAS packetizer
****************************************************************************/
-static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *PacketizeStreamFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[ADTS_HEADER_SIZE + LOAS_HEADER_SIZE];
- block_t *p_out_buffer;
+ vlc_frame_t *p_out_buffer;
uint8_t *p_buf;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if(p_block)
+ if(p_frame)
{
- block_BytestreamPush(&p_sys->bytestream, p_block);
- *pp_block = NULL;
+ vlc_frame_BytestreamPush(&p_sys->bytestream, p_frame);
+ *pp_frame = NULL;
}
for (;;) switch(p_sys->i_state) {
case STATE_NOSYNC:
- while (block_PeekBytes(&p_sys->bytestream, p_header, 2) == VLC_SUCCESS) {
+ while (vlc_frame_PeekBytes(&p_sys->bytestream, p_header, 2) == VLC_SUCCESS) {
/* Look for sync word - should be 0xfff(adts) or 0x2b7(loas) */
if ((p_sys->i_type == TYPE_ADTS || p_sys->i_type == TYPE_UNKNOWN_NONRAW) &&
HasADTSHeader( p_header ) )
@@ -1185,10 +1185,10 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
p_sys->i_type = TYPE_LOAS;
break;
}
- block_SkipByte(&p_sys->bytestream);
+ vlc_frame_SkipByte(&p_sys->bytestream);
}
if (p_sys->i_state != STATE_SYNC) {
- block_BytestreamFlush(&p_sys->bytestream);
+ vlc_frame_BytestreamFlush(&p_sys->bytestream);
/* Need more data */
return NULL;
@@ -1197,7 +1197,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
case STATE_SYNC:
/* New frame, set the Presentation Time Stamp */
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts;
if (p_sys->i_pts != VLC_TICK_INVALID &&
p_sys->i_pts != date_Get(&p_sys->end_date))
date_Set(&p_sys->end_date, p_sys->i_pts);
@@ -1207,7 +1207,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
case STATE_HEADER:
if (p_sys->i_type == TYPE_ADTS) {
/* Get ADTS frame header (ADTS_HEADER_SIZE bytes) */
- if (block_PeekBytes(&p_sys->bytestream, p_header,
+ if (vlc_frame_PeekBytes(&p_sys->bytestream, p_header,
ADTS_HEADER_SIZE) != VLC_SUCCESS)
return NULL; /* Need more data */
@@ -1220,7 +1220,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
} else {
assert(p_sys->i_type == TYPE_LOAS);
/* Get LOAS frame header (LOAS_HEADER_SIZE bytes) */
- if (block_PeekBytes(&p_sys->bytestream, p_header,
+ if (vlc_frame_PeekBytes(&p_sys->bytestream, p_header,
LOAS_HEADER_SIZE) != VLC_SUCCESS)
return NULL; /* Need more data */
@@ -1230,7 +1230,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
if (p_sys->i_frame_size <= 0) {
msg_Dbg(p_dec, "emulated sync word");
- block_SkipByte(&p_sys->bytestream);
+ vlc_frame_SkipByte(&p_sys->bytestream);
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -1239,17 +1239,17 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
/* fallthrough */
case STATE_NEXT_SYNC:
- if (p_sys->bytestream.p_block == NULL) {
+ if (p_sys->bytestream.p_data == NULL) {
p_sys->i_state = STATE_NOSYNC;
- block_BytestreamFlush(&p_sys->bytestream);
+ vlc_frame_BytestreamFlush(&p_sys->bytestream);
return NULL;
}
/* Check if next expected frame contains the sync word */
- if (block_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_frame_size
+ if (vlc_frame_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_frame_size
+ p_sys->i_header_size, p_header, 2) != VLC_SUCCESS)
{
- if(p_block == NULL) /* drain */
+ if(p_frame == NULL) /* drain */
{
p_sys->i_state = STATE_SEND_DATA;
break;
@@ -1262,8 +1262,8 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
(p_sys->i_type == TYPE_LOAS && !HasLoasHeader( p_header )) )
{
/* Check spacial padding case. Failing if need more bytes is ok since
- that should have been sent as a whole block */
- if( block_PeekOffsetBytes(&p_sys->bytestream,
+ that should have been sent as a whole frame */
+ if( vlc_frame_PeekOffsetBytes(&p_sys->bytestream,
p_sys->i_frame_size + p_sys->i_header_size,
p_header, 3) == VLC_SUCCESS &&
p_header[0] == 0x00 &&
@@ -1277,7 +1277,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
msg_Dbg(p_dec, "emulated sync word (no sync on following frame)"
" 0x%"PRIx8" 0x%"PRIx8, p_header[0], p_header[1] );
p_sys->i_state = STATE_NOSYNC;
- block_SkipByte(&p_sys->bytestream);
+ vlc_frame_SkipByte(&p_sys->bytestream);
}
break;
}
@@ -1288,7 +1288,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
case STATE_GET_DATA:
/* Make sure we have enough data.
* (Not useful if we went through NEXT_SYNC) */
- if (block_WaitBytes(&p_sys->bytestream, p_sys->i_frame_size +
+ if (vlc_frame_WaitBytes(&p_sys->bytestream, p_sys->i_frame_size +
p_sys->i_header_size) != VLC_SUCCESS)
return NULL; /* Need more data */
p_sys->i_state = STATE_SEND_DATA;
@@ -1298,17 +1298,17 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
/* When we reach this point we already know we have enough
* data available. */
- p_out_buffer = block_Alloc(p_sys->i_frame_size);
+ p_out_buffer = vlc_frame_Alloc(p_sys->i_frame_size);
if (!p_out_buffer) {
return NULL;
}
p_buf = p_out_buffer->p_buffer;
/* Skip the ADTS/LOAS header */
- block_SkipBytes(&p_sys->bytestream, p_sys->i_header_size);
+ vlc_frame_SkipBytes(&p_sys->bytestream, p_sys->i_header_size);
/* Copy the whole frame into the buffer */
- block_GetBytes(&p_sys->bytestream, p_buf, p_sys->i_frame_size);
+ vlc_frame_GetBytes(&p_sys->bytestream, p_buf, p_sys->i_frame_size);
if (p_sys->i_type != TYPE_ADTS) { /* parse/extract the whole frame */
assert(p_sys->i_type == TYPE_LOAS);
p_out_buffer->i_buffer = LOASParse(p_dec, p_buf, p_sys->i_frame_size);
@@ -1317,7 +1317,7 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
if (!p_sys->b_latm_cfg)
msg_Warn(p_dec, "waiting for header");
- block_Release(p_out_buffer);
+ vlc_frame_Release(p_out_buffer);
p_out_buffer = NULL;
p_sys->i_state = STATE_NOSYNC;
break;
@@ -1325,12 +1325,12 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
}
SetupOutput(p_dec, p_out_buffer);
/* Make sure we don't reuse the same pts twice */
- if (p_sys->i_pts == p_sys->bytestream.p_block->i_pts)
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ if (p_sys->i_pts == p_sys->bytestream.p_data->i_pts)
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
- /* So p_block doesn't get re-added several times */
- if( pp_block )
- *pp_block = block_BytestreamPop(&p_sys->bytestream);
+ /* So p_frame doesn't get re-added several times */
+ if( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop(&p_sys->bytestream);
p_sys->i_state = STATE_NOSYNC;
@@ -1341,54 +1341,54 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
}
/****************************************************************************
- * Packetize: just forwards raw blocks, or packetizes LOAS/ADTS
+ * Packetize: just forwards raw frames, or packetizes LOAS/ADTS
* and strips headers
****************************************************************************/
-static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
+static vlc_frame_t *Packetize(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if(p_block)
+ if(p_frame)
{
- if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
+ if (p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED))
{
if(p_sys->i_type == TYPE_ADTS || p_sys->i_type == TYPE_LOAS)
{
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = PacketizeStreamBlock(p_dec, NULL);
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = PacketizeStreamFrame(p_dec, NULL);
if(p_drain)
return p_drain;
}
Flush(p_dec);
- if (p_block->i_flags & BLOCK_FLAG_CORRUPTED)
+ if (p_frame->i_flags & FRAME_FLAG_CORRUPTED)
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
- if ( p_block->i_pts == VLC_TICK_INVALID &&
+ if ( p_frame->i_pts == VLC_TICK_INVALID &&
date_Get(&p_sys->end_date) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
- if(p_block && p_sys->i_type == TYPE_UNKNOWN)
+ if(p_frame && p_sys->i_type == TYPE_UNKNOWN)
{
p_sys->i_type = TYPE_RAW;
- if(p_block->i_buffer > 1)
+ if(p_frame->i_buffer > 1)
{
- if(p_block->p_buffer[0] == 0xff && (p_block->p_buffer[1] & 0xf6) == 0xf0)
+ if(p_frame->p_buffer[0] == 0xff && (p_frame->p_buffer[1] & 0xf6) == 0xf0)
{
p_sys->i_type = TYPE_ADTS;
}
- else if(p_block->p_buffer[0] == 0x56 && (p_block->p_buffer[1] & 0xe0) == 0xe0)
+ else if(p_frame->p_buffer[0] == 0x56 && (p_frame->p_buffer[1] & 0xe0) == 0xe0)
{
p_sys->i_type = TYPE_LOAS;
}
@@ -1396,15 +1396,15 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
}
if(p_sys->i_type == TYPE_RAW)
- p_block = ForwardRawBlock(p_dec, pp_block);
+ p_frame = ForwardRawFrame(p_dec, pp_frame);
else
- p_block = PacketizeStreamBlock(p_dec, pp_block);
+ p_frame = PacketizeStreamFrame(p_dec, pp_frame);
- if(p_block && p_sys->b_discontuinity)
+ if(p_frame && p_sys->b_discontuinity)
{
- p_block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_frame->i_flags |= FRAME_FLAG_DISCONTINUITY;
p_sys->b_discontuinity = false;
}
- return p_block;
+ return p_frame;
}
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index 4b67a8829c..dfbb135d1f 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -34,10 +34,10 @@
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
#include "startcode_helper.h"
#include "iso_color_tables.h"
@@ -85,21 +85,21 @@ typedef struct
bool b_frame;
/* Current frame being built */
- block_t *p_frame;
- block_t **pp_last;
+ vlc_frame_t *p_frame;
+ vlc_frame_t **pp_last;
} decoder_sys_t;
-static block_t *Packetize( decoder_t *, block_t ** );
+static vlc_frame_t *Packetize( decoder_t *, vlc_frame_t ** );
static void PacketizeFlush( decoder_t * );
static void PacketizeReset( void *p_private, bool b_broken );
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
-static int PacketizeValidate( void *p_private, block_t * );
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t * );
+static int PacketizeValidate( void *p_private, vlc_frame_t * );
-static block_t *ParseMPEGBlock( decoder_t *, block_t * );
+static vlc_frame_t *ParseMPEGFrame( decoder_t *, vlc_frame_t * );
static int ParseVOL( decoder_t *, es_format_t *, uint8_t *, int );
-static int ParseVO( decoder_t *, block_t * );
-static int ParseVOP( decoder_t *, block_t * );
+static int ParseVO( decoder_t *, vlc_frame_t * );
+static int ParseVOP( decoder_t *, vlc_frame_t * );
static int vlc_log2( unsigned int );
#define VIDEO_OBJECT_MASK 0x01f
@@ -180,18 +180,18 @@ static void Close( vlc_object_t *p_this )
packetizer_Clean( &p_sys->packetizer );
if( p_sys->p_frame )
- block_ChainRelease( p_sys->p_frame );
+ vlc_frame_ChainRelease( p_sys->p_frame );
free( p_sys );
}
/****************************************************************************
* Packetize: the whole thing
****************************************************************************/
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return packetizer_Packetize( &p_sys->packetizer, pp_block );
+ return packetizer_Packetize( &p_sys->packetizer, pp_frame );
}
static void PacketizeFlush( decoder_t *p_dec )
@@ -212,7 +212,7 @@ static void PacketizeReset( void *p_private, bool b_broken )
if( b_broken )
{
if( p_sys->p_frame )
- block_ChainRelease( p_sys->p_frame );
+ vlc_frame_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
}
@@ -227,13 +227,13 @@ static void PacketizeReset( void *p_private, bool b_broken )
p_sys->i_last_timeincr = 0;
}
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t *p_frame )
{
decoder_t *p_dec = p_private;
- const vlc_tick_t i_dts = p_block->i_dts;
- const vlc_tick_t i_pts = p_block->i_pts;
+ const vlc_tick_t i_dts = p_frame->i_dts;
+ const vlc_tick_t i_pts = p_frame->i_pts;
- block_t *p_au = ParseMPEGBlock( p_dec, p_block );
+ vlc_frame_t *p_au = ParseMPEGFrame( p_dec, p_frame );
*pb_ts_used = p_au && p_au->i_dts == i_dts && p_au->i_pts == i_pts;
@@ -241,7 +241,7 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_bl
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -263,12 +263,12 @@ static int PacketizeValidate( void *p_private, block_t *p_au )
}
/*****************************************************************************
- * ParseMPEGBlock: Re-assemble fragments into a block containing a picture
+ * ParseMPEGFrame: Re-assemble fragments into a frame containing a picture
*****************************************************************************/
-static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
+static vlc_frame_t *ParseMPEGFrame( decoder_t *p_dec, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_pic = NULL;
+ vlc_frame_t *p_pic = NULL;
if( p_frag->i_buffer < 4 )
return p_frag;
@@ -280,11 +280,11 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
{ /* VOS and USERDATA */
#if 0
/* Remove VOS start/end code from the original stream */
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
#else
- /* Append the block for now since ts/ps muxers rely on VOL
+ /* Append the frame for now since ts/ps muxers rely on VOL
* being present in the stream */
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
#endif
return NULL;
}
@@ -304,11 +304,11 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
#if 0
/* Remove from the original stream */
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
#else
- /* Append the block for now since ts/ps muxers rely on VOL
+ /* Append the frame for now since ts/ps muxers rely on VOL
* being present in the stream */
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
#endif
return NULL;
}
@@ -317,12 +317,12 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
if( !p_dec->fmt_out.i_extra )
{
msg_Warn( p_dec, "waiting for VOL" );
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return NULL;
}
- /* Append the block */
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ /* Append the frame */
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
}
if( i_startcode == VISUAL_OBJECT_START_CODE )
@@ -334,7 +334,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
ParseVOP( p_dec, p_frag ) == VLC_SUCCESS )
{
/* We are dealing with a VOP */
- p_pic = block_ChainGather( p_sys->p_frame );
+ p_pic = vlc_frame_ChainGather( p_sys->p_frame );
p_pic->i_flags = p_sys->i_flags;
p_pic->i_pts = p_sys->i_interpolated_pts;
p_pic->i_dts = p_sys->i_interpolated_dts;
@@ -442,7 +442,7 @@ static int ParseVOL( decoder_t *p_dec, es_format_t *fmt,
return VLC_SUCCESS;
}
-static int ParseVO( decoder_t *p_dec, block_t *p_vo )
+static int ParseVO( decoder_t *p_dec, vlc_frame_t *p_vo )
{
bs_t s;
bs_init( &s, &p_vo->p_buffer[4], p_vo->i_buffer - 4 );
@@ -481,7 +481,7 @@ static int ParseVO( decoder_t *p_dec, block_t *p_vo )
return VLC_SUCCESS;
}
-static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
+static int ParseVOP( decoder_t *p_dec, vlc_frame_t *p_vop )
{
decoder_sys_t *p_sys = p_dec->p_sys;
int64_t i_time_increment, i_time_ref;
@@ -493,17 +493,17 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
switch( bs_read( &s, 2 ) )
{
case 0:
- p_sys->i_flags = BLOCK_FLAG_TYPE_I;
+ p_sys->i_flags = FRAME_FLAG_TYPE_I;
break;
case 1:
- p_sys->i_flags = BLOCK_FLAG_TYPE_P;
+ p_sys->i_flags = FRAME_FLAG_TYPE_P;
break;
case 2:
- p_sys->i_flags = BLOCK_FLAG_TYPE_B;
+ p_sys->i_flags = FRAME_FLAG_TYPE_B;
p_sys->b_frame = true;
break;
case 3: /* gni ? */
- p_sys->i_flags = BLOCK_FLAG_TYPE_PB;
+ p_sys->i_flags = FRAME_FLAG_TYPE_PB;
break;
}
@@ -516,7 +516,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
i_time_increment = bs_read( &s, i_time_increment_bits );
/* Interpolate PTS/DTS */
- if( !(p_sys->i_flags & BLOCK_FLAG_TYPE_B) )
+ if( !(p_sys->i_flags & FRAME_FLAG_TYPE_B) )
{
p_sys->i_last_time_ref = p_sys->i_time_ref;
p_sys->i_time_ref +=
@@ -568,7 +568,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
if( p_vop->i_dts != VLC_TICK_INVALID )
p_sys->i_interpolated_dts = p_vop->i_dts;
- if( (p_sys->i_flags & BLOCK_FLAG_TYPE_B) || !p_sys->b_frame )
+ if( (p_sys->i_flags & FRAME_FLAG_TYPE_B) || !p_sys->b_frame )
{
/* Trivial case (DTS == PTS) */
diff --git a/modules/packetizer/mpegaudio.c b/modules/packetizer/mpegaudio.c
index 1398da0813..8a867daf25 100644
--- a/modules/packetizer/mpegaudio.c
+++ b/modules/packetizer/mpegaudio.c
@@ -37,7 +37,7 @@
#include <vlc_modules.h>
#include <assert.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "packetizer_helper.h"
@@ -51,7 +51,7 @@ typedef struct
*/
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
/*
* Common properties
@@ -98,14 +98,14 @@ static void Flush( decoder_t *p_dec )
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
p_sys->i_state = STATE_NOSYNC;
- block_BytestreamEmpty( &p_sys->bytestream );
+ vlc_frame_BytestreamEmpty( &p_sys->bytestream );
p_sys->b_discontinuity = true;
}
/*****************************************************************************
* GetOutBuffer:
*****************************************************************************/
-static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
+static uint8_t *GetOutBuffer( decoder_t *p_dec, vlc_frame_t **pp_out_buffer )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -133,16 +133,16 @@ static uint8_t *GetOutBuffer( decoder_t *p_dec, block_t **pp_out_buffer )
p_dec->fmt_out.i_bitrate = p_sys->i_bit_rate * 1000;
- block_t *p_block = block_Alloc( p_sys->i_frame_size );
- if( p_block == NULL )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( p_sys->i_frame_size );
+ if( p_frame == NULL )
return NULL;
- p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
- p_block->i_length =
- date_Increment( &p_sys->end_date, p_sys->i_frame_length ) - p_block->i_pts;
+ p_frame->i_pts = p_frame->i_dts = date_Get( &p_sys->end_date );
+ p_frame->i_length =
+ date_Increment( &p_sys->end_date, p_sys->i_frame_length ) - p_frame->i_pts;
- *pp_out_buffer = p_block;
- return p_block->p_buffer;
+ *pp_out_buffer = p_frame;
+ return p_frame->p_buffer;
}
/*****************************************************************************
@@ -276,48 +276,48 @@ static int SyncInfo( uint32_t i_header, unsigned int * pi_channels,
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
-static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *DecodeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[MAD_BUFFER_GUARD];
uint32_t i_header;
uint8_t *p_buf;
- block_t *p_out_buffer;
+ vlc_frame_t *p_out_buffer;
- block_t *p_block = pp_block ? *pp_block : NULL;
+ vlc_frame_t *p_frame = pp_frame ? *pp_frame : NULL;
- if (p_block)
+ if (p_frame)
{
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
- /* First always drain complete blocks before discontinuity */
- block_t *p_drain = DecodeBlock( p_dec, NULL );
+ /* First always drain complete frames before discontinuity */
+ vlc_frame_t *p_drain = DecodeFrame( p_dec, NULL );
if( p_drain )
return p_drain;
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- if( p_block->i_pts == VLC_TICK_INVALID &&
+ if( p_frame->i_pts == VLC_TICK_INVALID &&
date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
msg_Dbg( p_dec, "waiting for PTS" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- block_BytestreamPush( &p_sys->bytestream, p_block );
+ vlc_frame_BytestreamPush( &p_sys->bytestream, p_frame );
}
while( 1 )
@@ -326,7 +326,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
case STATE_NOSYNC:
- while( block_PeekBytes( &p_sys->bytestream, p_header, 2 )
+ while( vlc_frame_PeekBytes( &p_sys->bytestream, p_header, 2 )
== VLC_SUCCESS )
{
/* Look for sync word - should be 0xffe */
@@ -335,11 +335,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_state = STATE_SYNC;
break;
}
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
}
if( p_sys->i_state != STATE_SYNC )
{
- block_BytestreamFlush( &p_sys->bytestream );
+ vlc_frame_BytestreamFlush( &p_sys->bytestream );
/* Need more data */
return NULL;
@@ -348,7 +348,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_SYNC:
/* New frame, set the Presentation Time Stamp */
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts;
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts;
if( p_sys->i_pts != VLC_TICK_INVALID &&
p_sys->i_pts != date_Get( &p_sys->end_date ) )
{
@@ -367,7 +367,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_HEADER:
/* Get MPGA frame header (MPGA_HEADER_SIZE bytes) */
- if( block_PeekBytes( &p_sys->bytestream, p_header,
+ if( vlc_frame_PeekBytes( &p_sys->bytestream, p_header,
MPGA_HEADER_SIZE ) != VLC_SUCCESS )
{
/* Need more data */
@@ -391,7 +391,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->i_frame_size == -1 )
{
msg_Dbg( p_dec, "emulated startcode" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -412,11 +412,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_NEXT_SYNC:
/* Check if next expected frame contains the sync word */
- if( block_PeekOffsetBytes( &p_sys->bytestream,
+ if( vlc_frame_PeekOffsetBytes( &p_sys->bytestream,
p_sys->i_frame_size, p_header,
MAD_BUFFER_GUARD ) != VLC_SUCCESS )
{
- if( p_block == NULL ) /* drain */
+ if( p_frame == NULL ) /* drain */
{
p_sys->i_state = STATE_SEND_DATA;
break;
@@ -456,7 +456,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "frame too big %d > %d "
"(emulated startcode ?)", p_sys->i_frame_size,
p_sys->i_max_frame_size );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
p_sys->i_free_frame_size = MPGA_HEADER_SIZE;
break;
@@ -469,7 +469,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( i_next_frame_size == -1 )
{
msg_Dbg( p_dec, "emulated startcode on next frame" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -490,7 +490,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "parameters changed unexpectedly "
"(emulated startcode ?)" );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
break;
}
@@ -517,7 +517,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "frame too big %d > %d "
"(emulated startcode ?)", p_sys->i_frame_size,
p_sys->i_max_frame_size );
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
p_sys->i_free_frame_size = MPGA_HEADER_SIZE;
break;
@@ -530,7 +530,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "emulated startcode "
"(no startcode on following frame)" );
p_sys->i_state = STATE_NOSYNC;
- block_SkipByte( &p_sys->bytestream );
+ vlc_frame_SkipByte( &p_sys->bytestream );
break;
}
@@ -540,7 +540,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_GET_DATA:
/* Make sure we have enough data.
* (Not useful if we went through NEXT_SYNC) */
- if( block_WaitBytes( &p_sys->bytestream,
+ if( vlc_frame_WaitBytes( &p_sys->bytestream,
p_sys->i_frame_size ) != VLC_SUCCESS )
{
/* Need more data */
@@ -562,30 +562,30 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
/* Copy the whole frame into the buffer. */
- if (block_GetBytes( &p_sys->bytestream,
+ if (vlc_frame_GetBytes( &p_sys->bytestream,
p_buf, __MIN( (unsigned)p_sys->i_frame_size, p_out_buffer->i_buffer ) )) {
- block_Release(p_out_buffer);
+ vlc_frame_Release(p_out_buffer);
return NULL;
}
p_sys->i_state = STATE_NOSYNC;
/* Make sure we don't reuse the same pts twice */
- if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
- p_sys->i_pts = p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ if( p_sys->i_pts == p_sys->bytestream.p_data->i_pts )
+ p_sys->i_pts = p_sys->bytestream.p_data->i_pts = VLC_TICK_INVALID;
if( p_sys->b_discontinuity )
{
- p_out_buffer->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_out_buffer->i_flags |= FRAME_FLAG_DISCONTINUITY;
p_sys->b_discontinuity = false;
}
- /* So p_block doesn't get re-added several times */
- p_block = block_BytestreamPop( &p_sys->bytestream );
- if (pp_block)
- *pp_block = p_block;
- else if (p_block)
- block_Release(p_block);
+ /* So p_frame doesn't get re-added several times */
+ p_frame = vlc_frame_BytestreamPop( &p_sys->bytestream );
+ if (pp_frame)
+ *pp_frame = p_frame;
+ else if (p_frame)
+ vlc_frame_Release(p_frame);
return p_out_buffer;
}
@@ -602,7 +602,7 @@ static void Close( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- block_BytestreamRelease( &p_sys->bytestream );
+ vlc_frame_BytestreamRelease( &p_sys->bytestream );
free( p_sys );
}
@@ -629,7 +629,7 @@ static int Open( vlc_object_t *p_this )
/* Misc init */
p_sys->i_state = STATE_NOSYNC;
date_Init( &p_sys->end_date, 1, 1 );
- block_BytestreamInit( &p_sys->bytestream );
+ vlc_frame_BytestreamInit( &p_sys->bytestream );
p_sys->i_pts = VLC_TICK_INVALID;
p_sys->b_discontinuity = false;
p_sys->i_frame_size = 0;
@@ -643,7 +643,7 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
/* Set callback */
- p_dec->pf_packetize = DecodeBlock;
+ p_dec->pf_packetize = DecodeFrame;
p_dec->pf_flush = Flush;
p_dec->pf_get_cc = NULL;
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 158f5cfd06..2bb48bf1e4 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -47,9 +47,9 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "../codec/cc.h"
#include "packetizer_helper.h"
#include "startcode_helper.h"
@@ -121,12 +121,12 @@ typedef struct
packetizer_t packetizer;
/* Sequence header and extension */
- block_t *p_seq;
- block_t *p_ext;
+ vlc_frame_t *p_seq;
+ vlc_frame_t *p_ext;
/* Current frame being built */
- block_t *p_frame;
- block_t **pp_last;
+ vlc_frame_t *p_frame;
+ vlc_frame_t **pp_last;
bool b_frame_slice;
vlc_tick_t i_pts;
@@ -165,7 +165,7 @@ typedef struct
/* Sync behaviour */
bool b_sync_on_intra_frame;
bool b_waiting_iframe;
- int i_next_block_flags;
+ int i_next_frame_flags;
/* */
bool b_cc_reset;
@@ -175,15 +175,15 @@ typedef struct
cc_data_t cc;
} decoder_sys_t;
-static block_t *Packetize( decoder_t *, block_t ** );
+static vlc_frame_t *Packetize( decoder_t *, vlc_frame_t ** );
static void PacketizeFlush( decoder_t * );
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
static void PacketizeReset( void *p_private, bool b_broken );
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
-static int PacketizeValidate( void *p_private, block_t * );
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t * );
+static int PacketizeValidate( void *p_private, vlc_frame_t * );
-static block_t *ParseMPEGBlock( decoder_t *, block_t * );
+static vlc_frame_t *ParseMPEGFrame( decoder_t *, vlc_frame_t * );
static const uint8_t p_mp2v_startcode[3] = { 0x00, 0x00, 0x01 };
@@ -255,7 +255,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_last_ref_pts = VLC_TICK_INVALID;
p_sys->b_second_field = 0;
- p_sys->i_next_block_flags = 0;
+ p_sys->i_next_frame_flags = 0;
p_sys->i_last_frame_refid = 0;
@@ -287,15 +287,15 @@ static void Close( vlc_object_t *p_this )
if( p_sys->p_seq )
{
- block_Release( p_sys->p_seq );
+ vlc_frame_Release( p_sys->p_seq );
}
if( p_sys->p_ext )
{
- block_Release( p_sys->p_ext );
+ vlc_frame_Release( p_sys->p_ext );
}
if( p_sys->p_frame )
{
- block_ChainRelease( p_sys->p_frame );
+ vlc_frame_ChainRelease( p_sys->p_frame );
}
packetizer_Clean( &p_sys->packetizer );
@@ -307,11 +307,11 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Packetize:
*****************************************************************************/
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return packetizer_Packetize( &p_sys->packetizer, pp_block );
+ return packetizer_Packetize( &p_sys->packetizer, pp_frame );
}
static void PacketizeFlush( decoder_t *p_dec )
@@ -324,21 +324,21 @@ static void PacketizeFlush( decoder_t *p_dec )
/*****************************************************************************
* GetCc:
*****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_cc;
+ vlc_frame_t *p_cc;
if( !p_sys->cc.b_reorder && p_sys->cc.i_data <= 0 )
return NULL;
- p_cc = block_Alloc( p_sys->cc.i_data );
+ p_cc = vlc_frame_Alloc( p_sys->cc.i_data );
if( p_cc )
{
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
p_cc->i_dts =
p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
- p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
+ p_cc->i_flags = p_sys->i_cc_flags & FRAME_FLAG_TYPE_MASK;
p_desc->i_608_channels = p_sys->cc.i_608channels;
p_desc->i_708_channels = p_sys->cc.i_708channels;
@@ -357,10 +357,10 @@ static void PacketizeReset( void *p_private, bool b_broken )
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
- p_sys->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ p_sys->i_next_frame_flags = FRAME_FLAG_DISCONTINUITY;
if( p_sys->p_frame )
{
- block_ChainRelease( p_sys->p_frame );
+ vlc_frame_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame_slice = false;
@@ -374,32 +374,32 @@ static void PacketizeReset( void *p_private, bool b_broken )
p_sys->i_prev_temporal_ref = 2048;
}
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t *p_frame )
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
/* Check if we have a picture start code */
- *pb_ts_used = p_block->p_buffer[3] == PICTURE_STARTCODE;
+ *pb_ts_used = p_frame->p_buffer[3] == PICTURE_STARTCODE;
- p_block = ParseMPEGBlock( p_dec, p_block );
- if( p_block )
+ p_frame = ParseMPEGFrame( p_dec, p_frame );
+ if( p_frame )
{
- p_block->i_flags |= p_sys->i_next_block_flags;
- p_sys->i_next_block_flags = 0;
+ p_frame->i_flags |= p_sys->i_next_frame_flags;
+ p_sys->i_next_frame_flags = 0;
}
- return p_block;
+ return p_frame;
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
if( unlikely( p_sys->b_waiting_iframe ) )
{
- if( (p_au->i_flags & BLOCK_FLAG_TYPE_I) == 0 )
+ if( (p_au->i_flags & FRAME_FLAG_TYPE_I) == 0 )
{
msg_Dbg( p_dec, "waiting on intra frame" );
return VLC_EGENERIC;
@@ -425,12 +425,12 @@ static int PacketizeValidate( void *p_private, block_t *p_au )
return VLC_SUCCESS;
}
/*****************************************************************************
- * ParseMPEGBlock: Re-assemble fragments into a block containing a picture
+ * ParseMPEGFrame: Re-assemble fragments into a frame containing a picture
*****************************************************************************/
-static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
+static vlc_frame_t *ParseMPEGFrame( decoder_t *p_dec, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_pic = NULL;
+ vlc_frame_t *p_pic = NULL;
const enum mpeg_startcode_e startcode = p_frag->p_buffer[3];
/*
@@ -443,7 +443,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
/* We have a picture but without a sequence header we can't
* do anything */
msg_Dbg( p_dec, "waiting for sequence start" );
- if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame );
+ if( p_sys->p_frame ) vlc_frame_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame_slice = false;
@@ -456,16 +456,16 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
if( b_eos )
{
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
p_frag = NULL;
}
- p_pic = block_ChainGather( p_sys->p_frame );
+ p_pic = vlc_frame_ChainGather( p_sys->p_frame );
if( p_pic == NULL )
return p_pic;
if( b_eos )
- p_pic->i_flags |= BLOCK_FLAG_END_OF_SEQUENCE;
+ p_pic->i_flags |= FRAME_FLAG_END_OF_SEQUENCE;
unsigned i_num_fields;
@@ -501,13 +501,13 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
switch ( p_sys->i_picture_type )
{
case 0x01:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_I;
break;
case 0x02:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_P;
break;
case 0x03:
- p_pic->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_pic->i_flags |= FRAME_FLAG_TYPE_B;
break;
}
@@ -515,14 +515,14 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
{
if( p_sys->i_picture_structure < 0x03 )
{
- p_pic->i_flags |= BLOCK_FLAG_SINGLE_FIELD;
- p_pic->i_flags |= (p_sys->i_picture_structure == 0x01) ? BLOCK_FLAG_TOP_FIELD_FIRST
- : BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ p_pic->i_flags |= FRAME_FLAG_SINGLE_FIELD;
+ p_pic->i_flags |= (p_sys->i_picture_structure == 0x01) ? FRAME_FLAG_TOP_FIELD_FIRST
+ : FRAME_FLAG_BOTTOM_FIELD_FIRST;
}
else /* if( p_sys->i_picture_structure == 0x03 ) */
{
- p_pic->i_flags |= (p_sys->i_top_field_first) ? BLOCK_FLAG_TOP_FIELD_FIRST
- : BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ p_pic->i_flags |= (p_sys->i_top_field_first) ? FRAME_FLAG_TOP_FIELD_FIRST
+ : FRAME_FLAG_BOTTOM_FIELD_FIRST;
}
}
@@ -534,7 +534,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
{
const bool b_first_xmited = (p_sys->i_prev_temporal_ref != p_sys->i_temporal_ref );
- if( ( p_pic->i_flags & BLOCK_FLAG_TYPE_I ) && b_first_xmited )
+ if( ( p_pic->i_flags & FRAME_FLAG_TYPE_I ) && b_first_xmited )
{
if( date_Get( &p_sys->prev_iframe_dts ) == VLC_TICK_INVALID )
{
@@ -653,7 +653,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
p_sys->b_cc_reset = true;
p_sys->i_cc_pts = p_pic->i_pts;
p_sys->i_cc_dts = p_pic->i_dts;
- p_sys->i_cc_flags = p_pic->i_flags & BLOCK_FLAG_TYPE_MASK;
+ p_sys->i_cc_flags = p_pic->i_flags & FRAME_FLAG_TYPE_MASK;
}
if( !p_pic && p_sys->b_cc_reset )
@@ -674,10 +674,10 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
p_sys->i_seq_old > p_sys->i_frame_rate/p_sys->i_frame_rate_base )
{
/* Useful for mpeg1: repeat sequence header every second */
- block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_seq ) );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, vlc_frame_Duplicate( p_sys->p_seq ) );
if( p_sys->p_ext )
{
- block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_ext ) );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, vlc_frame_Duplicate( p_sys->p_ext ) );
}
p_sys->i_seq_old = 0;
@@ -698,10 +698,10 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
{ 1, 1 }, { 1, 1 } /* invalid */
};
- if( p_sys->p_seq ) block_Release( p_sys->p_seq );
- if( p_sys->p_ext ) block_Release( p_sys->p_ext );
+ if( p_sys->p_seq ) vlc_frame_Release( p_sys->p_seq );
+ if( p_sys->p_ext ) vlc_frame_Release( p_sys->p_ext );
- p_sys->p_seq = block_Duplicate( p_frag );
+ p_sys->p_seq = vlc_frame_Duplicate( p_frag );
p_sys->i_seq_old = 0;
p_sys->p_ext = NULL;
@@ -770,8 +770,8 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
#endif
/* sequence extension */
- if( p_sys->p_ext) block_Release( p_sys->p_ext );
- p_sys->p_ext = block_Duplicate( p_frag );
+ if( p_sys->p_ext) vlc_frame_Release( p_sys->p_ext );
+ p_sys->p_ext = vlc_frame_Duplicate( p_frag );
if( p_frag->i_buffer >= 10 )
{
@@ -869,8 +869,8 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
p_sys->b_frame_slice = true;
}
- /* Append the block */
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ /* Append the frame */
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
return p_pic;
}
diff --git a/modules/packetizer/packetizer_helper.h b/modules/packetizer/packetizer_helper.h
index dece985b24..c5392f72b7 100644
--- a/modules/packetizer/packetizer_helper.h
+++ b/modules/packetizer/packetizer_helper.h
@@ -23,7 +23,7 @@
#ifndef VLC_PACKETIZER_HELPER_H_
#define VLC_PACKETIZER_HELPER_H_
-#include <vlc_block.h>
+#include <vlc_frame.h>
enum
{
@@ -37,18 +37,18 @@ enum
};
typedef void (*packetizer_reset_t)( void *p_private, bool b_broken );
-typedef block_t *(*packetizer_parse_t)( void *p_private, bool *pb_ts_used, block_t * );
-typedef int (*packetizer_validate_t)( void *p_private, block_t * );
+typedef vlc_frame_t *(*packetizer_parse_t)( void *p_private, bool *pb_ts_used, vlc_frame_t * );
+typedef int (*packetizer_validate_t)( void *p_private, vlc_frame_t * );
typedef struct
{
int i_state;
- block_bytestream_t bytestream;
+ vlc_frame_bytestream_t bytestream;
size_t i_offset;
int i_startcode;
const uint8_t *p_startcode;
- block_startcode_helper_t pf_startcode_helper;
+ vlc_frame_startcode_helper_t pf_startcode_helper;
int i_au_prepend;
const uint8_t *p_au_prepend;
@@ -64,7 +64,7 @@ typedef struct
static inline void packetizer_Init( packetizer_t *p_pack,
const uint8_t *p_startcode, int i_startcode,
- block_startcode_helper_t pf_start_helper,
+ vlc_frame_startcode_helper_t pf_start_helper,
const uint8_t *p_au_prepend, int i_au_prepend,
unsigned i_au_min_size,
packetizer_reset_t pf_reset,
@@ -73,7 +73,7 @@ static inline void packetizer_Init( packetizer_t *p_pack,
void *p_private )
{
p_pack->i_state = STATE_NOSYNC;
- block_BytestreamInit( &p_pack->bytestream );
+ vlc_frame_BytestreamInit( &p_pack->bytestream );
p_pack->i_offset = 0;
p_pack->i_au_prepend = i_au_prepend;
@@ -91,64 +91,64 @@ static inline void packetizer_Init( packetizer_t *p_pack,
static inline void packetizer_Clean( packetizer_t *p_pack )
{
- block_BytestreamRelease( &p_pack->bytestream );
+ vlc_frame_BytestreamRelease( &p_pack->bytestream );
}
static inline void packetizer_Flush( packetizer_t *p_pack )
{
p_pack->i_state = STATE_NOSYNC;
- block_BytestreamEmpty( &p_pack->bytestream );
+ vlc_frame_BytestreamEmpty( &p_pack->bytestream );
p_pack->i_offset = 0;
p_pack->pf_reset( p_pack->p_private, true );
}
-static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_block )
+static inline vlc_frame_t *packetizer_Packetize( packetizer_t *p_pack, vlc_frame_t **pp_frame )
{
- block_t *p_block = ( pp_block ) ? *pp_block : NULL;
+ vlc_frame_t *p_frame = ( pp_frame ) ? *pp_frame : NULL;
- if( p_block == NULL && p_pack->bytestream.p_block == NULL )
+ if( p_frame == NULL && p_pack->bytestream.p_data == NULL )
return NULL; /* nothing to do */
- if( p_block && unlikely( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) )
+ if( p_frame && unlikely( p_frame->i_flags&(FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) ) )
{
- block_t *p_drained = packetizer_Packetize( p_pack, NULL );
+ vlc_frame_t *p_drained = packetizer_Packetize( p_pack, NULL );
if( p_drained )
return p_drained;
- const bool b_broken = !!( p_block->i_flags&BLOCK_FLAG_CORRUPTED );
+ const bool b_broken = !!( p_frame->i_flags&FRAME_FLAG_CORRUPTED );
p_pack->i_state = STATE_NOSYNC;
- block_BytestreamEmpty( &p_pack->bytestream );
+ vlc_frame_BytestreamEmpty( &p_pack->bytestream );
p_pack->i_offset = 0;
p_pack->pf_reset( p_pack->p_private, b_broken );
if( b_broken )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- if( p_block )
- block_BytestreamPush( &p_pack->bytestream, p_block );
+ if( p_frame )
+ vlc_frame_BytestreamPush( &p_pack->bytestream, p_frame );
for( ;; )
{
bool b_used_ts;
- block_t *p_pic;
+ vlc_frame_t *p_pic;
switch( p_pack->i_state )
{
case STATE_NOSYNC:
/* Find a startcode */
- if( !block_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
+ if( !vlc_frame_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
p_pack->p_startcode, p_pack->i_startcode,
p_pack->pf_startcode_helper, NULL ) )
p_pack->i_state = STATE_NEXT_SYNC;
if( p_pack->i_offset )
{
- block_SkipBytes( &p_pack->bytestream, p_pack->i_offset );
+ vlc_frame_SkipBytes( &p_pack->bytestream, p_pack->i_offset );
p_pack->i_offset = 0;
- block_BytestreamFlush( &p_pack->bytestream );
+ vlc_frame_BytestreamFlush( &p_pack->bytestream );
}
if( p_pack->i_state != STATE_NEXT_SYNC )
@@ -159,41 +159,41 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
case STATE_NEXT_SYNC:
/* Find the next startcode */
- if( block_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
+ if( vlc_frame_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
p_pack->p_startcode, p_pack->i_startcode,
p_pack->pf_startcode_helper, NULL ) )
{
- if( pp_block /* not flushing */ || !p_pack->bytestream.p_chain )
+ if( pp_frame /* not flushing */ || !p_pack->bytestream.p_chain )
return NULL; /* Need more data */
/* When flusing and we don't find a startcode, suppose that
* the data extend up to the end */
- block_ChainProperties( p_pack->bytestream.p_chain,
+ vlc_frame_ChainProperties( p_pack->bytestream.p_chain,
NULL, &p_pack->i_offset, NULL );
- p_pack->i_offset -= p_pack->bytestream.i_block_offset;
+ p_pack->i_offset -= p_pack->bytestream.i_data_offset;
if( p_pack->i_offset <= (size_t)p_pack->i_startcode &&
- (p_pack->bytestream.p_block->i_flags & BLOCK_FLAG_AU_END) == 0 )
+ (p_pack->bytestream.p_data->i_flags & FRAME_FLAG_AU_END) == 0 )
return NULL;
}
- block_BytestreamFlush( &p_pack->bytestream );
+ vlc_frame_BytestreamFlush( &p_pack->bytestream );
/* Get the new fragment and set the pts/dts */
- block_t *p_block_bytestream = p_pack->bytestream.p_block;
+ vlc_frame_t *p_frame_bytestream = p_pack->bytestream.p_data;
- p_pic = block_Alloc( p_pack->i_offset + p_pack->i_au_prepend );
- p_pic->i_pts = p_block_bytestream->i_pts;
- p_pic->i_dts = p_block_bytestream->i_dts;
+ p_pic = vlc_frame_Alloc( p_pack->i_offset + p_pack->i_au_prepend );
+ p_pic->i_pts = p_frame_bytestream->i_pts;
+ p_pic->i_dts = p_frame_bytestream->i_dts;
/* Do not wait for next sync code if notified block ends AU */
- if( (p_block_bytestream->i_flags & BLOCK_FLAG_AU_END) &&
- p_block_bytestream->i_buffer == p_pack->i_offset )
+ if( (p_frame_bytestream->i_flags & FRAME_FLAG_AU_END) &&
+ p_frame_bytestream->i_buffer == p_pack->i_offset )
{
- p_pic->i_flags |= BLOCK_FLAG_AU_END;
+ p_pic->i_flags |= FRAME_FLAG_AU_END;
}
- block_GetBytes( &p_pack->bytestream, &p_pic->p_buffer[p_pack->i_au_prepend],
+ vlc_frame_GetBytes( &p_pack->bytestream, &p_pic->p_buffer[p_pack->i_au_prepend],
p_pic->i_buffer - p_pack->i_au_prepend );
if( p_pack->i_au_prepend > 0 )
memcpy( p_pic->p_buffer, p_pack->p_au_prepend, p_pack->i_au_prepend );
@@ -203,7 +203,7 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
/* Parse the NAL */
if( p_pic->i_buffer < p_pack->i_au_min_size )
{
- block_Release( p_pic );
+ vlc_frame_Release( p_pic );
p_pic = NULL;
}
else
@@ -211,8 +211,8 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
p_pic = p_pack->pf_parse( p_pack->p_private, &b_used_ts, p_pic );
if( b_used_ts )
{
- p_block_bytestream->i_dts = VLC_TICK_INVALID;
- p_block_bytestream->i_pts = VLC_TICK_INVALID;
+ p_frame_bytestream->i_dts = VLC_TICK_INVALID;
+ p_frame_bytestream->i_pts = VLC_TICK_INVALID;
}
}
@@ -224,13 +224,13 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
if( p_pack->pf_validate( p_pack->p_private, p_pic ) )
{
p_pack->i_state = STATE_NOSYNC;
- block_Release( p_pic );
+ vlc_frame_Release( p_pic );
break;
}
- /* So p_block doesn't get re-added several times */
- if( pp_block )
- *pp_block = block_BytestreamPop( &p_pack->bytestream );
+ /* So p_frame doesn't get re-added several times */
+ if( pp_frame )
+ *pp_frame = vlc_frame_BytestreamPop( &p_pack->bytestream );
p_pack->i_state = STATE_NOSYNC;
@@ -242,20 +242,20 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
static inline void packetizer_Header( packetizer_t *p_pack,
const uint8_t *p_header, int i_header )
{
- block_t *p_init = block_Alloc( i_header );
+ vlc_frame_t *p_init = vlc_frame_Alloc( i_header );
if( !p_init )
return;
memcpy( p_init->p_buffer, p_header, i_header );
- block_t *p_pic;
+ vlc_frame_t *p_pic;
while( ( p_pic = packetizer_Packetize( p_pack, &p_init ) ) )
- block_Release( p_pic ); /* Should not happen (only sequence header) */
+ vlc_frame_Release( p_pic ); /* Should not happen (only sequence header) */
while( ( p_pic = packetizer_Packetize( p_pack, NULL ) ) )
- block_Release( p_pic );
+ vlc_frame_Release( p_pic );
p_pack->i_state = STATE_NOSYNC;
- block_BytestreamEmpty( &p_pack->bytestream );
+ vlc_frame_BytestreamEmpty( &p_pack->bytestream );
p_pack->i_offset = 0;
}
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 2d4fdf13d2..854631f82a 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -32,10 +32,10 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_bits.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include "../codec/cc.h"
#include "packetizer_helper.h"
#include "hxxx_nal.h"
@@ -70,7 +70,7 @@ typedef struct
bool b_sequence_header;
struct
{
- block_t *p_sh;
+ vlc_frame_t *p_sh;
bool b_advanced_profile;
bool b_interlaced;
bool b_frame_interpolation;
@@ -80,7 +80,7 @@ typedef struct
bool b_entry_point;
struct
{
- block_t *p_ep;
+ vlc_frame_t *p_ep;
} ep;
/* */
@@ -89,8 +89,8 @@ typedef struct
/* Current frame being built */
vlc_tick_t i_frame_dts;
vlc_tick_t i_frame_pts;
- block_t *p_frame;
- block_t **pp_last;
+ vlc_frame_t *p_frame;
+ vlc_frame_t **pp_last;
vlc_tick_t i_interpolated_dts;
@@ -121,15 +121,15 @@ typedef enum
IDU_TYPE_SLICE_USER_DATA = 0x1B,
} idu_type_t;
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block );
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame );
static void Flush( decoder_t * );
static void PacketizeReset( void *p_private, bool b_broken );
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
-static int PacketizeValidate( void *p_private, block_t * );
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t * );
+static int PacketizeValidate( void *p_private, vlc_frame_t * );
-static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag );
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
+static vlc_frame_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, vlc_frame_t *p_frag );
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t * );
static const uint8_t p_vc1_startcode[3] = { 0x00, 0x00, 0x01 };
/*****************************************************************************
@@ -213,11 +213,11 @@ static void Close( vlc_object_t *p_this )
packetizer_Clean( &p_sys->packetizer );
if( p_sys->p_frame )
- block_Release( p_sys->p_frame );
+ vlc_frame_Release( p_sys->p_frame );
if( p_sys->sh.p_sh )
- block_Release( p_sys->sh.p_sh );
+ vlc_frame_Release( p_sys->sh.p_sh );
if( p_sys->ep.p_ep )
- block_Release( p_sys->ep.p_ep );
+ vlc_frame_Release( p_sys->ep.p_ep );
cc_Exit( &p_sys->cc_next );
cc_Exit( &p_sys->cc );
@@ -228,37 +228,37 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Packetize: packetize an access unit
*****************************************************************************/
-static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_sys->b_check_startcode && pp_block && *pp_block )
+ if( p_sys->b_check_startcode && pp_frame && *pp_frame )
{
/* Fix syntax for (some?) VC1 from asf */
const unsigned i_startcode = sizeof(p_vc1_startcode);
- block_t *p_block = *pp_block;
- if( p_block->i_buffer > 0 &&
- ( p_block->i_buffer < i_startcode ||
- memcmp( p_block->p_buffer, p_vc1_startcode, i_startcode ) ) )
+ vlc_frame_t *p_frame = *pp_frame;
+ if( p_frame->i_buffer > 0 &&
+ ( p_frame->i_buffer < i_startcode ||
+ memcmp( p_frame->p_buffer, p_vc1_startcode, i_startcode ) ) )
{
- *pp_block = p_block = block_Realloc( p_block, i_startcode+1, p_block->i_buffer );
- if( p_block )
+ *pp_frame = p_frame = vlc_frame_Realloc( p_frame, i_startcode+1, p_frame->i_buffer );
+ if( p_frame )
{
- memcpy( p_block->p_buffer, p_vc1_startcode, i_startcode );
+ memcpy( p_frame->p_buffer, p_vc1_startcode, i_startcode );
if( p_sys->b_sequence_header && p_sys->sh.b_interlaced &&
- p_block->i_buffer > i_startcode+1 &&
- (p_block->p_buffer[i_startcode+1] & 0xc0) == 0xc0 )
- p_block->p_buffer[i_startcode] = IDU_TYPE_FIELD;
+ p_frame->i_buffer > i_startcode+1 &&
+ (p_frame->p_buffer[i_startcode+1] & 0xc0) == 0xc0 )
+ p_frame->p_buffer[i_startcode] = IDU_TYPE_FIELD;
else
- p_block->p_buffer[i_startcode] = IDU_TYPE_FRAME;
+ p_frame->p_buffer[i_startcode] = IDU_TYPE_FRAME;
}
}
p_sys->b_check_startcode = false;
}
- block_t *p_au = packetizer_Packetize( &p_sys->packetizer, pp_block );
+ vlc_frame_t *p_au = packetizer_Packetize( &p_sys->packetizer, pp_frame );
if( !p_au )
p_sys->b_check_startcode = p_dec->fmt_in.b_packetized;
@@ -280,7 +280,7 @@ static void PacketizeReset( void *p_private, bool b_broken )
if( b_broken )
{
if( p_sys->p_frame )
- block_ChainRelease( p_sys->p_frame );
+ vlc_frame_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame = false;
@@ -290,14 +290,14 @@ static void PacketizeReset( void *p_private, bool b_broken )
p_sys->i_frame_pts = VLC_TICK_INVALID;
p_sys->i_interpolated_dts = VLC_TICK_INVALID;
}
-static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
+static vlc_frame_t *PacketizeParse( void *p_private, bool *pb_ts_used, vlc_frame_t *p_frame )
{
decoder_t *p_dec = p_private;
- return ParseIDU( p_dec, pb_ts_used, p_block );
+ return ParseIDU( p_dec, pb_ts_used, p_frame );
}
-static int PacketizeValidate( void *p_private, block_t *p_au )
+static int PacketizeValidate( void *p_private, vlc_frame_t *p_au )
{
decoder_t *p_dec = p_private;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -333,23 +333,23 @@ static void BuildExtraData( decoder_t *p_dec )
}
/* ParseIDU: parse an Independent Decoding Unit */
-static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
+static vlc_frame_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, vlc_frame_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_pic;
+ vlc_frame_t *p_pic;
const idu_type_t idu = p_frag->p_buffer[3];
*pb_ts_used = false;
if( !p_sys->b_sequence_header && idu != IDU_TYPE_SEQUENCE_HEADER )
{
msg_Warn( p_dec, "waiting for sequence header" );
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return NULL;
}
if( p_sys->b_sequence_header && !p_sys->b_entry_point && idu != IDU_TYPE_ENTRY_POINT )
{
msg_Warn( p_dec, "waiting for entry point" );
- block_Release( p_frag );
+ vlc_frame_Release( p_frag );
return NULL;
}
/* TODO we do not gather ENTRY_POINT and SEQUENCE_DATA user data
@@ -364,11 +364,11 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
idu != IDU_TYPE_END_OF_SEQUENCE )
{
/* Prepend SH and EP on I */
- if( p_sys->p_frame->i_flags & BLOCK_FLAG_TYPE_I )
+ if( p_sys->p_frame->i_flags & FRAME_FLAG_TYPE_I )
{
- block_t *p_list = block_Duplicate( p_sys->sh.p_sh );
- block_ChainAppend( &p_list, block_Duplicate( p_sys->ep.p_ep ) );
- block_ChainAppend( &p_list, p_sys->p_frame );
+ vlc_frame_t *p_list = vlc_frame_Duplicate( p_sys->sh.p_sh );
+ vlc_frame_ChainAppend( &p_list, vlc_frame_Duplicate( p_sys->ep.p_ep ) );
+ vlc_frame_ChainAppend( &p_list, p_sys->p_frame );
p_list->i_flags = p_sys->p_frame->i_flags;
@@ -376,7 +376,7 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
}
/* */
- p_pic = block_ChainGather( p_sys->p_frame );
+ p_pic = vlc_frame_ChainGather( p_sys->p_frame );
p_pic->i_dts = p_sys->i_frame_dts;
p_pic->i_pts = p_sys->i_frame_pts;
@@ -399,7 +399,7 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
if( p_pic->i_pts == VLC_TICK_INVALID )
{
- if( !p_sys->sh.b_has_bframe || (p_pic->i_flags & BLOCK_FLAG_TYPE_B ) )
+ if( !p_sys->sh.b_has_bframe || (p_pic->i_flags & FRAME_FLAG_TYPE_B ) )
p_pic->i_pts = p_pic->i_dts;
/* TODO compute pts for other case */
}
@@ -432,9 +432,9 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
}
/* We will add back SH and EP on I frames */
- block_t *p_release = NULL;
+ vlc_frame_t *p_release = NULL;
if( idu != IDU_TYPE_SEQUENCE_HEADER && idu != IDU_TYPE_ENTRY_POINT )
- block_ChainLastAppend( &p_sys->pp_last, p_frag );
+ vlc_frame_ChainLastAppend( &p_sys->pp_last, p_frag );
else
p_release = p_frag;
@@ -447,8 +447,8 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
/* */
if( p_sys->sh.p_sh )
- block_Release( p_sys->sh.p_sh );
- p_sys->sh.p_sh = block_Duplicate( p_frag );
+ vlc_frame_Release( p_sys->sh.p_sh );
+ p_sys->sh.p_sh = vlc_frame_Duplicate( p_frag );
/* Auto detect VC-1_SPMP_PESpacket_PayloadFormatHeader (SMPTE RP 227) for simple/main profile
* TODO find a test case and valid it */
@@ -638,8 +638,8 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
else if( idu == IDU_TYPE_ENTRY_POINT )
{
if( p_sys->ep.p_ep )
- block_Release( p_sys->ep.p_ep );
- p_sys->ep.p_ep = block_Duplicate( p_frag );
+ vlc_frame_Release( p_sys->ep.p_ep );
+ p_sys->ep.p_ep = vlc_frame_Duplicate( p_frag );
if( !p_sys->b_entry_point )
msg_Dbg( p_dec, "found entry point" );
@@ -680,33 +680,33 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
case 0: /* II */
case 1: /* IP */
case 2: /* PI */
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_I;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_I;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_I;
break;
case 3: /* PP */
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_P;
break;
case 4: /* BB */
case 5: /* BBi */
case 6: /* BiB */
case 7: /* BiBi */
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_B;
break;
}
}
else
{
if( !bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_P;
else if( !bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_B;
else if( !bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_I;
else if( !bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_B; /* Bi */
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_B; /* Bi */
else
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_P; /* P Skip */
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_P; /* P Skip */
}
}
else
@@ -718,11 +718,11 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
bs_skip( &s, 1 ); // range reduction
if( bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_P;
else if( !p_sys->sh.b_has_bframe || bs_read( &s, 1 ) )
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_I;
else
- p_sys->p_frame->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_sys->p_frame->i_flags |= FRAME_FLAG_TYPE_B;
}
p_sys->b_frame = true;
}
@@ -759,25 +759,25 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
}
if( p_release )
- block_Release( p_release );
+ vlc_frame_Release( p_release );
return p_pic;
}
/*****************************************************************************
* GetCc:
*****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
+static vlc_frame_t *GetCc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_cc;
+ vlc_frame_t *p_cc;
- p_cc = block_Alloc( p_sys->cc.i_data);
+ p_cc = vlc_frame_Alloc( p_sys->cc.i_data);
if( p_cc )
{
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
p_cc->i_dts =
p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
- p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
+ p_cc->i_flags = p_sys->i_cc_flags & FRAME_FLAG_TYPE_MASK;
p_desc->i_608_channels = p_sys->cc.i_608channels;
p_desc->i_708_channels = p_sys->cc.i_708channels;
--
2.20.1
More information about the vlc-devel
mailing list