[vlc-devel] [PATCH 04/17] Codec: Use vlc_frame_t instead of block_t
Denis Charmet
typx at dinauz.org
Mon Apr 22 19:10:33 CEST 2019
---
modules/codec/a52.c | 12 +-
modules/codec/adpcm.c | 56 +++---
modules/codec/aes3.c | 132 +++++++-------
modules/codec/aom.c | 42 ++---
modules/codec/araw.c | 50 +++---
modules/codec/arib/aribsub.c | 24 +--
modules/codec/audiotoolbox_midi.c | 40 ++---
modules/codec/avcodec/audio.c | 138 +++++++--------
modules/codec/avcodec/encoder.c | 90 +++++-----
modules/codec/avcodec/subtitle.c | 62 +++----
modules/codec/avcodec/video.c | 118 ++++++-------
modules/codec/bpg.c | 20 +--
modules/codec/cc.c | 66 +++----
modules/codec/cdg.c | 22 +--
modules/codec/crystalhd.c | 24 +--
modules/codec/cvdsub.c | 82 ++++-----
modules/codec/daala.c | 74 ++++----
modules/codec/dav1d.c | 24 +--
modules/codec/dca.c | 8 +-
modules/codec/ddummy.c | 18 +-
modules/codec/dmo/buffer.c | 12 +-
modules/codec/dmo/dmo.c | 118 ++++++-------
modules/codec/dmo/dmo.h | 6 +-
modules/codec/dvbsub.c | 60 +++----
modules/codec/edummy.c | 8 +-
modules/codec/faad.c | 100 +++++------
modules/codec/fdkaac.c | 44 ++---
modules/codec/flac.c | 86 +++++-----
modules/codec/fluidsynth.c | 42 ++---
modules/codec/g711.c | 54 +++---
modules/codec/gstreamer/gstdecode.c | 48 +++---
modules/codec/hxxx_helper.c | 146 ++++++++--------
modules/codec/hxxx_helper.h | 16 +-
modules/codec/jpeg.c | 44 ++---
modules/codec/kate.c | 70 ++++----
modules/codec/libass.c | 42 ++---
modules/codec/libmpeg2.c | 74 ++++----
modules/codec/lpcm.c | 220 ++++++++++++------------
modules/codec/mad.c | 48 +++---
modules/codec/mft.c | 44 ++---
modules/codec/mpg123.c | 46 ++---
modules/codec/oggspots.c | 76 ++++----
modules/codec/omxil/mediacodec.c | 258 ++++++++++++++--------------
modules/codec/omxil/omxil.c | 110 ++++++------
modules/codec/omxil/omxil_core.c | 2 +-
modules/codec/omxil/utils.c | 2 +-
modules/codec/opus.c | 94 +++++-----
modules/codec/png.c | 80 ++++-----
modules/codec/qsv.c | 68 ++++----
modules/codec/rawvideo.c | 76 ++++----
modules/codec/rtpvideo.c | 14 +-
modules/codec/schroedinger.c | 122 ++++++-------
modules/codec/scte18.c | 18 +-
modules/codec/scte27.c | 6 +-
modules/codec/sdl_image.c | 22 +--
modules/codec/shine.c | 100 +++++------
modules/codec/spdif.c | 8 +-
modules/codec/speex.c | 150 ++++++++--------
modules/codec/spudec/spudec.c | 74 ++++----
modules/codec/spudec/spudec.h | 2 +-
modules/codec/stl.c | 30 ++--
modules/codec/subsdec.c | 44 ++---
modules/codec/substx3g.c | 58 +++----
modules/codec/subsusf.c | 44 ++---
modules/codec/svcdsub.c | 76 ++++----
modules/codec/svg.c | 20 +--
modules/codec/t140.c | 24 +--
modules/codec/telx.c | 30 ++--
modules/codec/textst.c | 22 +--
modules/codec/theora.c | 76 ++++----
modules/codec/ttml/substtml.c | 52 +++---
modules/codec/ttml/ttmlpes.h | 52 +++---
modules/codec/twolame.c | 40 ++---
modules/codec/uleaddvaudio.c | 46 ++---
modules/codec/videotoolbox.m | 100 +++++------
modules/codec/vorbis.c | 104 +++++------
modules/codec/vpx.c | 36 ++--
modules/codec/webvtt/encvtt.c | 14 +-
modules/codec/webvtt/subsvtt.c | 18 +-
modules/codec/x264.c | 34 ++--
modules/codec/x265.c | 24 +--
modules/codec/xwd.c | 28 +--
modules/codec/zvbi.c | 46 ++---
modules/hw/mmal/codec.c | 40 ++---
84 files changed, 2385 insertions(+), 2385 deletions(-)
diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index fb6a1ea2a8..ead3ca4a37 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -48,7 +48,7 @@
#endif
#include <vlc_aout.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_codec.h>
static int Open ( vlc_object_t * );
@@ -129,7 +129,7 @@ static void Duplicate( sample_t *restrict p_out, const sample_t *restrict p_in )
}
}
-static int Decode( decoder_t *p_dec, block_t *p_in_buf )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_in_buf )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -147,10 +147,10 @@ static int Decode( decoder_t *p_dec, block_t *p_in_buf )
/* Every A/52 frame is composed of 6 blocks, each with an output of 256
* samples for each channel. */
- block_t *p_out_buf = block_Alloc( 6 * i_bytes_per_block );
+ vlc_frame_t *p_out_buf = vlc_frame_Alloc( 6 * i_bytes_per_block );
if( unlikely(p_out_buf == NULL) )
{
- block_Release( p_in_buf );
+ vlc_frame_Release( p_in_buf );
return VLCDEC_SUCCESS;
}
@@ -177,7 +177,7 @@ static int Decode( decoder_t *p_dec, block_t *p_in_buf )
for( unsigned i = 0; i < 6; i++ )
{
if( a52_block( p_sys->p_liba52 ) )
- msg_Warn( p_dec, "a52_block failed for block %d", i );
+ msg_Warn( p_dec, "a52_frame failed for frame %d", i );
sample_t *p_samples = a52_samples( p_sys->p_liba52 );
@@ -202,7 +202,7 @@ static int Decode( decoder_t *p_dec, block_t *p_in_buf )
p_out_buf->i_dts = p_in_buf->i_dts;
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_in_buf->i_length;
- block_Release( p_in_buf );
+ vlc_frame_Release( p_in_buf );
decoder_QueueAudio( p_dec, p_out_buf );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index 7c9fd865e5..cfe27c5aa5 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -40,7 +40,7 @@
static int OpenDecoder( vlc_object_t * );
static void CloseDecoder( vlc_object_t * );
-static int DecodeAudio( decoder_t *, block_t * );
+static int DecodeAudio( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
vlc_module_begin ()
@@ -287,39 +287,39 @@ static void Flush( decoder_t *p_dec )
}
/*****************************************************************************
- * DecodeBlock:
+ * DecodeFrame:
*****************************************************************************/
-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;
- block_t *p_block;
+ vlc_frame_t *p_frame;
- if( !*pp_block ) return NULL;
+ if( !*pp_frame ) return NULL;
- p_block = *pp_block;
+ p_frame = *pp_frame;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
goto drop;
}
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
else if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
/* We've just started the stream, wait for the first PTS. */
goto drop;
/* Don't re-use the same pts twice */
- p_block->i_pts = VLC_TICK_INVALID;
+ p_frame->i_pts = VLC_TICK_INVALID;
- if( p_block->i_buffer >= p_sys->i_block )
+ if( p_frame->i_buffer >= p_sys->i_block )
{
- block_t *p_out;
+ vlc_frame_t *p_out;
if( decoder_UpdateAudioFormat( p_dec ) )
goto drop;
@@ -335,49 +335,49 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
case ADPCM_IMA_QT:
DecodeAdpcmImaQT( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case ADPCM_IMA_WAV:
DecodeAdpcmImaWav( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case ADPCM_MS:
DecodeAdpcmMs( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case ADPCM_DK4:
DecodeAdpcmDk4( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case ADPCM_DK3:
DecodeAdpcmDk3( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case ADPCM_EA:
DecodeAdpcmEA( p_dec, (int16_t*)p_out->p_buffer,
- p_block->p_buffer );
+ p_frame->p_buffer );
default:
break;
}
- p_block->p_buffer += p_sys->i_block;
- p_block->i_buffer -= p_sys->i_block;
+ p_frame->p_buffer += p_sys->i_block;
+ p_frame->i_buffer -= p_sys->i_block;
return p_out;
}
drop:
- block_Release( p_block );
- *pp_block = NULL;
+ vlc_frame_Release( p_frame );
+ *pp_frame = NULL;
return NULL;
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- block_t **pp_block = &p_block, *p_out;
- while( ( p_out = DecodeBlock( p_dec, pp_block ) ) != NULL )
+ vlc_frame_t **pp_frame = &p_frame, *p_out;
+ while( ( p_out = DecodeFrame( p_dec, pp_frame ) ) != NULL )
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/aes3.c b/modules/codec/aes3.c
index 982fd460a1..cbc795ead0 100644
--- a/modules/codec/aes3.c
+++ b/modules/codec/aes3.c
@@ -72,8 +72,8 @@ typedef struct
*****************************************************************************/
static int Open( decoder_t *p_dec, bool b_packetizer );
-static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
- block_t *p_block, bool b_packetizer );
+static vlc_frame_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
+ vlc_frame_t *p_frame, bool b_packetizer );
/*****************************************************************************
* OpenDecoder:
@@ -134,14 +134,14 @@ static const uint8_t reverse[256] = {
****************************************************************************
* Beware, this function must be fed with complete frames (PES packet).
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_aout_buffer;
+ vlc_frame_t *p_aout_buffer;
int i_frame_length, i_bits;
- p_block = Parse( p_dec, &i_frame_length, &i_bits, p_block, false );
- if( !p_block )
+ p_frame = Parse( p_dec, &i_frame_length, &i_bits, p_frame, false );
+ if( !p_frame )
return VLCDEC_SUCCESS;
if( decoder_UpdateAudioFormat( p_dec ) )
@@ -158,25 +158,25 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_aout_buffer->i_length = date_Increment( &p_sys->end_date,
i_frame_length ) - p_aout_buffer->i_pts;
- p_block->i_buffer -= AES3_HEADER_LEN;
- p_block->p_buffer += AES3_HEADER_LEN;
+ p_frame->i_buffer -= AES3_HEADER_LEN;
+ p_frame->p_buffer += AES3_HEADER_LEN;
if( i_bits == 24 )
{
uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
- while( p_block->i_buffer / 7 )
+ while( p_frame->i_buffer / 7 )
{
- *(p_out++) = (reverse[p_block->p_buffer[0]] << 8)
- | (reverse[p_block->p_buffer[1]] << 16)
- | (reverse[p_block->p_buffer[2]] << 24);
- *(p_out++) = ((reverse[p_block->p_buffer[3]] << 4)
- | (reverse[p_block->p_buffer[4]] << 12)
- | (reverse[p_block->p_buffer[5]] << 20)
- | (reverse[p_block->p_buffer[6]] << 28)) & 0xFFFFFF00;
-
- p_block->i_buffer -= 7;
- p_block->p_buffer += 7;
+ *(p_out++) = (reverse[p_frame->p_buffer[0]] << 8)
+ | (reverse[p_frame->p_buffer[1]] << 16)
+ | (reverse[p_frame->p_buffer[2]] << 24);
+ *(p_out++) = ((reverse[p_frame->p_buffer[3]] << 4)
+ | (reverse[p_frame->p_buffer[4]] << 12)
+ | (reverse[p_frame->p_buffer[5]] << 20)
+ | (reverse[p_frame->p_buffer[6]] << 28)) & 0xFFFFFF00;
+
+ p_frame->i_buffer -= 7;
+ p_frame->p_buffer += 7;
}
}
@@ -184,17 +184,17 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
{
uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
- while( p_block->i_buffer / 6 )
+ while( p_frame->i_buffer / 6 )
{
- *(p_out++) = (reverse[p_block->p_buffer[0]] << 12)
- | (reverse[p_block->p_buffer[1]] << 20)
- | (reverse[p_block->p_buffer[2]] << 28);
- *(p_out++) = (reverse[p_block->p_buffer[3]] << 12)
- | (reverse[p_block->p_buffer[4]] << 20)
- | (reverse[p_block->p_buffer[5]] << 28);
-
- p_block->i_buffer -= 6;
- p_block->p_buffer += 6;
+ *(p_out++) = (reverse[p_frame->p_buffer[0]] << 12)
+ | (reverse[p_frame->p_buffer[1]] << 20)
+ | (reverse[p_frame->p_buffer[2]] << 28);
+ *(p_out++) = (reverse[p_frame->p_buffer[3]] << 12)
+ | (reverse[p_frame->p_buffer[4]] << 20)
+ | (reverse[p_frame->p_buffer[5]] << 28);
+
+ p_frame->i_buffer -= 6;
+ p_frame->p_buffer += 6;
}
}
else
@@ -203,21 +203,21 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
assert( i_bits == 16 );
- while( p_block->i_buffer / 5 )
+ while( p_frame->i_buffer / 5 )
{
- *(p_out++) = reverse[p_block->p_buffer[0]]
- |(reverse[p_block->p_buffer[1]] << 8);
- *(p_out++) = (reverse[p_block->p_buffer[2]] >> 4)
- | (reverse[p_block->p_buffer[3]] << 4)
- | (reverse[p_block->p_buffer[4]] << 12);
-
- p_block->i_buffer -= 5;
- p_block->p_buffer += 5;
+ *(p_out++) = reverse[p_frame->p_buffer[0]]
+ |(reverse[p_frame->p_buffer[1]] << 8);
+ *(p_out++) = (reverse[p_frame->p_buffer[2]] >> 4)
+ | (reverse[p_frame->p_buffer[3]] << 4)
+ | (reverse[p_frame->p_buffer[4]] << 12);
+
+ p_frame->i_buffer -= 5;
+ p_frame->p_buffer += 5;
}
}
exit:
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_aout_buffer != NULL )
decoder_QueueAudio( p_dec, p_aout_buffer );
return VLCDEC_SUCCESS;
@@ -238,26 +238,26 @@ static void Flush( decoder_t *p_dec )
****************************************************************************
* Beware, this function must be fed with complete frames (PES packet).
*****************************************************************************/
-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;
+ vlc_frame_t *p_frame;
int i_frame_length, i_bits;
- if( !pp_block ) /* No Drain */
+ if( !pp_frame ) /* No Drain */
return NULL;
- p_block = *pp_block;
- *pp_block = NULL; /* So the packet doesn't get re-sent */
+ p_frame = *pp_frame;
+ *pp_frame = NULL; /* So the packet doesn't get re-sent */
- p_block = Parse( p_dec, &i_frame_length, &i_bits, p_block, true );
- if( !p_block )
+ p_frame = Parse( p_dec, &i_frame_length, &i_bits, p_frame, true );
+ if( !p_frame )
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, 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, i_frame_length ) - p_frame->i_pts;
/* Just pass on the incoming frame */
- return p_block;
+ return p_frame;
}
/*****************************************************************************
@@ -313,8 +313,8 @@ static const unsigned int pi_original_channels[4] = {
AOUT_CHAN_CENTER | AOUT_CHAN_LFE,
};
-static block_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
- block_t *p_block, bool b_packetizer )
+static vlc_frame_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
+ vlc_frame_t *p_frame, bool b_packetizer )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint32_t h;
@@ -322,37 +322,37 @@ static block_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
int i_channels;
int i_bits;
- if( !p_block ) /* No drain */
+ if( !p_frame ) /* No drain */
return NULL;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
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;
}
}
/* Date management */
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
if( 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->i_buffer <= AES3_HEADER_LEN )
+ if( p_frame->i_buffer <= AES3_HEADER_LEN )
{
msg_Err(p_dec, "frame is too short");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -365,15 +365,15 @@ static block_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
* alignments 4
*/
- h = GetDWBE( p_block->p_buffer );
+ h = GetDWBE( p_frame->p_buffer );
i_size = (h >> 16) & 0xffff;
i_channels = 2 + 2*( (h >> 14) & 0x03 );
i_bits = 16 + 4*( (h >> 4)&0x03 );
- if( AES3_HEADER_LEN + i_size != p_block->i_buffer || i_bits > 24 )
+ if( AES3_HEADER_LEN + i_size != p_frame->i_buffer || i_bits > 24 )
{
msg_Err(p_dec, "frame has invalid header");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -391,7 +391,7 @@ static block_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels = pi_original_channels[i_channels/2-1];
- *pi_frame_length = (p_block->i_buffer - AES3_HEADER_LEN) / ( (4+i_bits) * i_channels / 8 );
+ *pi_frame_length = (p_frame->i_buffer - AES3_HEADER_LEN) / ( (4+i_bits) * i_channels / 8 );
*pi_bits = i_bits;
- return p_block;
+ return p_frame;
}
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index e4f26c3916..031b1ea4ce 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -51,7 +51,7 @@ static void CloseDecoder(vlc_object_t *);
#ifdef ENABLE_SOUT
static int OpenEncoder(vlc_object_t *);
static void CloseEncoder(vlc_object_t *);
-static block_t *Encode(encoder_t *p_enc, picture_t *p_pict);
+static vlc_frame_t *Encode(encoder_t *p_enc, picture_t *p_pict);
static const int pi_enc_bitdepth_values_list[] =
{ 8, 10, 12 };
@@ -171,7 +171,7 @@ static void CopyPicture(const struct aom_image *img, picture_t *pic)
}
}
-static int PushFrame(decoder_t *dec, block_t *block)
+static int PushFrame(decoder_t *dec, vlc_frame_t *frame)
{
decoder_sys_t *p_sys = dec->p_sys;
aom_codec_ctx_t *ctx = &p_sys->ctx;
@@ -181,11 +181,11 @@ static int PushFrame(decoder_t *dec, block_t *block)
/* Associate packet PTS with decoded frame */
uintptr_t priv_index = p_sys->i_next_frame_priv++ % AOM_MAX_FRAMES_DEPTH;
- if(likely(block))
+ if(likely(frame))
{
- p_buffer = block->p_buffer;
- i_buffer = block->i_buffer;
- p_sys->frame_priv[priv_index].pts = (block->i_pts != VLC_TICK_INVALID) ? block->i_pts : block->i_dts;
+ p_buffer = frame->p_buffer;
+ i_buffer = frame->i_buffer;
+ p_sys->frame_priv[priv_index].pts = (frame->i_pts != VLC_TICK_INVALID) ? frame->i_pts : frame->i_dts;
}
else
{
@@ -196,8 +196,8 @@ static int PushFrame(decoder_t *dec, block_t *block)
aom_codec_err_t err;
err = aom_codec_decode(ctx, p_buffer, i_buffer, (void*)priv_index);
- if(block)
- block_Release(block);
+ if(frame)
+ vlc_frame_Release(frame);
if (err != AOM_CODEC_OK) {
AOM_ERR(dec, ctx, "Failed to decode frame");
@@ -301,15 +301,15 @@ static void FlushDecoder(decoder_t *dec)
/****************************************************************************
* Decode: the whole thing
****************************************************************************/
-static int Decode(decoder_t *dec, block_t *block)
+static int Decode(decoder_t *dec, vlc_frame_t *frame)
{
- if (block && block->i_flags & (BLOCK_FLAG_CORRUPTED))
+ if (frame && frame->i_flags & (FRAME_FLAG_CORRUPTED))
{
- block_Release(block);
+ vlc_frame_Release(frame);
return VLCDEC_SUCCESS;
}
- int i_ret = PushFrame(dec, block);
+ int i_ret = PushFrame(dec, frame);
PopFrames(dec, OutputFrame);
@@ -525,7 +525,7 @@ static int OpenEncoder(vlc_object_t *p_this)
/****************************************************************************
* Encode: the whole thing
****************************************************************************/
-static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
+static vlc_frame_t *Encode(encoder_t *p_enc, picture_t *p_pict)
{
encoder_sys_t *p_sys = p_enc->p_sys;
struct aom_codec_ctx *ctx = &p_sys->ctx;
@@ -560,25 +560,25 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
const aom_codec_cx_pkt_t *pkt = NULL;
aom_codec_iter_t iter = NULL;
- block_t *p_out = NULL;
+ vlc_frame_t *p_out = NULL;
while ((pkt = aom_codec_get_cx_data(ctx, &iter)) != NULL)
{
if (pkt->kind == AOM_CODEC_CX_FRAME_PKT)
{
int keyframe = pkt->data.frame.flags & AOM_FRAME_IS_KEY;
- block_t *p_block = block_Alloc(pkt->data.frame.sz);
- if (unlikely(p_block == NULL)) {
- block_ChainRelease(p_out);
+ vlc_frame_t *p_frame = vlc_frame_Alloc(pkt->data.frame.sz);
+ if (unlikely(p_frame == NULL)) {
+ vlc_frame_ChainRelease(p_out);
p_out = NULL;
break;
}
/* FIXME: do this in-place */
- memcpy(p_block->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);
- p_block->i_dts = p_block->i_pts = VLC_TICK_FROM_US(pkt->data.frame.pts);
+ memcpy(p_frame->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);
+ p_frame->i_dts = p_frame->i_pts = VLC_TICK_FROM_US(pkt->data.frame.pts);
if (keyframe)
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
- block_ChainAppend(&p_out, p_block);
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
+ vlc_frame_ChainAppend(&p_out, p_frame);
}
}
aom_img_free(&img);
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index c73deded85..833a339108 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -65,7 +65,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeBlock( decoder_t *, block_t * );
+static int DecodeFrame( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
typedef struct
@@ -289,7 +289,7 @@ static int DecoderOpen( vlc_object_t *p_this )
date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
p_dec->p_sys = p_sys;
@@ -307,33 +307,33 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with whole samples (see nBlockAlign).
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
goto skip;
}
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
else if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
/* We've just started the stream, wait for the first PTS. */
goto skip;
- unsigned samples = (8 * p_block->i_buffer) / p_sys->framebits;
+ unsigned samples = (8 * p_frame->i_buffer) / p_sys->framebits;
if( samples == 0 )
goto skip;
@@ -341,30 +341,30 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
if( decoder_UpdateAudioFormat( p_dec ) )
goto skip;
- block_t *p_out = decoder_NewAudioBuffer( p_dec, samples );
+ vlc_frame_t *p_out = decoder_NewAudioBuffer( p_dec, samples );
if( p_out == NULL )
goto skip;
- p_sys->decode( p_out->p_buffer, p_block->p_buffer,
+ p_sys->decode( p_out->p_buffer, p_frame->p_buffer,
samples * p_dec->fmt_in.audio.i_channels );
- block_Release( p_block );
- p_block = p_out;
+ vlc_frame_Release( p_frame );
+ p_frame = p_out;
}
else
{
if( decoder_UpdateAudioFormat( p_dec ) )
goto skip;
- p_block->i_nb_samples = samples;
- p_block->i_buffer = samples * (p_sys->framebits / 8);
+ p_frame->i_nb_samples = samples;
+ p_frame->i_buffer = samples * (p_sys->framebits / 8);
}
- p_block->i_pts = date_Get( &p_sys->end_date );
- p_block->i_length = date_Increment( &p_sys->end_date, samples )
- - p_block->i_pts;
- decoder_QueueAudio( p_dec, p_block );
+ p_frame->i_pts = date_Get( &p_sys->end_date );
+ p_frame->i_length = date_Increment( &p_sys->end_date, samples )
+ - p_frame->i_pts;
+ decoder_QueueAudio( p_dec, p_frame );
return VLCDEC_SUCCESS;
skip:
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -642,7 +642,7 @@ static void DecoderClose( vlc_object_t *p_this )
#ifdef ENABLE_SOUT
/* NOTE: Output buffers are always aligned since they are allocated by the araw plugin.
* Contrary to the decoder, the encoder can also assume that input buffers are aligned,
- * since decoded audio blocks must always be aligned. */
+ * since decoded audio frames must always be aligned. */
static void U16IEncode( void *outp, const uint8_t *inp, unsigned samples )
{
@@ -777,12 +777,12 @@ static void F64IEncode( void *outp, const uint8_t *inp, unsigned samples )
}
}
-static block_t *Encode( encoder_t *enc, block_t *in )
+static vlc_frame_t *Encode( encoder_t *enc, vlc_frame_t *in )
{
if( in == NULL )
return NULL;
- block_t *out = block_Alloc( in->i_nb_samples
+ vlc_frame_t *out = vlc_frame_Alloc( in->i_nb_samples
* enc->fmt_out.audio.i_bytes_per_frame );
if( unlikely(out == NULL) )
return NULL;
diff --git a/modules/codec/arib/aribsub.c b/modules/codec/arib/aribsub.c
index fa44a9ba78..d77062b175 100644
--- a/modules/codec/arib/aribsub.c
+++ b/modules/codec/arib/aribsub.c
@@ -41,7 +41,7 @@
*****************************************************************************/
static int Open( vlc_object_t * );
static void Close( vlc_object_t * );
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
#define IGNORE_RUBY_TEXT N_("Ignore ruby (furigana)")
#define IGNORE_RUBY_LONGTEXT N_("Ignore ruby (furigana) in the subtitle.")
@@ -81,7 +81,7 @@ typedef struct
* Local prototypes
*****************************************************************************/
static subpicture_t *render( decoder_t *, arib_parser_t *,
- arib_decoder_t *, block_t * );
+ arib_decoder_t *, vlc_frame_t * );
static char* get_arib_base_dir( void );
static void messages_callback_handler( void *, const char *psz_message );
@@ -160,16 +160,16 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
@@ -177,13 +177,13 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
arib_decoder_t *p_decoder = arib_get_decoder( p_sys->p_arib_instance );
if ( p_parser && p_decoder )
{
- arib_parse_pes( p_parser, p_block->p_buffer, p_block->i_buffer );
- subpicture_t *p_spu = render( p_dec, p_parser, p_decoder, p_block );
+ arib_parse_pes( p_parser, p_frame->p_buffer, p_frame->i_buffer );
+ subpicture_t *p_spu = render( p_dec, p_parser, p_decoder, p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
}
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -214,7 +214,7 @@ static char* get_arib_base_dir()
}
static subpicture_t *render( decoder_t *p_dec, arib_parser_t *p_parser,
- arib_decoder_t *p_arib_decoder, block_t *p_block )
+ arib_decoder_t *p_arib_decoder, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
@@ -263,8 +263,8 @@ static subpicture_t *render( decoder_t *p_dec, arib_parser_t *p_parser,
goto decoder_NewSubpictureText_failed;
}
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + VLC_TICK_FROM_US(arib_decoder_get_time( p_arib_decoder ));
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + VLC_TICK_FROM_US(arib_decoder_get_time( p_arib_decoder ));
p_spu->b_ephemer = (p_spu->i_start == p_spu->i_stop);
p_spu->b_absolute = true;
diff --git a/modules/codec/audiotoolbox_midi.c b/modules/codec/audiotoolbox_midi.c
index 774b800873..dd2a7e812e 100644
--- a/modules/codec/audiotoolbox_midi.c
+++ b/modules/codec/audiotoolbox_midi.c
@@ -72,7 +72,7 @@ typedef struct
date_t end_date;
} decoder_sys_t;
-static int DecodeBlock (decoder_t *p_dec, block_t *p_block);
+static int DecodeFrame (decoder_t *p_dec, vlc_frame_t *p_frame);
static void Flush (decoder_t *);
/* MIDI constants */
@@ -279,7 +279,7 @@ static int Open(vlc_object_t *p_this)
date_Init(&p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1);
p_dec->p_sys = p_sys;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
bailout:
@@ -317,37 +317,37 @@ static void Flush (decoder_t *p_dec)
}
}
-static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
+static int DecodeFrame (decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_out = NULL;
+ vlc_frame_t *p_out = NULL;
OSStatus status = noErr;
- if (p_block == NULL) /* No Drain */
+ if (p_frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
+ if (p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED)) {
Flush(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 VLCDEC_SUCCESS;
}
}
- 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 ) {
- date_Set(&p_sys->end_date, p_block->i_pts);
- } else if (p_block->i_pts < date_Get(&p_sys->end_date)) {
+ date_Set(&p_sys->end_date, p_frame->i_pts);
+ } else if (p_frame->i_pts < date_Get(&p_sys->end_date)) {
msg_Warn(p_dec, "MIDI message in the past?");
goto drop;
}
- if (p_block->i_buffer < 1)
+ if (p_frame->i_buffer < 1)
goto drop;
- uint8_t event = p_block->p_buffer[0];
- uint8_t data1 = (p_block->i_buffer > 1) ? (p_block->p_buffer[1]) : 0;
- uint8_t data2 = (p_block->i_buffer > 2) ? (p_block->p_buffer[2]) : 0;
+ uint8_t event = p_frame->p_buffer[0];
+ uint8_t data1 = (p_frame->i_buffer > 1) ? (p_frame->p_buffer[1]) : 0;
+ uint8_t data2 = (p_frame->i_buffer > 2) ? (p_frame->p_buffer[2]) : 0;
switch (event & 0xF0)
{
@@ -362,8 +362,8 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
break;
case kMidiMessage_SysEx:
- if (p_block->i_buffer < UINT32_MAX)
- MusicDeviceSysEx(p_sys->synthUnit, p_block->p_buffer, (UInt32)p_block->i_buffer);
+ if (p_frame->i_buffer < UINT32_MAX)
+ MusicDeviceSysEx(p_sys->synthUnit, p_frame->p_buffer, (UInt32)p_frame->i_buffer);
break;
default:
@@ -375,7 +375,7 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
// Simplification of 44100 / 1000000
// TODO: Other samplerates
unsigned frames =
- (p_block->i_pts - date_Get(&p_sys->end_date)) * 441 / 10000;
+ (p_frame->i_pts - date_Get(&p_sys->end_date)) * 441 / 10000;
if (frames == 0)
goto drop;
@@ -407,12 +407,12 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
if (status != noErr) {
msg_Warn(p_dec, "rendering audio unit failed: %i", status);
- block_Release(p_out);
+ vlc_frame_Release(p_out);
p_out = NULL;
}
drop:
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
if (p_out != NULL)
decoder_QueueAudio(p_dec, p_out);
return VLCDEC_SUCCESS;
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 27d4e511f6..abc5850088 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -67,11 +67,11 @@ typedef struct
uint64_t i_previous_layout;
} decoder_sys_t;
-#define BLOCK_FLAG_PRIVATE_REALLOCATED (1 << BLOCK_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_PRIVATE_REALLOCATED (1 << FRAME_FLAG_PRIVATE_SHIFT)
static void SetupOutputFormat( decoder_t *p_dec, bool b_trust );
-static block_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame );
-static int DecodeAudio( decoder_t *, block_t * );
+static vlc_frame_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame );
+static int DecodeAudio( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
@@ -156,42 +156,42 @@ static int OpenAudioCodec( decoder_t *p_dec )
*/
typedef struct
{
- block_t self;
+ vlc_frame_t self;
AVFrame *frame;
} vlc_av_frame_t;
-static void vlc_av_frame_Release(block_t *block)
+static void vlc_av_frame_Release(vlc_frame_t *frame)
{
- vlc_av_frame_t *b = (void *)block;
+ vlc_av_frame_t *b = (void *)frame;
av_frame_free(&b->frame);
free(b);
}
-static const struct vlc_block_callbacks vlc_av_frame_cbs =
+static const struct vlc_frame_callbacks vlc_av_frame_cbs =
{
vlc_av_frame_Release,
};
-static block_t *vlc_av_frame_Wrap(AVFrame *frame)
+static vlc_frame_t *vlc_av_frame_Wrap(AVFrame *avframe)
{
for (unsigned i = 1; i < AV_NUM_DATA_POINTERS; i++)
- assert(frame->linesize[i] == 0); /* only packed frame supported */
+ assert(avframe->linesize[i] == 0); /* only packed frame supported */
- if (av_frame_make_writable(frame)) /* TODO: read-only block_t */
+ if (av_frame_make_writable(avframe)) /* TODO: read-only vlc_frame_t */
return NULL;
vlc_av_frame_t *b = malloc(sizeof (*b));
if (unlikely(b == NULL))
return NULL;
- block_t *block = &b->self;
+ vlc_frame_t *frame = &b->self;
- block_Init(block, &vlc_av_frame_cbs,
- frame->extended_data[0], frame->linesize[0]);
- block->i_nb_samples = frame->nb_samples;
- b->frame = frame;
- return block;
+ vlc_frame_Init(frame, &vlc_av_frame_cbs,
+ avframe->extended_data[0], avframe->linesize[0]);
+ frame->i_nb_samples = avframe->nb_samples;
+ b->frame = avframe;
+ return frame;
}
/*****************************************************************************
@@ -291,14 +291,14 @@ static void Flush( decoder_t *p_dec )
}
/*****************************************************************************
- * DecodeBlock: Called to decode one frame
+ * DecodeFrame: Called to decode one frame
*****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *ctx = p_sys->p_context;
AVFrame *frame = NULL;
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
bool b_error = false;
if( !ctx->extradata_size && p_dec->fmt_in.i_extra
@@ -310,51 +310,51 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !avcodec_is_open( ctx ) )
{
- if( pp_block )
- p_block = *pp_block;
+ if( pp_frame )
+ p_frame = *pp_frame;
goto drop;
}
- if( pp_block == NULL ) /* Drain request */
+ if( pp_frame == NULL ) /* Drain request */
{
/* we don't need to care about return val */
(void) avcodec_send_packet( ctx, NULL );
}
else
{
- p_block = *pp_block;
+ p_frame = *pp_frame;
}
- if( p_block )
+ if( p_frame )
{
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
Flush( p_dec );
goto drop;
}
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( p_frame->i_flags & FRAME_FLAG_DISCONTINUITY )
{
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
}
/* We've just started the stream, wait for the first PTS. */
- 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 )
goto drop;
- if( p_block->i_buffer <= 0 )
+ if( p_frame->i_buffer <= 0 )
goto drop;
- if( (p_block->i_flags & BLOCK_FLAG_PRIVATE_REALLOCATED) == 0 )
+ if( (p_frame->i_flags & FRAME_FLAG_PRIVATE_REALLOCATED) == 0 )
{
- *pp_block = p_block = block_Realloc( p_block, 0, p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
- if( !p_block )
+ *pp_frame = p_frame = vlc_frame_Realloc( p_frame, 0, p_frame->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
+ if( !p_frame )
goto end;
- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
- memset( &p_block->p_buffer[p_block->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE );
+ p_frame->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+ memset( &p_frame->p_buffer[p_frame->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE );
- p_block->i_flags |= BLOCK_FLAG_PRIVATE_REALLOCATED;
+ p_frame->i_flags |= FRAME_FLAG_PRIVATE_REALLOCATED;
}
}
@@ -365,24 +365,24 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
for( int ret = 0; ret == 0; )
{
/* Feed in the loop as buffer could have been full on first iterations */
- if( p_block )
+ if( p_frame )
{
AVPacket pkt;
av_init_packet( &pkt );
- pkt.data = p_block->p_buffer;
- pkt.size = p_block->i_buffer;
+ pkt.data = p_frame->p_buffer;
+ pkt.size = p_frame->i_buffer;
ret = avcodec_send_packet( ctx, &pkt );
- if( ret == 0 ) /* Block has been consumed */
+ if( ret == 0 ) /* frame has been consumed */
{
- /* Only set new pts from input block if it has been used,
+ /* Only set new pts from input frame if it has been used,
* otherwise let it be through interpolation */
- if( p_block->i_pts > date_Get( &p_sys->end_date ) )
+ if( p_frame->i_pts > date_Get( &p_sys->end_date ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
- block_Release( p_block );
- *pp_block = p_block = NULL;
+ vlc_frame_Release( p_frame );
+ *pp_frame = p_frame = NULL;
}
else if ( ret != AVERROR(EAGAIN) ) /* Errors other than buffer full */
{
@@ -419,7 +419,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( decoder_UpdateAudioFormat( p_dec ) )
goto drop;
- block_t *p_converted = ConvertAVFrame( p_dec, frame ); /* Consumes frame */
+ vlc_frame_t *p_converted = ConvertAVFrame( p_dec, frame ); /* Consumes frame */
if( p_converted )
{
/* Silent unwanted samples */
@@ -456,78 +456,78 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
end:
b_error = true;
drop:
- if( pp_block )
+ if( pp_frame )
{
- assert( *pp_block == p_block );
- *pp_block = NULL;
+ assert( *pp_frame == p_frame );
+ *pp_frame = NULL;
}
- if( p_block != NULL )
- block_Release(p_block);
+ if( p_frame != NULL )
+ vlc_frame_Release(p_frame);
if( frame != NULL )
av_frame_free( &frame );
return (b_error) ? VLCDEC_ECRITICAL : VLCDEC_SUCCESS;
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- block_t **pp_block = p_block ? &p_block : NULL;
+ vlc_frame_t **pp_frame = p_frame ? &p_frame : NULL;
int i_ret;
do
{
- i_ret = DecodeBlock( p_dec, pp_block );
+ i_ret = DecodeFrame( p_dec, pp_frame );
}
- while( i_ret == VLCDEC_SUCCESS && pp_block && *pp_block );
+ while( i_ret == VLCDEC_SUCCESS && pp_frame && *pp_frame );
return i_ret;
}
-static block_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame )
+static vlc_frame_t * ConvertAVFrame( decoder_t *p_dec, AVFrame *frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *ctx = p_sys->p_context;
- block_t *p_block;
+ vlc_frame_t *p_frame;
/* Interleave audio if required */
if( av_sample_fmt_is_planar( ctx->sample_fmt ) )
{
- p_block = block_Alloc(frame->linesize[0] * ctx->channels);
- if ( likely(p_block) )
+ p_frame = vlc_frame_Alloc(frame->linesize[0] * ctx->channels);
+ if ( likely(p_frame) )
{
const void *planes[ctx->channels];
for (int i = 0; i < ctx->channels; i++)
planes[i] = frame->extended_data[i];
- aout_Interleave(p_block->p_buffer, planes, frame->nb_samples,
+ aout_Interleave(p_frame->p_buffer, planes, frame->nb_samples,
ctx->channels, p_dec->fmt_out.audio.i_format);
- p_block->i_nb_samples = frame->nb_samples;
+ p_frame->i_nb_samples = frame->nb_samples;
}
av_frame_free(&frame);
}
else
{
- p_block = vlc_av_frame_Wrap(frame);
+ p_frame = vlc_av_frame_Wrap(frame);
frame = NULL;
}
- if (p_sys->b_extract && p_block)
+ if (p_sys->b_extract && p_frame)
{ /* TODO: do not drop channels... at least not here */
- block_t *p_buffer = block_Alloc( p_dec->fmt_out.audio.i_bytes_per_frame
- * p_block->i_nb_samples );
+ vlc_frame_t *p_buffer = vlc_frame_Alloc( p_dec->fmt_out.audio.i_bytes_per_frame
+ * p_frame->i_nb_samples );
if( likely(p_buffer) )
{
aout_ChannelExtract( p_buffer->p_buffer,
p_dec->fmt_out.audio.i_channels,
- p_block->p_buffer, ctx->channels,
- p_block->i_nb_samples, p_sys->pi_extraction,
+ p_frame->p_buffer, ctx->channels,
+ p_frame->i_nb_samples, p_sys->pi_extraction,
p_dec->fmt_out.audio.i_bitspersample );
- p_buffer->i_nb_samples = p_block->i_nb_samples;
+ p_buffer->i_nb_samples = p_frame->i_nb_samples;
}
- block_Release( p_block );
- p_block = p_buffer;
+ vlc_frame_Release( p_frame );
+ p_frame = p_buffer;
}
- return p_block;
+ return p_frame;
}
/*****************************************************************************
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index cbac0d3394..ffb980f666 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -60,8 +60,8 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t *EncodeVideo( encoder_t *, picture_t * );
-static block_t *EncodeAudio( encoder_t *, block_t * );
+static vlc_frame_t *EncodeVideo( encoder_t *, picture_t * );
+static vlc_frame_t *EncodeAudio( encoder_t *, vlc_frame_t * );
struct thread_context_t;
@@ -1056,24 +1056,24 @@ error:
typedef struct
{
- block_t self;
+ vlc_frame_t self;
AVPacket packet;
} vlc_av_packet_t;
-static void vlc_av_packet_Release(block_t *block)
+static void vlc_av_packet_Release(vlc_frame_t *frame)
{
- vlc_av_packet_t *b = (void *) block;
+ vlc_av_packet_t *b = (void *) frame;
av_packet_unref(&b->packet);
free(b);
}
-static const struct vlc_block_callbacks vlc_av_packet_cbs =
+static const struct vlc_frame_callbacks vlc_av_packet_cbs =
{
vlc_av_packet_Release,
};
-static block_t *vlc_av_packet_Wrap(AVPacket *packet, vlc_tick_t i_length, AVCodecContext *context )
+static vlc_frame_t *vlc_av_packet_Wrap(AVPacket *packet, vlc_tick_t i_length, AVCodecContext *context )
{
if ( packet->data == NULL &&
packet->flags == 0 &&
@@ -1085,24 +1085,24 @@ static block_t *vlc_av_packet_Wrap(AVPacket *packet, vlc_tick_t i_length, AVCode
if( unlikely(b == NULL) )
return NULL;
- block_t *p_block = &b->self;
+ vlc_frame_t *p_frame = &b->self;
- block_Init( p_block, &vlc_av_packet_cbs, packet->data, packet->size );
- p_block->i_nb_samples = 0;
- p_block->cbs = &vlc_av_packet_cbs;
+ vlc_frame_Init( p_frame, &vlc_av_packet_cbs, packet->data, packet->size );
+ p_frame->i_nb_samples = 0;
+ p_frame->cbs = &vlc_av_packet_cbs;
b->packet = *packet;
- p_block->i_length = i_length;
- p_block->i_pts = FROM_AV_TS(packet->pts);
- p_block->i_dts = FROM_AV_TS(packet->dts);
+ p_frame->i_length = i_length;
+ p_frame->i_pts = FROM_AV_TS(packet->pts);
+ p_frame->i_dts = FROM_AV_TS(packet->dts);
if( unlikely( packet->flags & AV_PKT_FLAG_CORRUPT ) )
- p_block->i_flags |= BLOCK_FLAG_CORRUPTED;
+ p_frame->i_flags |= FRAME_FLAG_CORRUPTED;
if( packet->flags & AV_PKT_FLAG_KEY )
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
- p_block->i_pts = p_block->i_pts * CLOCK_FREQ * context->time_base.num / context->time_base.den;
- p_block->i_dts = p_block->i_dts * CLOCK_FREQ * context->time_base.num / context->time_base.den;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
+ p_frame->i_pts = p_frame->i_pts * CLOCK_FREQ * context->time_base.num / context->time_base.den;
+ p_frame->i_dts = p_frame->i_dts * CLOCK_FREQ * context->time_base.num / context->time_base.den;
- return p_block;
+ return p_frame;
}
static void check_hurry_up( encoder_sys_t *p_sys, AVFrame *frame, encoder_t *p_enc )
@@ -1137,7 +1137,7 @@ static void check_hurry_up( encoder_sys_t *p_sys, AVFrame *frame, encoder_t *p_e
}
}
-static block_t *encode_avframe( encoder_t *p_enc, encoder_sys_t *p_sys, AVFrame *frame )
+static vlc_frame_t *encode_avframe( encoder_t *p_enc, encoder_sys_t *p_sys, AVFrame *frame )
{
AVPacket av_pkt;
av_pkt.data = NULL;
@@ -1158,20 +1158,20 @@ static block_t *encode_avframe( encoder_t *p_enc, encoder_sys_t *p_sys, AVFrame
return NULL;
}
- block_t *p_block = vlc_av_packet_Wrap( &av_pkt,
+ vlc_frame_t *p_frame = vlc_av_packet_Wrap( &av_pkt,
av_pkt.duration / p_sys->p_context->time_base.den, p_sys->p_context );
- if( unlikely(p_block == NULL) )
+ if( unlikely(p_frame == NULL) )
{
av_packet_unref( &av_pkt );
return NULL;
}
- return p_block;
+ return p_frame;
}
/****************************************************************************
* EncodeVideo: the whole thing
****************************************************************************/
-static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
{
encoder_sys_t *p_sys = p_enc->p_sys;
int i_plane;
@@ -1232,36 +1232,36 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
frame->quality = p_sys->i_quality;
}
- block_t *p_block = encode_avframe( p_enc, p_sys, frame );
+ vlc_frame_t *p_frame = encode_avframe( p_enc, p_sys, frame );
- if( p_block )
+ if( p_frame )
{
switch ( p_sys->p_context->coded_frame->pict_type )
{
case AV_PICTURE_TYPE_I:
case AV_PICTURE_TYPE_SI:
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
break;
case AV_PICTURE_TYPE_P:
case AV_PICTURE_TYPE_SP:
- p_block->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_P;
break;
case AV_PICTURE_TYPE_B:
case AV_PICTURE_TYPE_BI:
- p_block->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_B;
break;
default:
- p_block->i_flags |= BLOCK_FLAG_TYPE_PB;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_PB;
}
}
- return p_block;
+ return p_frame;
}
-static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, unsigned int buffer_delay,
- block_t *p_aout_buf, size_t leftover_samples )
+static vlc_frame_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, unsigned int buffer_delay,
+ vlc_frame_t *p_aout_buf, size_t leftover_samples )
{
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
//How much we need to copy from new packet
const size_t leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
@@ -1317,19 +1317,19 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
p_sys->i_samples_delay = 0;
- p_block = encode_avframe( p_enc, p_sys, p_sys->frame );
+ p_frame = encode_avframe( p_enc, p_sys, p_sys->frame );
- return p_block;
+ return p_frame;
}
/****************************************************************************
* EncodeAudio: the whole thing
****************************************************************************/
-static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *EncodeAudio( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_block, *p_chain = NULL;
+ vlc_frame_t *p_frame, *p_chain = NULL;
size_t buffer_delay = 0, i_samples_left = 0;
@@ -1377,12 +1377,12 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
{
msg_Dbg(p_enc,"Flushing..");
do {
- p_block = encode_avframe( p_enc, p_sys, NULL );
- if( likely( p_block ) )
+ p_frame = encode_avframe( p_enc, p_sys, NULL );
+ if( likely( p_frame ) )
{
- block_ChainAppend( &p_chain, p_block );
+ vlc_frame_ChainAppend( &p_chain, p_frame );
}
- } while( p_block );
+ } while( p_frame );
return p_chain;
}
@@ -1436,9 +1436,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
if( likely(date_Get( &p_sys->buffer_date ) != VLC_TICK_INVALID) )
date_Increment( &p_sys->buffer_date, p_sys->frame->nb_samples );
- p_block = encode_avframe( p_enc, p_sys, p_sys->frame );
- if( likely( p_block ) )
- block_ChainAppend( &p_chain, p_block );
+ p_frame = encode_avframe( p_enc, p_sys, p_sys->frame );
+ if( likely( p_frame ) )
+ vlc_frame_ChainAppend( &p_chain, p_frame );
}
// We have leftover samples that don't fill frame_size, and libavcodec doesn't seem to like
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index a580d9874f..50db8949ed 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -46,7 +46,7 @@ typedef struct
static subpicture_t *ConvertSubtitle(decoder_t *, AVSubtitle *, vlc_tick_t pts,
AVCodecContext *avctx);
-static int DecodeSubtitle(decoder_t *, block_t *);
+static int DecodeSubtitle(decoder_t *, vlc_frame_t *);
static void Flush(decoder_t *);
/**
@@ -174,41 +174,41 @@ static void Flush(decoder_t *dec)
/**
* Decode one subtitle
*/
-static subpicture_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
+static subpicture_t *DecodeFrame(decoder_t *dec, vlc_frame_t **frame_ptr)
{
decoder_sys_t *sys = dec->p_sys;
- if (!block_ptr || !*block_ptr)
+ if (!frame_ptr || !*frame_ptr)
return NULL;
- block_t *block = *block_ptr;
+ vlc_frame_t *frame = *frame_ptr;
- if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED)) {
- if (block->i_flags & BLOCK_FLAG_CORRUPTED) {
+ if (frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED)) {
+ if (frame->i_flags & FRAME_FLAG_CORRUPTED) {
Flush(dec);
- block_Release(block);
+ vlc_frame_Release(frame);
return NULL;
}
}
- if (block->i_buffer <= 0) {
- block_Release(block);
+ if (frame->i_buffer <= 0) {
+ vlc_frame_Release(frame);
return NULL;
}
- *block_ptr =
- block = block_Realloc(block,
+ *frame_ptr =
+ frame = vlc_frame_Realloc(frame,
0,
- block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!block)
+ frame->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!frame)
return NULL;
- block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
- memset(&block->p_buffer[block->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ frame->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+ memset(&frame->p_buffer[frame->i_buffer], 0, FF_INPUT_BUFFER_PADDING_SIZE);
- if( sys->p_codec->id == AV_CODEC_ID_DVB_SUBTITLE && block->i_buffer > 3 )
+ if( sys->p_codec->id == AV_CODEC_ID_DVB_SUBTITLE && frame->i_buffer > 3 )
{
- block->p_buffer += 2; /* drop data identifier / stream id */
- block->i_buffer -= 3; /* drop 0x3F/FF */
+ frame->p_buffer += 2; /* drop data identifier / stream id */
+ frame->i_buffer -= 3; /* drop 0x3F/FF */
}
/* */
@@ -217,9 +217,9 @@ static subpicture_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
AVPacket pkt;
av_init_packet(&pkt);
- pkt.data = block->p_buffer;
- pkt.size = block->i_buffer;
- pkt.pts = TO_AV_TS(block->i_pts);
+ pkt.data = frame->p_buffer;
+ pkt.size = frame->i_buffer;
+ pkt.pts = TO_AV_TS(frame->i_pts);
int has_subtitle = 0;
int used = avcodec_decode_subtitle2(sys->p_context,
@@ -227,16 +227,16 @@ static subpicture_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
if (used < 0) {
msg_Warn(dec, "cannot decode one subtitle (%zu bytes)",
- block->i_buffer);
+ frame->i_buffer);
- block_Release(block);
+ vlc_frame_Release(frame);
return NULL;
- } else if ((size_t)used > block->i_buffer) {
- used = block->i_buffer;
+ } else if ((size_t)used > frame->i_buffer) {
+ used = frame->i_buffer;
}
- block->i_buffer -= used;
- block->p_buffer += used;
+ frame->i_buffer -= used;
+ frame->p_buffer += used;
/* */
subpicture_t *spu = NULL;
@@ -247,15 +247,15 @@ static subpicture_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
/* */
if (!spu)
- block_Release(block);
+ vlc_frame_Release(frame);
return spu;
}
-static int DecodeSubtitle(decoder_t *dec, block_t *block)
+static int DecodeSubtitle(decoder_t *dec, vlc_frame_t *frame)
{
- block_t **block_ptr = block ? &block : NULL;
+ vlc_frame_t **frame_ptr = frame ? &frame : NULL;
subpicture_t *spu;
- while ((spu = DecodeBlock(dec, block_ptr)) != NULL)
+ while ((spu = DecodeFrame(dec, frame_ptr)) != NULL)
decoder_QueueSub(dec, spu);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index cccc84d22f..0b85e901cb 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -127,7 +127,7 @@ static void ffmpeg_InitCodec ( decoder_t * );
static int lavc_GetFrame(struct AVCodecContext *, AVFrame *, int);
static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
const enum PixelFormat * );
-static int DecodeVideo( decoder_t *, block_t * );
+static int DecodeVideo( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
@@ -731,14 +731,14 @@ static void Flush( decoder_t *p_dec )
decoder_AbortPictures( p_dec, false );
}
-static block_t * filter_earlydropped_blocks( decoder_t *p_dec, block_t *block )
+static vlc_frame_t * filter_earlydropped_blocks( decoder_t *p_dec, vlc_frame_t *frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( !block )
+ if( !frame )
return NULL;
- if( block->i_flags & BLOCK_FLAG_PREROLL )
+ if( frame->i_flags & FRAME_FLAG_PREROLL )
{
/* Do not care about late frames when prerolling
* TODO avoid decoding of non reference frame
@@ -753,7 +753,7 @@ static block_t * filter_earlydropped_blocks( decoder_t *p_dec, block_t *block )
p_sys->framedrop = FRAMEDROP_NONE;
if( p_sys->framedrop == FRAMEDROP_NONE && p_sys->i_late_frames < 11 )
- return block;
+ return frame;
if( p_sys->i_last_output_frame >= 0 &&
p_sys->p_context->reordered_opaque - p_sys->i_last_output_frame > 24 )
@@ -764,20 +764,20 @@ static block_t * filter_earlydropped_blocks( decoder_t *p_dec, block_t *block )
/* A good idea could be to decode all I pictures and see for the other */
if( p_sys->framedrop == FRAMEDROP_AGGRESSIVE_RECOVER )
{
- if( !(block->i_flags & BLOCK_FLAG_TYPE_I) )
+ if( !(frame->i_flags & FRAME_FLAG_TYPE_I) )
{
msg_Err( p_dec, "more than %"PRId64" frames of late video -> "
"dropping frame (computer too slow ?)",
p_sys->p_context->reordered_opaque - p_sys->i_last_output_frame );
date_Set( &p_sys->pts, VLC_TICK_INVALID ); /* To make sure we recover properly */
- block_Release( block );
+ vlc_frame_Release( frame );
p_sys->i_late_frames--;
return NULL;
}
}
- return block;
+ return frame;
}
static vlc_tick_t interpolate_next_pts( decoder_t *p_dec, AVFrame *frame )
@@ -797,14 +797,14 @@ static vlc_tick_t interpolate_next_pts( decoder_t *p_dec, AVFrame *frame )
return date_Increment( &p_sys->pts, i_tick + frame->repeat_pict );
}
-static void update_late_frame_count( decoder_t *p_dec, block_t *p_block,
+static void update_late_frame_count( decoder_t *p_dec, vlc_frame_t *p_frame,
vlc_tick_t current_time, vlc_tick_t i_pts,
vlc_tick_t i_next_pts, int64_t i_fnum )
{
decoder_sys_t *p_sys = p_dec->p_sys;
/* Update frame late count (except when doing preroll) */
vlc_tick_t i_display_date = VLC_TICK_INVALID;
- if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+ if( !p_frame || !(p_frame->i_flags & FRAME_FLAG_PREROLL) )
i_display_date = decoder_GetDisplayDate( p_dec, current_time, i_pts );
vlc_tick_t i_threshold = i_next_pts != VLC_TICK_INVALID
@@ -970,7 +970,7 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
cc_Extract( &p_sys->cc, CC_PAYLOAD_RAW, true, p_avcc->data, p_avcc->size );
if( p_sys->cc.b_reorder || p_sys->cc.i_data )
{
- block_t *p_cc = block_Alloc( p_sys->cc.i_data );
+ vlc_frame_t *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 );
@@ -991,11 +991,11 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
}
/*****************************************************************************
- * DecodeBlock: Called to decode one or more frames
- * drains if pp_block == NULL
- * tries to output only if p_block == NULL
+ * DecodeFrame: Called to decode one or more frames
+ * drains if pp_frame == NULL
+ * tries to output only if p_frame == NULL
*****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *p_context = p_sys->p_context;
@@ -1003,7 +1003,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
bool b_need_output_picture = true;
bool b_error = false;
- block_t *p_block;
+ vlc_frame_t *p_frame;
if( !p_context->extradata_size && p_dec->fmt_in.i_extra )
{
@@ -1012,20 +1012,20 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
OpenVideoCodec( p_dec );
}
- p_block = pp_block ? *pp_block : NULL;
- if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
+ p_frame = pp_frame ? *pp_frame : NULL;
+ if(!p_frame && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
return VLCDEC_SUCCESS;
if( !avcodec_is_open( p_context ) )
{
- if( p_block )
- block_Release( p_block );
+ if( p_frame )
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
/* Defaults that if we aren't in prerolling, we want output picture
- same for if we are flushing (p_block==NULL) */
- if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+ same for if we are flushing (p_frame==NULL) */
+ if( !p_frame || !(p_frame->i_flags & FRAME_FLAG_PREROLL) )
b_need_output_picture = true;
else
b_need_output_picture = false;
@@ -1035,10 +1035,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
p_context->skip_frame = p_sys->i_skip_frame;
- /* Check also if we should/can drop the block and move to next block
+ /* Check also if we should/can drop the frame and move to next frame
as trying to catchup the speed*/
if( p_dec->b_frame_drop_allowed )
- p_block = filter_earlydropped_blocks( p_dec, p_block );
+ p_frame = filter_earlydropped_blocks( p_dec, p_frame );
}
if( !b_need_output_picture || p_sys->framedrop == FRAMEDROP_NONREF )
@@ -1051,19 +1051,19 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Don't forget that libavcodec requires a little more bytes
* that the real frame size */
- if( p_block && p_block->i_buffer > 0 )
+ if( p_frame && p_frame->i_buffer > 0 )
{
- p_block = block_Realloc( p_block, 0,
- p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
- if( !p_block )
+ p_frame = vlc_frame_Realloc( p_frame, 0,
+ p_frame->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
+ if( !p_frame )
return VLCDEC_SUCCESS;
- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
- *pp_block = p_block;
- memset( p_block->p_buffer + p_block->i_buffer, 0,
+ p_frame->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+ *pp_frame = p_frame;
+ memset( p_frame->p_buffer + p_frame->i_buffer, 0,
FF_INPUT_BUFFER_PADDING_SIZE );
}
- bool b_drain = ( pp_block == NULL );
+ bool b_drain = ( pp_frame == NULL );
bool b_drained = false;
do
@@ -1072,17 +1072,17 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
post_mt( p_sys );
- if( (p_block && p_block->i_buffer > 0) || b_drain )
+ if( (p_frame && p_frame->i_buffer > 0) || b_drain )
{
AVPacket pkt;
av_init_packet( &pkt );
- if( p_block && p_block->i_buffer > 0 )
+ if( p_frame && p_frame->i_buffer > 0 )
{
- pkt.data = p_block->p_buffer;
- pkt.size = p_block->i_buffer;
- pkt.pts = p_block->i_pts != VLC_TICK_INVALID ? TO_AV_TS(p_block->i_pts) : AV_NOPTS_VALUE;
- pkt.dts = p_block->i_dts != VLC_TICK_INVALID ? TO_AV_TS(p_block->i_dts) : AV_NOPTS_VALUE;
- if (p_block->i_flags & BLOCK_FLAG_TYPE_I)
+ pkt.data = p_frame->p_buffer;
+ pkt.size = p_frame->i_buffer;
+ pkt.pts = p_frame->i_pts != VLC_TICK_INVALID ? TO_AV_TS(p_frame->i_pts) : AV_NOPTS_VALUE;
+ pkt.dts = p_frame->i_dts != VLC_TICK_INVALID ? TO_AV_TS(p_frame->i_dts) : AV_NOPTS_VALUE;
+ if (p_frame->i_flags & FRAME_FLAG_TYPE_I)
pkt.flags |= AV_PKT_FLAG_KEY;
}
else
@@ -1104,10 +1104,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
/* Make sure we don't reuse the same timestamps twice */
- if( p_block )
+ if( p_frame )
{
- p_block->i_pts =
- p_block->i_dts = VLC_TICK_INVALID;
+ p_frame->i_pts =
+ p_frame->i_dts = VLC_TICK_INVALID;
}
int ret = avcodec_send_packet(p_context, &pkt);
@@ -1123,7 +1123,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
struct frame_info_s *p_frame_info = &p_sys->frame_info[p_context->reordered_opaque % FRAME_INFO_DEPTH];
- p_frame_info->b_eos = p_block && (p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE);
+ p_frame_info->b_eos = p_frame && (p_frame->i_flags & FRAME_FLAG_END_OF_SEQUENCE);
p_frame_info->b_display = b_need_output_picture;
p_context->reordered_opaque++;
@@ -1160,11 +1160,11 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
wait_mt( p_sys );
- if( p_block )
+ if( p_frame )
{
/* Consumed bytes */
- p_block->p_buffer += i_used;
- p_block->i_buffer -= i_used;
+ p_frame->p_buffer += i_used;
+ p_frame->i_buffer -= i_used;
}
/* Nothing to display */
@@ -1197,7 +1197,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
const vlc_tick_t i_next_pts = interpolate_next_pts(p_dec, frame);
- update_late_frame_count( p_dec, p_block, vlc_tick_now(), i_pts,
+ update_late_frame_count( p_dec, p_frame, vlc_tick_now(), i_pts,
i_next_pts, frame->reordered_opaque);
if( !p_frame_info->b_display ||
@@ -1322,23 +1322,23 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( b_drained )
avcodec_flush_buffers( p_sys->p_context );
- if( p_block )
- block_Release( p_block );
+ if( p_frame )
+ vlc_frame_Release( p_frame );
return b_error ? VLCDEC_ECRITICAL : VLCDEC_SUCCESS;
}
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t **pp_block = p_block ? &p_block : NULL /* drain signal */;
+ vlc_frame_t **pp_frame = p_frame ? &p_frame : NULL /* drain signal */;
- if( p_block &&
- p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame &&
+ p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
/* Drain */
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
- DecodeBlock( p_dec, NULL );
+ if( p_frame->i_flags & FRAME_FLAG_DISCONTINUITY )
+ DecodeFrame( p_dec, NULL );
p_sys->i_late_frames = 0;
p_sys->i_last_output_frame = -1;
p_sys->framedrop = FRAMEDROP_NONE;
@@ -1346,14 +1346,14 @@ static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
date_Set( &p_sys->pts, VLC_TICK_INVALID ); /* To make sure we recover properly */
cc_Flush( &p_sys->cc );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
- p_block = NULL; /* output only */
+ vlc_frame_Release( p_frame );
+ p_frame = NULL; /* output only */
}
}
- return DecodeBlock( p_dec, pp_block );
+ return DecodeFrame( p_dec, pp_frame );
}
/*****************************************************************************
diff --git a/modules/codec/bpg.c b/modules/codec/bpg.c
index 316b397e9e..5108e2fb69 100644
--- a/modules/codec/bpg.c
+++ b/modules/codec/bpg.c
@@ -37,7 +37,7 @@ typedef struct
static int OpenDecoder(vlc_object_t *);
static void CloseDecoder(vlc_object_t *);
-static int DecodeBlock(decoder_t *, block_t *);
+static int DecodeFrame(decoder_t *, vlc_frame_t *);
/*
* Module descriptor
@@ -77,7 +77,7 @@ static int OpenDecoder(vlc_object_t *p_this)
}
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
return VLC_SUCCESS;
}
@@ -85,25 +85,25 @@ static int OpenDecoder(vlc_object_t *p_this)
/*
* This function must be fed with a complete compressed frame.
*/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic = 0;
BPGImageInfo img_info;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
goto error;
/* Decode picture */
if( bpg_decoder_decode( p_sys->p_bpg,
- p_block->p_buffer,
- p_block->i_buffer ) < 0 )
+ p_frame->p_buffer,
+ p_frame->i_buffer ) < 0 )
{
- msg_Err( p_dec, "Could not decode block" );
+ msg_Err( p_dec, "Could not decode frame" );
goto error;
}
@@ -151,11 +151,11 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
- p_pic->date = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ p_pic->date = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
decoder_QueueVideo( p_dec, p_pic );
error:
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 1a0c8e568a..e3cda8d416 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -220,7 +220,7 @@ static void Eia608FillUpdaterRegions( subtext_updater_sys_t *p_updater,
typedef struct
{
int i_queue;
- block_t *p_queue;
+ vlc_frame_t *p_queue;
int i_field;
int i_channel;
@@ -234,7 +234,7 @@ typedef struct
bool b_opaque;
} decoder_sys_t;
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
static void DTVCC_ServiceData_Handler( void *priv, uint8_t i_sid, vlc_tick_t i_time,
@@ -334,7 +334,7 @@ static void Flush( decoder_t *p_dec )
CEA708_Decoder_Flush( p_sys->p_cea708 );
}
- block_ChainRelease( p_sys->p_queue );
+ vlc_frame_ChainRelease( p_sys->p_queue );
p_sys->p_queue = NULL;
p_sys->i_queue = 0;
}
@@ -344,30 +344,30 @@ static void Flush( decoder_t *p_dec )
****************************************************************************
*
****************************************************************************/
-static void Push( decoder_t *, block_t * );
-static block_t *Pop( decoder_t *, bool );
+static void Push( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Pop( decoder_t *, bool );
static void Convert( decoder_t *, vlc_tick_t, const uint8_t *, size_t );
static bool DoDecode( decoder_t *p_dec, bool b_drain )
{
- block_t *p_block = Pop( p_dec, b_drain );
- if( !p_block )
+ vlc_frame_t *p_frame = Pop( p_dec, b_drain );
+ if( !p_frame )
return false;
- Convert( p_dec, p_block->i_pts, p_block->p_buffer, p_block->i_buffer );
- block_Release( p_block );
+ Convert( p_dec, p_frame->i_pts, p_frame->p_buffer, p_frame->i_buffer );
+ vlc_frame_Release( p_frame );
return true;
}
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block )
+ if( p_frame )
{
/* Reset decoder if needed */
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
/* Drain */
for( ; DoDecode( p_dec, true ) ; );
@@ -381,9 +381,9 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
CEA708_Decoder_Flush( p_sys->p_cea708 );
}
- if( (p_block->i_flags & BLOCK_FLAG_CORRUPTED) || p_block->i_buffer < 1 )
+ if( (p_frame->i_flags & FRAME_FLAG_CORRUPTED) || p_frame->i_buffer < 1 )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
}
@@ -397,15 +397,15 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
{
/* Wait for a P and output all *previous* picture by pts order (for
* hierarchical B frames) */
- if( (p_block->i_flags & BLOCK_FLAG_TYPE_B) == 0 )
+ if( (p_frame->i_flags & FRAME_FLAG_TYPE_B) == 0 )
for( ; DoDecode( p_dec, true ); );
}
- Push( p_dec, p_block );
+ Push( p_dec, p_frame );
}
const bool b_no_reorder = (p_dec->fmt_in.subs.cc.i_reorder_depth < 0);
- for( ; DoDecode( p_dec, (p_block == NULL) || b_no_reorder ); );
+ for( ; DoDecode( p_dec, (p_frame == NULL) || b_no_reorder ); );
return VLCDEC_SUCCESS;
}
@@ -425,34 +425,34 @@ static void Close( vlc_object_t *p_this )
CEA708_DTVCC_Demuxer_Release( p_sys->p_dtvcc );
}
- block_ChainRelease( p_sys->p_queue );
+ vlc_frame_ChainRelease( p_sys->p_queue );
free( p_sys );
}
/*****************************************************************************
*
*****************************************************************************/
-static void Push( decoder_t *p_dec, block_t *p_block )
+static void Push( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->i_queue >= CC_MAX_REORDER_SIZE )
{
- block_Release( Pop( p_dec, true ) );
+ vlc_frame_Release( Pop( p_dec, true ) );
msg_Warn( p_dec, "Trashing a CC entry" );
}
- block_t **pp_block;
+ vlc_frame_t **pp_frame;
/* find insertion point */
- for( pp_block = &p_sys->p_queue; *pp_block ; pp_block = &((*pp_block)->p_next) )
+ for( pp_frame = &p_sys->p_queue; *pp_frame ; pp_frame = &((*pp_frame)->p_next) )
{
- if( p_block->i_pts == VLC_TICK_INVALID || (*pp_block)->i_pts == VLC_TICK_INVALID )
+ if( p_frame->i_pts == VLC_TICK_INVALID || (*pp_frame)->i_pts == VLC_TICK_INVALID )
continue;
- if( p_block->i_pts < (*pp_block)->i_pts )
+ if( p_frame->i_pts < (*pp_frame)->i_pts )
{
if( p_sys->i_reorder_depth > 0 &&
p_sys->i_queue < p_sys->i_reorder_depth &&
- pp_block == &p_sys->p_queue )
+ pp_frame == &p_sys->p_queue )
{
msg_Info( p_dec, "Increasing reorder depth to %d", ++p_sys->i_reorder_depth );
}
@@ -460,15 +460,15 @@ static void Push( decoder_t *p_dec, block_t *p_block )
}
}
/* Insert, keeping a pts and/or fifo ordered list */
- p_block->p_next = *pp_block ? *pp_block : NULL;
- *pp_block = p_block;
+ p_frame->p_next = *pp_frame ? *pp_frame : NULL;
+ *pp_frame = p_frame;
p_sys->i_queue++;
}
-static block_t *Pop( decoder_t *p_dec, bool b_forced )
+static vlc_frame_t *Pop( decoder_t *p_dec, bool b_forced )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
if( p_sys->i_queue == 0 )
return NULL;
@@ -480,12 +480,12 @@ static block_t *Pop( decoder_t *p_dec, bool b_forced )
}
/* dequeue head */
- p_block = p_sys->p_queue;
- p_sys->p_queue = p_block->p_next;
- p_block->p_next = NULL;
+ p_frame = p_sys->p_queue;
+ p_sys->p_queue = p_frame->p_next;
+ p_frame->p_next = NULL;
p_sys->i_queue--;
- return p_block;
+ return p_frame;
}
static subpicture_t *Subtitle( decoder_t *p_dec, eia608_t *h, vlc_tick_t i_pts )
diff --git a/modules/codec/cdg.c b/modules/codec/cdg.c
index 0fdfc56f9d..7e4c3733c5 100644
--- a/modules/codec/cdg.c
+++ b/modules/codec/cdg.c
@@ -72,7 +72,7 @@ typedef struct
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
static int DecodePacket( decoder_sys_t *p_cdg, uint8_t *p_buffer, int i_buffer );
static void Flush( decoder_t * );
@@ -143,30 +143,30 @@ static void Flush( decoder_t *p_dec )
****************************************************************************
* This function must be fed with a complete compressed frame.
****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic = NULL;
- if( !p_block ) /* No Drain */
+ if( !p_frame ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
Flush( p_dec );
goto exit;
}
/* Decode packet */
- while( p_block->i_buffer >= CDG_PACKET_SIZE )
+ while( p_frame->i_buffer >= CDG_PACKET_SIZE )
{
- DecodePacket( p_sys, p_block->p_buffer, CDG_PACKET_SIZE );
- p_block->i_buffer -= CDG_PACKET_SIZE;
- p_block->p_buffer += CDG_PACKET_SIZE;
+ DecodePacket( p_sys, p_frame->p_buffer, CDG_PACKET_SIZE );
+ p_frame->i_buffer -= CDG_PACKET_SIZE;
+ p_frame->p_buffer += CDG_PACKET_SIZE;
}
/* Only display 25 frame per second (there is 75 packets per second) */
- if( (p_sys->i_packet%3) == 1 && p_block->i_pts == p_block->i_dts )
+ if( (p_sys->i_packet%3) == 1 && p_frame->i_pts == p_frame->i_dts )
{
/* Get a new picture */
if( decoder_UpdateVideoFormat( p_dec ) )
@@ -176,11 +176,11 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
goto exit;
Render( p_sys, p_pic );
- p_pic->date = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ p_pic->date = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
}
exit:
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_pic != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
diff --git a/modules/codec/crystalhd.c b/modules/codec/crystalhd.c
index 98526e175c..656aec9492 100644
--- a/modules/codec/crystalhd.c
+++ b/modules/codec/crystalhd.c
@@ -96,7 +96,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeBlock ( decoder_t *p_dec, block_t *p_block );
+static int DecodeFrame ( decoder_t *p_dec, vlc_frame_t *p_frame );
// static void crystal_CopyPicture ( picture_t *, BC_DTS_PROC_OUT* );
static int crystal_insert_sps_pps(decoder_t *, uint8_t *, uint32_t);
@@ -349,7 +349,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
msg_Info( p_dec, "Opened CrystalHD hardware with success" );
return VLC_SUCCESS;
@@ -429,9 +429,9 @@ static BC_STATUS ourCallback(void *shnd, uint32_t width, uint32_t height, uint32
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -441,21 +441,21 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
/* First check the status of the decode to produce pictures */
if( BC_FUNC_PSYS(DtsGetDriverStatus)( p_sys->bcm_handle, &driver_stat ) != BC_STS_SUCCESS )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- if( p_block )
+ if( p_frame )
{
- if( ( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) ) == 0 )
+ if( ( p_frame->i_flags & (FRAME_FLAG_CORRUPTED) ) == 0 )
{
- /* Valid input block, so we can send to HW to decode */
+ /* Valid input frame, so we can send to HW to decode */
BC_STATUS status = BC_FUNC_PSYS(DtsProcInput)( p_sys->bcm_handle,
- p_block->p_buffer,
- p_block->i_buffer,
- p_block->i_pts != VLC_TICK_INVALID ? TO_BC_PTS(p_block->i_pts) : 0, false );
+ p_frame->p_buffer,
+ p_frame->i_buffer,
+ p_frame->i_pts != VLC_TICK_INVALID ? TO_BC_PTS(p_frame->i_pts) : 0, false );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( status != BC_STS_SUCCESS )
return VLCDEC_SUCCESS;
diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c
index c2dbfaeb84..c2f1305e14 100644
--- a/modules/codec/cvdsub.c
+++ b/modules/codec/cvdsub.c
@@ -61,13 +61,13 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int Decode( decoder_t *, block_t * );
-static block_t *Packetize ( decoder_t *, block_t ** );
-static block_t *Reassemble ( decoder_t *, block_t * );
-static void ParseMetaInfo ( decoder_t *, block_t * );
-static void ParseHeader ( decoder_t *, block_t * );
-static subpicture_t *DecodePacket( decoder_t *, block_t * );
-static void RenderImage( decoder_t *, block_t *, subpicture_region_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t *Reassemble ( decoder_t *, vlc_frame_t * );
+static void ParseMetaInfo ( decoder_t *, vlc_frame_t * );
+static void ParseHeader ( decoder_t *, vlc_frame_t * );
+static subpicture_t *DecodePacket( decoder_t *, vlc_frame_t * );
+static void RenderImage( decoder_t *, vlc_frame_t *, subpicture_region_t * );
#define SUBTITLE_BLOCK_EMPTY 0
#define SUBTITLE_BLOCK_PARTIAL 1
@@ -79,7 +79,7 @@ typedef struct
int i_state; /* data-gathering state for this subtitle */
- block_t *p_spu; /* Bytes of the packet. */
+ vlc_frame_t *p_spu; /* Bytes of the packet. */
size_t i_spu_size; /* goal for subtitle_data_pos while gathering,
size of used subtitle_data later */
@@ -157,32 +157,32 @@ void DecoderClose( 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_spu ) block_ChainRelease( p_sys->p_spu );
+ if( p_sys->p_spu ) vlc_frame_ChainRelease( p_sys->p_spu );
free( p_sys );
}
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- block_t *p_data;
+ vlc_frame_t *p_data;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
- if( !(p_data = Reassemble( p_dec, p_block )) )
+ if( !(p_data = Reassemble( p_dec, p_frame )) )
return VLCDEC_SUCCESS;
/* Parse and decode */
subpicture_t *p_spu = DecodePacket( p_dec, p_data );
- block_Release( p_data );
+ vlc_frame_Release( p_data );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -191,16 +191,16 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
/*****************************************************************************
* 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 )
{
- block_t *p_block, *p_spu;
+ vlc_frame_t *p_frame, *p_spu;
- if( pp_block == NULL || *pp_block == NULL ) return NULL;
+ if( pp_frame == NULL || *pp_frame == NULL ) return NULL;
- p_block = *pp_block;
- *pp_block = NULL;
+ p_frame = *pp_frame;
+ *pp_frame = NULL;
- if( !(p_spu = Reassemble( p_dec, p_block )) ) return NULL;
+ if( !(p_spu = Reassemble( p_dec, p_frame )) ) return NULL;
p_spu->i_dts = p_spu->i_pts;
p_spu->i_length = VLC_TICK_INVALID;
@@ -218,21 +218,21 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if this is the beginning, and combine the packets into one complete
subtitle unit.
- If everything is complete, we will return a block. Otherwise return
+ If everything is complete, we will return a frame. Otherwise return
NULL.
*****************************************************************************/
#define SPU_HEADER_LEN 1
-static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *Reassemble( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block->i_buffer < SPU_HEADER_LEN )
+ if( p_frame->i_buffer < SPU_HEADER_LEN )
{
msg_Dbg( p_dec, "invalid packet header (size %zu < %u)" ,
- p_block->i_buffer, SPU_HEADER_LEN );
- block_Release( p_block );
+ p_frame->i_buffer, SPU_HEADER_LEN );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -240,24 +240,24 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
* to detect the first packet in a subtitle. The first packet
* seems to have a valid PTS while later packets for the same
* image don't. */
- if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts == VLC_TICK_INVALID )
+ if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY && p_frame->i_pts == VLC_TICK_INVALID )
{
msg_Warn( p_dec, "first packet expected but no PTS present");
return NULL;
}
- p_block->p_buffer += SPU_HEADER_LEN;
- p_block->i_buffer -= SPU_HEADER_LEN;
+ p_frame->p_buffer += SPU_HEADER_LEN;
+ p_frame->i_buffer -= SPU_HEADER_LEN;
- /* First packet in the subtitle block */
- if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY ) ParseHeader( p_dec, p_block );
+ /* First packet in the subtitle frame */
+ if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY ) ParseHeader( p_dec, p_frame );
- block_ChainAppend( &p_sys->p_spu, p_block );
- p_sys->p_spu = block_ChainGather( p_sys->p_spu );
+ vlc_frame_ChainAppend( &p_sys->p_spu, p_frame );
+ p_sys->p_spu = vlc_frame_ChainGather( p_sys->p_spu );
if( p_sys->p_spu->i_buffer >= p_sys->i_spu_size )
{
- block_t *p_spu = p_sys->p_spu;
+ vlc_frame_t *p_spu = p_sys->p_spu;
if( p_spu->i_buffer != p_sys->i_spu_size )
{
@@ -308,10 +308,10 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
this, so it may be untested.
*/
-static void ParseHeader( decoder_t *p_dec, block_t *p_block )
+static void ParseHeader( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- uint8_t *p = p_block->p_buffer;
+ uint8_t *p = p_frame->p_buffer;
p_sys->i_spu_size = (p[0] << 8) + p[1] + 4; p += 2;
@@ -340,9 +340,9 @@ static void ParseHeader( decoder_t *p_dec, block_t *p_block )
#define ExtractXY(x, y) x = ((p[1]&0x0f)<<6) + (p[2]>>2); \
y = ((p[2]&0x03)<<8) + p[3];
-static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu )
+static void ParseMetaInfo( decoder_t *p_dec, vlc_frame_t *p_spu )
{
- /* Last packet in subtitle block. */
+ /* Last packet in subtitle frame. */
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t *p = p_spu->p_buffer + p_sys->metadata_offset;
@@ -503,7 +503,7 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu )
* This function parses and decodes an SPU packet and, if valid, returns a
* subpicture.
*****************************************************************************/
-static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
+static subpicture_t *DecodePacket( decoder_t *p_dec, vlc_frame_t *p_data )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu;
@@ -578,7 +578,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
a 4-bit alpha (filling 8 bits), and 8-bit y, u, and v entry.
*****************************************************************************/
-static void RenderImage( decoder_t *p_dec, block_t *p_data,
+static void RenderImage( decoder_t *p_dec, vlc_frame_t *p_data,
subpicture_region_t *p_region )
{
decoder_sys_t *p_sys = p_dec->p_sys;
diff --git a/modules/codec/daala.c b/modules/codec/daala.c
index df28ac21ec..b740e8c72a 100644
--- a/modules/codec/daala.c
+++ b/modules/codec/daala.c
@@ -80,10 +80,10 @@ static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block );
-static block_t *Packetize ( decoder_t *, block_t ** );
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
static int ProcessHeaders( decoder_t * );
-static void *ProcessPacket ( decoder_t *, daala_packet *, block_t * );
+static void *ProcessPacket ( decoder_t *, daala_packet *, vlc_frame_t * );
static picture_t *DecodePacket( decoder_t *, daala_packet * );
@@ -93,7 +93,7 @@ static void daala_CopyPicture( picture_t *, daala_image * );
#ifdef ENABLE_SOUT
static int OpenEncoder( vlc_object_t *p_this );
static void CloseEncoder( vlc_object_t *p_this );
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict );
static const char *const enc_chromafmt_list[] = {
"420", "444"
@@ -208,19 +208,19 @@ static int OpenPacketizer( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with Daala packets.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static void *DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
daala_packet dpacket;
/* Block to Daala packet */
- dpacket.packet = p_block->p_buffer;
- dpacket.bytes = p_block->i_buffer;
- dpacket.granulepos = p_block->i_dts;
+ dpacket.packet = p_frame->p_buffer;
+ dpacket.bytes = p_frame->i_buffer;
+ dpacket.granulepos = p_frame->i_dts;
dpacket.b_o_s = 0;
dpacket.e_o_s = 0;
dpacket.packetno = 0;
@@ -230,7 +230,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
if( ProcessHeaders( p_dec ) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
p_sys->b_has_headers = true;
@@ -242,30 +242,30 @@ static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
* using a timed URL, such that the server doesn't start the video with a
* keyframe). */
if( !p_sys->b_decoded_first_keyframe )
- p_block->i_flags |= BLOCK_FLAG_PREROLL; /* Wait until we've decoded the first keyframe */
+ p_frame->i_flags |= FRAME_FLAG_PREROLL; /* Wait until we've decoded the first keyframe */
- return ProcessPacket( p_dec, &dpacket, p_block );
+ return ProcessPacket( p_dec, &dpacket, p_frame );
}
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- picture_t *p_pic = DecodeBlock( p_dec, p_block );
+ picture_t *p_pic = DecodeFrame( p_dec, p_frame );
if( p_pic != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block; *pp_block = NULL;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame; *pp_frame = NULL;
+ if( p_frame == NULL )
return NULL;
- return DecodeBlock( p_dec, p_block );
+ return DecodeFrame( p_dec, p_frame );
}
/*****************************************************************************
@@ -415,39 +415,39 @@ cleanup:
* ProcessPacket: processes a daala packet.
*****************************************************************************/
static void *ProcessPacket( decoder_t *p_dec, daala_packet *p_dpacket,
- block_t *p_block )
+ vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
void *p_buf;
- if( ( p_block->i_flags&(BLOCK_FLAG_CORRUPTED) ) != 0 )
+ if( ( p_frame->i_flags&(FRAME_FLAG_CORRUPTED) ) != 0 )
{
/* Don't send the the first packet after a discontinuity to
* daala_decode, otherwise we get purple/green display artifacts
* appearing in the video output */
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
/* Date management */
- if( p_block->i_pts != VLC_TICK_INVALID && p_block->i_pts != p_sys->i_pts )
+ if( p_frame->i_pts != VLC_TICK_INVALID && p_frame->i_pts != p_sys->i_pts )
{
- p_sys->i_pts = p_block->i_pts;
+ p_sys->i_pts = p_frame->i_pts;
}
if( p_sys->b_packetizer )
{
/* Date management */
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
- p_block->i_length = p_sys->i_pts - p_block->i_pts;
+ p_frame->i_length = p_sys->i_pts - p_frame->i_pts;
- p_buf = p_block;
+ p_buf = p_frame;
}
else
{
p_buf = DecodePacket( p_dec, p_dpacket );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
}
/* Date management */
@@ -715,11 +715,11 @@ static int OpenEncoder( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict )
{
encoder_sys_t *p_sys = p_enc->p_sys;
daala_packet dpacket;
- block_t *p_block;
+ vlc_frame_t *p_frame;
daala_image img;
if( !p_pict ) return NULL;
@@ -762,15 +762,15 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
daala_encode_packet_out( p_sys->dcx, 0, &dpacket );
- /* Daala packet to block */
- p_block = block_Alloc( dpacket.bytes );
- memcpy( p_block->p_buffer, dpacket.packet, dpacket.bytes );
- p_block->i_dts = p_block->i_pts = p_pict->date;
+ /* Daala packet to frame */
+ p_frame = vlc_frame_Alloc( dpacket.bytes );
+ memcpy( p_frame->p_buffer, dpacket.packet, dpacket.bytes );
+ p_frame->i_dts = p_frame->i_pts = p_pict->date;
if( daala_packet_iskeyframe( &dpacket ) )
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
- return p_block;
+ return p_frame;
}
static void CloseEncoder( vlc_object_t *p_this )
diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
index eb47d17f8a..1b1acde339 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -178,23 +178,23 @@ static void FlushDecoder(decoder_t *dec)
dav1d_flush(p_sys->c);
}
-static void release_block(const uint8_t *buf, void *b)
+static void release_frame(const uint8_t *buf, void *b)
{
VLC_UNUSED(buf);
- block_t *block = b;
- block_Release(block);
+ vlc_frame_t *frame = b;
+ vlc_frame_Release(frame);
}
/****************************************************************************
* Decode: the whole thing
****************************************************************************/
-static int Decode(decoder_t *dec, block_t *block)
+static int Decode(decoder_t *dec, vlc_frame_t *frame)
{
decoder_sys_t *p_sys = dec->p_sys;
- if (block && block->i_flags & (BLOCK_FLAG_CORRUPTED))
+ if (frame && frame->i_flags & (FRAME_FLAG_CORRUPTED))
{
- block_Release(block);
+ vlc_frame_Release(frame);
return VLCDEC_SUCCESS;
}
@@ -202,18 +202,18 @@ static int Decode(decoder_t *dec, block_t *block)
Dav1dData data;
Dav1dData *p_data = NULL;
- if (block)
+ if (frame)
{
p_data = &data;
- if (unlikely(dav1d_data_wrap(&data, block->p_buffer, block->i_buffer,
- release_block, block) != 0))
+ if (unlikely(dav1d_data_wrap(&data, frame->p_buffer, frame->i_buffer,
+ release_frame, frame) != 0))
{
- block_Release(block);
+ vlc_frame_Release(frame);
return VLCDEC_ECRITICAL;
}
- vlc_tick_t pts = block->i_pts == VLC_TICK_INVALID ? block->i_dts : block->i_pts;
+ vlc_tick_t pts = frame->i_pts == VLC_TICK_INVALID ? frame->i_dts : frame->i_pts;
p_data->m.timestamp = pts;
- b_eos = (block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE);
+ b_eos = (frame->i_flags & FRAME_FLAG_END_OF_SEQUENCE);
}
Dav1dPicture img = { 0 };
diff --git a/modules/codec/dca.c b/modules/codec/dca.c
index 91d286b0cd..1668bb3beb 100644
--- a/modules/codec/dca.c
+++ b/modules/codec/dca.c
@@ -40,7 +40,7 @@
#include <dca.h> /* libdca header file */
#include <vlc_aout.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_codec.h>
static int Open ( vlc_object_t * );
@@ -107,7 +107,7 @@ static void Duplicate( float * p_out, const float * p_in )
}
}
-static int Decode( decoder_t *p_dec, block_t *p_in_buf )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_in_buf )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -118,7 +118,7 @@ static int Decode( decoder_t *p_dec, block_t *p_in_buf )
int i_flags = p_sys->i_flags;
size_t i_bytes_per_block = 256 * p_sys->i_nb_channels * sizeof(float);
- block_t *p_out_buf = block_Alloc( 6 * i_bytes_per_block );
+ vlc_frame_t *p_out_buf = vlc_frame_Alloc( 6 * i_bytes_per_block );
if( unlikely(p_out_buf == NULL) )
goto out;
@@ -187,7 +187,7 @@ static int Decode( decoder_t *p_dec, block_t *p_in_buf )
out:
if (p_out_buf != NULL)
decoder_QueueAudio(p_dec, p_out_buf);
- block_Release( p_in_buf );
+ vlc_frame_Release( p_in_buf );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/ddummy.c b/modules/codec/ddummy.c
index 7df04deb2f..501fab68c7 100644
--- a/modules/codec/ddummy.c
+++ b/modules/codec/ddummy.c
@@ -79,7 +79,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block );
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame );
/*****************************************************************************
* OpenDecoder: Open the decoder
@@ -108,7 +108,7 @@ static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump )
p_dec->p_sys = NULL;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
@@ -130,20 +130,20 @@ static int OpenDecoderDump( vlc_object_t *p_this )
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
FILE *stream = (void *)p_dec->p_sys;
- if( !p_block ) return VLCDEC_SUCCESS;
+ if( !p_frame ) return VLCDEC_SUCCESS;
if( stream != NULL
- && p_block->i_buffer > 0
- && !(p_block->i_flags & (BLOCK_FLAG_CORRUPTED)) )
+ && p_frame->i_buffer > 0
+ && !(p_frame->i_flags & (FRAME_FLAG_CORRUPTED)) )
{
- fwrite( p_block->p_buffer, 1, p_block->i_buffer, stream );
- msg_Dbg( p_dec, "dumped %zu bytes", p_block->i_buffer );
+ fwrite( p_frame->p_buffer, 1, p_frame->i_buffer, stream );
+ msg_Dbg( p_dec, "dumped %zu bytes", p_frame->i_buffer );
}
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/dmo/buffer.c b/modules/codec/dmo/buffer.c
index c64c8b6e3c..26e7611ea6 100644
--- a/modules/codec/dmo/buffer.c
+++ b/modules/codec/dmo/buffer.c
@@ -76,7 +76,7 @@ static long STDCALL Release( IUnknown *This )
if( p_mb->i_ref == 0 )
{
- if( p_mb->b_own ) block_Release( p_mb->p_block );
+ if( p_mb->b_own ) vlc_frame_Release( p_mb->p_frame );
free( p_mb->vt );
free( p_mb );
}
@@ -88,7 +88,7 @@ static long STDCALL SetLength( IMediaBuffer *This, uint32_t cbLength )
{
CMediaBuffer *p_mb = (CMediaBuffer *)This;
if( cbLength > (uint32_t)p_mb->i_max_size ) return E_INVALIDARG;
- p_mb->p_block->i_buffer = cbLength;
+ p_mb->p_frame->i_buffer = cbLength;
return S_OK;
}
@@ -106,12 +106,12 @@ static long STDCALL GetBufferAndLength( IMediaBuffer *This,
CMediaBuffer *p_mb = (CMediaBuffer *)This;
if( !ppBuffer && !pcbLength ) return E_POINTER;
- if( ppBuffer ) *ppBuffer = (char*)p_mb->p_block->p_buffer;
- if( pcbLength ) *pcbLength = p_mb->p_block->i_buffer;
+ if( ppBuffer ) *ppBuffer = (char*)p_mb->p_frame->p_buffer;
+ if( pcbLength ) *pcbLength = p_mb->p_frame->i_buffer;
return S_OK;
}
-CMediaBuffer *CMediaBufferCreate( block_t *p_block, int i_max_size,
+CMediaBuffer *CMediaBufferCreate( vlc_frame_t *p_frame, int i_max_size,
bool b_own )
{
CMediaBuffer *p_mb = (CMediaBuffer *)malloc( sizeof(CMediaBuffer) );
@@ -125,7 +125,7 @@ CMediaBuffer *CMediaBufferCreate( block_t *p_block, int i_max_size,
}
p_mb->i_ref = 1;
- p_mb->p_block = p_block;
+ p_mb->p_frame = p_frame;
p_mb->i_max_size = i_max_size;
p_mb->b_own = b_own;
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 38fb03ce9c..e12fce48ee 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -54,11 +54,11 @@ typedef long (STDCALL *GETCLASS) ( const GUID*, const GUID*, void** );
*****************************************************************************/
static int DecoderOpen ( vlc_object_t * );
static void DecoderClose ( vlc_object_t * );
-static int DecodeBlock ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
static void *DecoderThread( void * );
static int EncoderOpen ( vlc_object_t * );
static void EncoderClose ( vlc_object_t * );
-static block_t *EncodeBlock( encoder_t *, void * );
+static vlc_frame_t *EncodeFrame( encoder_t *, void * );
static int EncOpen ( vlc_object_t * );
@@ -108,7 +108,7 @@ typedef struct
vlc_mutex_t lock;
vlc_cond_t wait_input, wait_output;
bool b_ready, b_works;
- block_t *p_input;
+ vlc_frame_t *p_input;
} decoder_sys_t;
const GUID IID_IWMCodecPrivateData = {0x73f0be8e, 0x57f7, 0x4f01, {0xaa, 0x66, 0x9f, 0x57, 0x34, 0xc, 0xfe, 0xe}};
@@ -250,7 +250,7 @@ found:
return VLC_ENOMEM;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
vlc_mutex_init( &p_sys->lock );
vlc_cond_init( &p_sys->wait_input );
@@ -300,17 +300,17 @@ static void DecoderClose( vlc_object_t *p_this )
free( p_sys );
}
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
vlc_mutex_lock( &p_sys->lock );
while( p_sys->p_input )
vlc_cond_wait( &p_sys->wait_output, &p_sys->lock );
- p_sys->p_input = p_block;
+ p_sys->p_input = p_frame;
vlc_cond_signal( &p_sys->wait_input );
vlc_mutex_unlock( &p_sys->lock );
@@ -797,49 +797,49 @@ static void DecClose( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with packets.
****************************************************************************/
-static int DecBlock( decoder_t *p_dec, block_t **pp_block )
+static int DecFrame( 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;
int i_result;
DMO_OUTPUT_DATA_BUFFER db;
CMediaBuffer *p_out;
- block_t block_out;
+ vlc_frame_t frame_out;
uint32_t i_status;
- p_block = *pp_block;
+ p_frame = *pp_frame;
/* Won't work with streams with B-frames, but do we have any ? */
- if( p_block && p_block->i_pts == VLC_TICK_INVALID )
- p_block->i_pts = p_block->i_dts;
+ if( p_frame && p_frame->i_pts == VLC_TICK_INVALID )
+ p_frame->i_pts = p_frame->i_dts;
/* Date management */
- if( p_block && p_block->i_pts != VLC_TICK_INVALID &&
- p_block->i_pts != date_Get( &p_sys->end_date ) )
+ if( p_frame && p_frame->i_pts != VLC_TICK_INVALID &&
+ p_frame->i_pts != date_Get( &p_sys->end_date ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
#if 0 /* Breaks the video decoding */
if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
- if( p_block ) block_Release( p_block );
+ if( p_frame ) vlc_frame_Release( p_frame );
return -1;
}
#endif
/* Feed input to the DMO */
- if( p_block && p_block->i_buffer )
+ if( p_frame && p_frame->i_buffer )
{
CMediaBuffer *p_in;
- p_in = CMediaBufferCreate( p_block, p_block->i_buffer, true );
+ p_in = CMediaBufferCreate( p_frame, p_frame->i_buffer, true );
i_result = p_sys->p_dmo->vt->ProcessInput( p_sys->p_dmo, 0,
(IMediaBuffer *)p_in, DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
@@ -870,16 +870,16 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
#ifdef DMO_DEBUG
msg_Dbg( p_dec, "ProcessInput(): successful" );
#endif
- block_Release( p_block );
- *pp_block = NULL;
+ vlc_frame_Release( p_frame );
+ *pp_frame = NULL;
}
}
/* Get output from the DMO */
- block_out.p_buffer = p_sys->p_buffer;
- block_out.i_buffer = 0;
+ frame_out.p_buffer = p_sys->p_buffer;
+ frame_out.i_buffer = 0;
- p_out = CMediaBufferCreate( &block_out, p_sys->i_min_output, false );
+ p_out = CMediaBufferCreate( &frame_out, p_sys->i_min_output, false );
memset( &db, 0, sizeof(db) );
db.pBuffer = (IMediaBuffer *)p_out;
@@ -904,7 +904,7 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "ProcessOutput(): success" );
#endif
- if( !block_out.i_buffer )
+ if( !frame_out.i_buffer )
{
#ifdef DMO_DEBUG
msg_Dbg( p_dec, "ProcessOutput(): no output (i_buffer_out == 0)" );
@@ -921,7 +921,7 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
picture_t *p_pic = decoder_NewPicture( p_dec );
if( !p_pic ) return -1;
- CopyPicture( p_pic, block_out.p_buffer );
+ CopyPicture( p_pic, frame_out.p_buffer );
/* Date management */
p_pic->date = date_Get( &p_sys->end_date );
@@ -940,8 +940,8 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
return -1;
}
- block_t *p_aout_buffer;
- int i_samples = block_out.i_buffer /
+ vlc_frame_t *p_aout_buffer;
+ int i_samples = frame_out.i_buffer /
( p_dec->fmt_out.audio.i_bitspersample *
p_dec->fmt_out.audio.i_channels / 8 );
@@ -949,7 +949,7 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
if( p_aout_buffer )
{
memcpy( p_aout_buffer->p_buffer,
- block_out.p_buffer, block_out.i_buffer );
+ frame_out.p_buffer, frame_out.i_buffer );
/* Date management */
p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
p_aout_buffer->i_length =
@@ -1003,10 +1003,10 @@ static void *DecoderThread( void *data )
if( !p_sys->b_ready )
break;
- while( DecBlock( p_dec, &p_sys->p_input ) == 0 );
+ while( DecFrame( p_dec, &p_sys->p_input ) == 0 );
if( p_sys->p_input != NULL )
- block_Release( p_sys->p_input );
+ vlc_frame_Release( p_sys->p_input );
p_sys->p_input = NULL;
vlc_cond_signal( &p_sys->wait_output );
@@ -1043,10 +1043,10 @@ static int EncoderOpen( vlc_object_t *p_this )
if( i_ret != VLC_SUCCESS ) return i_ret;
/* Set callbacks */
- p_enc->pf_encode_video = (block_t *(*)(encoder_t *, picture_t *))
- EncodeBlock;
- p_enc->pf_encode_audio = (block_t *(*)(encoder_t *, block_t *))
- EncodeBlock;
+ p_enc->pf_encode_video = (vlc_frame_t *(*)(encoder_t *, picture_t *))
+ EncodeFrame;
+ p_enc->pf_encode_audio = (vlc_frame_t *(*)(encoder_t *, vlc_frame_t *))
+ EncodeFrame;
return VLC_SUCCESS;
}
@@ -1441,12 +1441,12 @@ static int EncOpen( vlc_object_t *p_this )
/****************************************************************************
* Encode: the whole thing
****************************************************************************/
-static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
+static vlc_frame_t *EncodeFrame( encoder_t *p_enc, void *p_data )
{
encoder_sys_t *p_sys = p_enc->p_sys;
CMediaBuffer *p_in;
- block_t *p_chain = NULL;
- block_t *p_block_in;
+ vlc_frame_t *p_chain = NULL;
+ vlc_frame_t *p_frame_in;
uint32_t i_status;
int i_result;
vlc_tick_t i_pts;
@@ -1464,10 +1464,10 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
p_enc->fmt_in.video.i_visible_height *
p_enc->fmt_in.video.i_bits_per_pixel / 8;
- p_block_in = block_Alloc( i_buffer );
+ p_frame_in = vlc_frame_Alloc( i_buffer );
/* Copy picture stride by stride */
- p_dst = p_block_in->p_buffer;
+ p_dst = p_frame_in->p_buffer;
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
uint8_t *p_src = p_pic->p[i_plane].p_pixels;
@@ -1487,16 +1487,16 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
}
else
{
- block_t *p_aout_buffer = (block_t *)p_data;
- p_block_in = block_Alloc( p_aout_buffer->i_buffer );
- memcpy( p_block_in->p_buffer, p_aout_buffer->p_buffer,
- p_block_in->i_buffer );
+ vlc_frame_t *p_aout_buffer = (vlc_frame_t *)p_data;
+ p_frame_in = vlc_frame_Alloc( p_aout_buffer->i_buffer );
+ memcpy( p_frame_in->p_buffer, p_aout_buffer->p_buffer,
+ p_frame_in->i_buffer );
i_pts = p_aout_buffer->i_pts;
}
/* Feed input to the DMO */
- p_in = CMediaBufferCreate( p_block_in, p_block_in->i_buffer, true );
+ p_in = CMediaBufferCreate( p_frame_in, p_frame_in->i_buffer, true );
i_result = p_sys->p_dmo->vt->ProcessInput( p_sys->p_dmo, 0,
(IMediaBuffer *)p_in, DMO_INPUT_DATA_BUFFERF_TIME, MSFTIME_FROM_VLC_TICK(i_pts), 0 );
@@ -1528,12 +1528,12 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
while( 1 )
{
DMO_OUTPUT_DATA_BUFFER db;
- block_t *p_block_out;
+ vlc_frame_t *p_frame_out;
CMediaBuffer *p_out;
- p_block_out = block_Alloc( p_sys->i_min_output );
- p_block_out->i_buffer = 0;
- p_out = CMediaBufferCreate(p_block_out, p_sys->i_min_output, false);
+ p_frame_out = vlc_frame_Alloc( p_sys->i_min_output );
+ p_frame_out->i_buffer = 0;
+ p_out = CMediaBufferCreate(p_frame_out, p_sys->i_min_output, false);
memset( &db, 0, sizeof(db) );
db.pBuffer = (IMediaBuffer *)p_out;
@@ -1550,17 +1550,17 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
#endif
p_out->vt->Release( (IUnknown *)p_out );
- block_Release( p_block_out );
+ vlc_frame_Release( p_frame_out );
return p_chain;
}
- if( !p_block_out->i_buffer )
+ if( !p_frame_out->i_buffer )
{
#ifdef DMO_DEBUG
msg_Dbg( p_enc, "ProcessOutput(): no output (i_buffer_out == 0)" );
#endif
p_out->vt->Release( (IUnknown *)p_out );
- block_Release( p_block_out );
+ vlc_frame_Release( p_frame_out );
return p_chain;
}
@@ -1575,23 +1575,23 @@ static block_t *EncodeBlock( encoder_t *p_enc, void *p_data )
if( db.dwStatus & DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH )
{
- p_block_out->i_length = VLC_TICK_FROM_MSFTIME(db.rtTimelength);
+ p_frame_out->i_length = VLC_TICK_FROM_MSFTIME(db.rtTimelength);
#ifdef DMO_DEBUG
msg_Dbg( p_enc, "ProcessOutput(): length: %"PRId64,
- p_block_out->i_length );
+ p_frame_out->i_length );
#endif
}
if( p_enc->fmt_out.i_cat == VIDEO_ES )
{
if( db.dwStatus & DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT )
- p_block_out->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame_out->i_flags |= FRAME_FLAG_TYPE_I;
else
- p_block_out->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frame_out->i_flags |= FRAME_FLAG_TYPE_P;
}
- p_block_out->i_dts = p_block_out->i_pts = i_pts;
- block_ChainAppend( &p_chain, p_block_out );
+ p_frame_out->i_dts = p_frame_out->i_pts = i_pts;
+ vlc_frame_ChainAppend( &p_chain, p_frame_out );
}
}
diff --git a/modules/codec/dmo/dmo.h b/modules/codec/dmo/dmo.h
index 60e6f6cc69..940760b5c6 100644
--- a/modules/codec/dmo/dmo.h
+++ b/modules/codec/dmo/dmo.h
@@ -276,7 +276,7 @@ typedef struct IMediaObject_vt
uint32_t cOutputBufferCount,
DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
uint32_t *pdwStatus);
- long (STDCALL *Lock)(IMediaObject *This, long bLock);
+ long (STDCALL *Lock)(IMediaObject *This, long frame);
} IMediaObject_vt;
struct _IMediaObject { IMediaObject_vt* vt; };
@@ -286,10 +286,10 @@ typedef struct _CMediaBuffer
{
IMediaBuffer_vt *vt;
int i_ref;
- block_t *p_block;
+ vlc_frame_t *p_frame;
int i_max_size;
bool b_own;
} CMediaBuffer;
-CMediaBuffer *CMediaBufferCreate( block_t *, int, bool );
+CMediaBuffer *CMediaBufferCreate( vlc_frame_t *, int, bool );
diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c
index b464314af3..6c6e600a94 100644
--- a/modules/codec/dvbsub.c
+++ b/modules/codec/dvbsub.c
@@ -106,13 +106,13 @@ static const char *const ppsz_pos_descriptions[] =
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
#ifdef ENABLE_SOUT
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder( vlc_object_t * );
-static block_t *Encode ( encoder_t *, subpicture_t * );
+static vlc_frame_t *Encode ( encoder_t *, subpicture_t * );
#endif
vlc_module_begin ()
@@ -402,29 +402,29 @@ static void Flush( decoder_t *p_dec )
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
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 VLCDEC_SUCCESS;
}
}
/* configure for SD res in case DDS is not present */
/* a change of PTS is a good indication we must get a new DDS */
- if( p_sys->i_pts != p_block->i_pts )
+ if( p_sys->i_pts != p_frame->i_pts )
default_dds_init( p_dec );
- p_sys->i_pts = p_block->i_pts;
+ p_sys->i_pts = p_frame->i_pts;
if( p_sys->i_pts == VLC_TICK_INVALID )
{
#ifdef DEBUG_DVBSUB
@@ -432,23 +432,23 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
* don't complain too loudly. */
msg_Warn( p_dec, "non dated subtitle" );
#endif
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- bs_init( &p_sys->bs, p_block->p_buffer, p_block->i_buffer );
+ bs_init( &p_sys->bs, p_frame->p_buffer, p_frame->i_buffer );
if( bs_read( &p_sys->bs, 8 ) != 0x20 ) /* Data identifier */
{
msg_Dbg( p_dec, "invalid data identifier" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
if( bs_read( &p_sys->bs, 8 ) ) /* Subtitle stream id */
{
msg_Dbg( p_dec, "invalid subtitle stream id" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -468,7 +468,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
if( ( i_sync_byte & 0x3f ) != 0x3f ) /* End marker */
{
msg_Warn( p_dec, "end marker not found (corrupted subtitle ?)" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -480,7 +480,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
decoder_QueueSub( p_dec, p_spu );
}
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -1938,12 +1938,12 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
/****************************************************************************
* Encode: the whole thing
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
+static vlc_frame_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
{
subpicture_t *p_temp = NULL;
subpicture_region_t *p_region = NULL;
bs_t bits, *s = &bits;
- block_t *p_block;
+ vlc_frame_t *p_frame;
if( !p_subpic || !p_subpic->p_region ) return NULL;
@@ -1992,8 +1992,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
#ifdef DEBUG_DVBSUB
msg_Dbg( p_enc, "encoding subpicture" );
#endif
- p_block = block_Alloc( 64000 );
- bs_init( s, p_block->p_buffer, p_block->i_buffer );
+ p_frame = vlc_frame_Alloc( 64000 );
+ bs_init( s, p_frame->p_buffer, p_frame->i_buffer );
bs_write( s, 8, 0x20 ); /* Data identifier */
bs_write( s, 8, 0x0 ); /* Subtitle stream id */
@@ -2010,17 +2010,17 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
bs_write( s, 16, 0 ); /* Segment length */
bs_write( s, 8, 0xff );/* End marker */
- p_block->i_buffer = bs_pos( s ) / 8;
- p_block->i_pts = p_block->i_dts = p_subpic->i_start;
+ p_frame->i_buffer = bs_pos( s ) / 8;
+ p_frame->i_pts = p_frame->i_dts = p_subpic->i_start;
if( !p_subpic->b_ephemer && ( p_subpic->i_stop > p_subpic->i_start ) )
{
- block_t *p_block_stop;
+ vlc_frame_t *p_frame_stop;
- p_block->i_length = p_subpic->i_stop - p_subpic->i_start;
+ p_frame->i_length = p_subpic->i_stop - p_subpic->i_start;
/* Send another (empty) subtitle to signal the end of display */
- p_block_stop = block_Alloc( 64000 );
- bs_init( s, p_block_stop->p_buffer, p_block_stop->i_buffer );
+ p_frame_stop = vlc_frame_Alloc( 64000 );
+ bs_init( s, p_frame_stop->p_buffer, p_frame_stop->i_buffer );
bs_write( s, 8, 0x20 ); /* Data identifier */
bs_write( s, 8, 0x0 ); /* Subtitle stream id */
encode_page_composition( p_enc, s, 0 );
@@ -2029,15 +2029,15 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
bs_write( s, 16, 1 ); /* Page id */
bs_write( s, 16, 0 ); /* Segment length */
bs_write( s, 8, 0xff );/* End marker */
- p_block_stop->i_buffer = bs_pos( s ) / 8;
- p_block_stop->i_pts = p_block_stop->i_dts = p_subpic->i_stop;
- block_ChainAppend( &p_block, p_block_stop );
- p_block_stop->i_length = VLC_TICK_FROM_MS(100); /* p_subpic->i_stop - p_subpic->i_start; */
+ p_frame_stop->i_buffer = bs_pos( s ) / 8;
+ p_frame_stop->i_pts = p_frame_stop->i_dts = p_subpic->i_stop;
+ vlc_frame_ChainAppend( &p_frame, p_frame_stop );
+ p_frame_stop->i_length = VLC_TICK_FROM_MS(100); /* p_subpic->i_stop - p_subpic->i_start; */
}
#ifdef DEBUG_DVBSUB
msg_Dbg( p_enc, "subpicture encoded properly" );
#endif
- return p_block;
+ return p_frame;
}
/*****************************************************************************
diff --git a/modules/codec/edummy.c b/modules/codec/edummy.c
index d554f441b7..cc8cae19c6 100644
--- a/modules/codec/edummy.c
+++ b/modules/codec/edummy.c
@@ -46,8 +46,8 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
-static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf );
+static vlc_frame_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
+static vlc_frame_t *EncodeAudio( encoder_t *p_enc, vlc_frame_t *p_buf );
/*****************************************************************************
* OpenDecoder: open the dummy encoder.
@@ -65,7 +65,7 @@ static int OpenEncoder( vlc_object_t *p_this )
/****************************************************************************
* EncodeVideo: the whole thing
****************************************************************************/
-static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
{
VLC_UNUSED(p_enc); VLC_UNUSED(p_pict);
return NULL;
@@ -74,7 +74,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
/****************************************************************************
* EncodeAudio: the whole thing
****************************************************************************/
-static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf )
+static vlc_frame_t *EncodeAudio( encoder_t *p_enc, vlc_frame_t *p_buf )
{
VLC_UNUSED(p_enc); VLC_UNUSED(p_buf);
return NULL;
diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index ce537c8446..a3beb48a48 100644
--- a/modules/codec/faad.c
+++ b/modules/codec/faad.c
@@ -60,7 +60,7 @@ vlc_module_end ()
/****************************************************************************
* Local prototypes
****************************************************************************/
-static int DecodeBlock( decoder_t *, block_t * );
+static int DecodeFrame( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
static void DoReordering( uint32_t *, uint32_t *, int, int, uint8_t * );
@@ -73,7 +73,7 @@ typedef struct
date_t date;
/* temporary buffer */
- block_t *p_block;
+ vlc_frame_t *p_frame;
/* Channel positions of the current stream (for re-ordering) */
uint32_t pi_channel_positions[MPEG4_ASC_MAX_INDEXEDPOS];
@@ -174,12 +174,12 @@ static int Open( vlc_object_t *p_this )
NeAACDecSetConfiguration( p_sys->hfaad, cfg );
/* buffer */
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
p_sys->b_discontinuity =
p_sys->b_sbr = p_sys->b_ps = false;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
}
@@ -189,24 +189,24 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
static void FlushBuffer( decoder_sys_t *p_sys, size_t i_used )
{
- block_t *p_block = p_sys->p_block;
- if( p_block )
+ vlc_frame_t *p_frame = p_sys->p_frame;
+ if( p_frame )
{
- if( i_used < p_block->i_buffer )
+ if( i_used < p_frame->i_buffer )
{
/* Drop padding */
- for( ; i_used < p_block->i_buffer; i_used++ )
- if( p_block->p_buffer[i_used] != 0x00 )
+ for( ; i_used < p_frame->i_buffer; i_used++ )
+ if( p_frame->p_buffer[i_used] != 0x00 )
break;
- p_block->i_buffer -= i_used;
- p_block->p_buffer += i_used;
+ p_frame->i_buffer -= i_used;
+ p_frame->p_buffer += i_used;
}
- else p_block->i_buffer = 0;
- if( p_block->i_buffer == 0 )
+ else p_frame->i_buffer = 0;
+ if( p_frame->i_buffer == 0 )
{
- block_Release( p_block );
- p_sys->p_block = NULL;
+ vlc_frame_Release( p_frame );
+ p_sys->p_frame = NULL;
}
}
}
@@ -223,59 +223,59 @@ static void Flush( decoder_t *p_dec )
}
/*****************************************************************************
- * DecodeBlock:
+ * DecodeFrame:
*****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( !p_block ) /* No Drain */
+ if( !p_frame ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
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 VLCDEC_SUCCESS;
}
}
/* Remove ADTS header if we have decoder specific config */
- if( p_dec->fmt_in.i_extra && p_block->i_buffer > 7 )
+ if( p_dec->fmt_in.i_extra && p_frame->i_buffer > 7 )
{
- if( p_block->p_buffer[0] == 0xff &&
- ( p_block->p_buffer[1] & 0xf0 ) == 0xf0 ) /* syncword */
+ if( p_frame->p_buffer[0] == 0xff &&
+ ( p_frame->p_buffer[1] & 0xf0 ) == 0xf0 ) /* syncword */
{ /* ADTS header present */
size_t i_header_size; /* 7 bytes (+ 2 bytes for crc) */
- i_header_size = 7 + ( ( p_block->p_buffer[1] & 0x01 ) ? 0 : 2 );
- /* FIXME: multiple blocks per frame */
- if( p_block->i_buffer > i_header_size )
+ i_header_size = 7 + ( ( p_frame->p_buffer[1] & 0x01 ) ? 0 : 2 );
+ /* FIXME: multiple frames per frame */
+ if( p_frame->i_buffer > i_header_size )
{
- p_block->p_buffer += i_header_size;
- p_block->i_buffer -= i_header_size;
+ p_frame->p_buffer += i_header_size;
+ p_frame->i_buffer -= i_header_size;
}
}
}
- const vlc_tick_t i_pts = p_block->i_pts;
+ const vlc_tick_t i_pts = p_frame->i_pts;
- /* Append block as temporary buffer */
- if( p_sys->p_block == NULL )
+ /* Append frame as temporary buffer */
+ if( p_sys->p_frame == NULL )
{
- p_sys->p_block = p_block;
+ p_sys->p_frame = p_frame;
}
else
{
- p_sys->p_block->p_next = p_block;
- block_t *p_prev = p_sys->p_block;
- p_sys->p_block = block_ChainGather( p_sys->p_block );
- if( p_sys->p_block == NULL )
- block_ChainRelease( p_prev );
+ p_sys->p_frame->p_next = p_frame;
+ vlc_frame_t *p_prev = p_sys->p_frame;
+ p_sys->p_frame = vlc_frame_ChainGather( p_sys->p_frame );
+ if( p_sys->p_frame == NULL )
+ vlc_frame_ChainRelease( p_prev );
}
- /* !Warn: do not use p_block beyond this point */
+ /* !Warn: do not use p_frame beyond this point */
if( p_dec->fmt_out.audio.i_rate == 0 )
{
@@ -291,13 +291,13 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
i_rate = 0;
}
- if( i_rate == 0 && p_sys->p_block && p_sys->p_block->i_buffer )
+ if( i_rate == 0 && p_sys->p_frame && p_sys->p_frame->i_buffer )
{
/* Init faad with the first frame */
long i_read = NeAACDecInit( p_sys->hfaad,
- p_sys->p_block->p_buffer, p_sys->p_block->i_buffer,
+ p_sys->p_frame->p_buffer, p_sys->p_frame->i_buffer,
&i_rate, &i_channels );
- if( i_read < 0 || (size_t) i_read > p_sys->p_block->i_buffer )
+ if( i_read < 0 || (size_t) i_read > p_sys->p_frame->i_buffer )
i_rate = 0;
else
FlushBuffer( p_sys, i_read );
@@ -330,15 +330,15 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
/* Decode all data */
- while( p_sys->p_block && p_sys->p_block->i_buffer > 0 )
+ while( p_sys->p_frame && p_sys->p_frame->i_buffer > 0 )
{
void *samples;
NeAACDecFrameInfo frame;
- block_t *p_out = NULL;
+ vlc_frame_t *p_out = NULL;
samples = NeAACDecDecode( p_sys->hfaad, &frame,
- p_sys->p_block->p_buffer,
- p_sys->p_block->i_buffer );
+ p_sys->p_frame->p_buffer,
+ p_sys->p_frame->i_buffer );
if( frame.error > 0 )
{
@@ -367,8 +367,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
NeAACDecSetConfiguration( hfaad, cfg );
if( NeAACDecInit( hfaad,
- p_sys->p_block->p_buffer,
- p_sys->p_block->i_buffer,
+ p_sys->p_frame->p_buffer,
+ p_sys->p_frame->i_buffer,
&i_rate,&i_channels ) < 0 )
{
/* reinitialization failed */
@@ -575,7 +575,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( p_sys->b_discontinuity )
{
- p_out->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ p_out->i_flags |= FRAME_FLAG_DISCONTINUITY;
p_sys->b_discontinuity = false;
}
@@ -588,7 +588,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
FlushBuffer( p_sys, frame.bytesconsumed ? frame.bytesconsumed : SIZE_MAX );
- if( p_sys->p_block && p_sys->p_block->i_buffer == 1 )
+ if( p_sys->p_frame && p_sys->p_frame->i_buffer == 1 )
{
/* Drop byte of padding */
FlushBuffer( p_sys, 0 );
diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c
index 3ac7b756a3..27505d888d 100644
--- a/modules/codec/fdkaac.c
+++ b/modules/codec/fdkaac.c
@@ -127,7 +127,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_buf);
+static vlc_frame_t *EncodeAudio(encoder_t *p_enc, vlc_frame_t *p_buf);
static const char *const ppsz_enc_options[] = {
"profile", "sbr", "vbr", "afterburner", "signaling", NULL
@@ -326,7 +326,7 @@ error:
/****************************************************************************
* EncodeAudio: the whole thing
****************************************************************************/
-static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
+static vlc_frame_t *EncodeAudio(encoder_t *p_enc, vlc_frame_t *p_aout_buf)
{
int16_t *p_buffer;
int i_samples;
@@ -350,7 +350,7 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
int i_samples_left = i_samples;
int i_loop_count = 0;
- block_t *p_chain = NULL;
+ vlc_frame_t *p_chain = NULL;
while (i_samples_left >= 0) {
AACENC_BufDesc in_buf = { 0 }, out_buf = { 0 };
AACENC_InArgs in_args = { 0 };
@@ -381,11 +381,11 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
in_buf.bufferIdentifiers = &in_identifier;
in_buf.bufSizes = &in_size;
in_buf.bufElSizes = &in_elem_size;
- block_t *p_block;
- p_block = block_Alloc(p_sys->i_maxoutputsize);
- p_block->i_buffer = p_sys->i_maxoutputsize;
- out_ptr = p_block->p_buffer;
- out_size = p_block->i_buffer;
+ vlc_frame_t *p_frame;
+ p_frame = vlc_frame_Alloc(p_sys->i_maxoutputsize);
+ p_frame->i_buffer = p_sys->i_maxoutputsize;
+ out_ptr = p_frame->p_buffer;
+ out_size = p_frame->i_buffer;
out_elem_size = 1;
out_buf.numBufs = 1;
out_buf.bufs = &out_ptr;
@@ -399,17 +399,17 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
msg_Info(p_enc, "Encoding final bytes (EOF)");
} else {
msg_Err(p_enc, "Encoding failed: %s", fdkaac_error(erraac));
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
break;
}
}
if (out_args.numOutBytes > 0) {
- p_block->i_buffer = out_args.numOutBytes;
+ p_frame->i_buffer = out_args.numOutBytes;
if (unlikely(i_samples == 0)) {
// I only have the numOutBytes so approximate based on compression factor
double d_samples_forward = p_sys->d_compression_ratio*(double)out_args.numOutBytes;
i_pts_out += (vlc_tick_t)d_samples_forward;
- p_block->i_length = (vlc_tick_t)d_samples_forward;
+ p_frame->i_length = (vlc_tick_t)d_samples_forward;
// TODO: It would be more precise (a few microseconds) to use d_samples_forward =
// (vlc_tick_t)CLOCK_FREQ * (vlc_tick_t)p_sys->i_frame_size/(vlc_tick_t)p_enc->fmt_out.audio.i_rate
// but I am not sure if the lib always outputs a full frame when
@@ -417,40 +417,40 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
} else {
if (i_loop_count == 0) {
// There can be an implicit delay in the first loop cycle because leftover bytes
- // in the library buffer from the prior block
+ // in the library buffer from the prior frame
double d_samples_delay = (double)p_sys->i_frame_size - (double)out_args.numInSamples /
(double)p_enc->fmt_in.audio.i_channels;
i_pts_out -= vlc_tick_from_samples( d_samples_delay,
p_enc->fmt_out.audio.i_rate);
- p_block->i_length = vlc_tick_from_samples(p_sys->i_frame_size,
+ p_frame->i_length = vlc_tick_from_samples(p_sys->i_frame_size,
p_enc->fmt_out.audio.i_rate);
- p_block->i_nb_samples = d_samples_delay;
- //p_block->i_length = i_pts_out - p_sys->i_pts_last;
+ p_frame->i_nb_samples = d_samples_delay;
+ //p_frame->i_length = i_pts_out - p_sys->i_pts_last;
} else {
vlc_tick_t d_length = vlc_tick_from_samples(out_args.numInSamples,
p_enc->fmt_out.audio.i_rate * p_enc->fmt_in.audio.i_channels);
i_pts_out += d_length;
- p_block->i_length = d_length;
- p_block->i_nb_samples = out_args.numInSamples / p_enc->fmt_in.audio.i_channels;
+ p_frame->i_length = d_length;
+ p_frame->i_nb_samples = out_args.numInSamples / p_enc->fmt_in.audio.i_channels;
}
}
- p_block->i_dts = p_block->i_pts = i_pts_out;
- block_ChainAppend(&p_chain, p_block);
+ p_frame->i_dts = p_frame->i_pts = i_pts_out;
+ vlc_frame_ChainAppend(&p_chain, p_frame);
#if 0
msg_Dbg(p_enc, "dts %"PRId64", length %"PRId64", " "pts_last "
"%"PRId64" numOutBytes = %i, numInSamples = %i, "
"i_samples %i, i_loop_count %i",
- p_block->i_dts, p_block->i_length,
+ p_frame->i_dts, p_frame->i_length,
p_sys->i_pts_last, out_args.numOutBytes,
out_args.numInSamples, i_samples, i_loop_count);
#endif
if (likely(i_samples > 0)) {
- p_sys->d_compression_ratio = (double)p_block->i_length / (double)out_args.numOutBytes;
+ p_sys->d_compression_ratio = (double)p_frame->i_length / (double)out_args.numOutBytes;
i_samples_left -= out_args.numInSamples/p_enc->fmt_in.audio.i_channels;
p_sys->i_pts_last = i_pts_out;
}
} else {
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
//msg_Dbg(p_enc, "aac_encode_audio: not enough data yet");
break;
}
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 850ea002c9..44aee480fd 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -45,7 +45,7 @@
#include <FLAC/stream_decoder.h>
#include <FLAC/stream_encoder.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_bits.h>
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT >= 8
@@ -60,8 +60,8 @@ typedef struct
/*
* Input/Output properties
*/
- block_t *p_block;
- block_t *p_aout_buffer;
+ vlc_frame_t *p_frame;
+ vlc_frame_t *p_aout_buffer;
date_t end_date;
/*
@@ -148,7 +148,7 @@ static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
#endif
-static int DecodeBlock( decoder_t *, block_t * );
+static int DecodeFrame( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
/*****************************************************************************
@@ -280,12 +280,12 @@ DecoderReadCallback( const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
decoder_t *p_dec = (decoder_t *)client_data;
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_sys->p_block && p_sys->p_block->i_buffer )
+ if( p_sys->p_frame && p_sys->p_frame->i_buffer )
{
- *bytes = __MIN(*bytes, p_sys->p_block->i_buffer);
- memcpy( buffer, p_sys->p_block->p_buffer, *bytes );
- p_sys->p_block->i_buffer -= *bytes;
- p_sys->p_block->p_buffer += *bytes;
+ *bytes = __MIN(*bytes, p_sys->p_frame->i_buffer);
+ memcpy( buffer, p_sys->p_frame->p_buffer, *bytes );
+ p_sys->p_frame->i_buffer -= *bytes;
+ p_sys->p_frame->p_buffer += *bytes;
}
else
{
@@ -438,7 +438,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Misc init */
p_sys->b_stream_info = false;
memset(p_sys->rgi_channels_reorder, 0, AOUT_CHAN_MAX);
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
/* Take care of flac init */
if( !(p_sys->p_flac = FLAC__stream_decoder_new()) )
@@ -488,7 +488,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_S32N;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
@@ -505,8 +505,8 @@ static void CloseDecoder( vlc_object_t *p_this )
FLAC__stream_decoder_finish( p_sys->p_flac );
FLAC__stream_decoder_delete( p_sys->p_flac );
- if( p_sys->p_block )
- block_Release( p_sys->p_block );
+ if( p_sys->p_frame )
+ vlc_frame_Release( p_sys->p_frame );
free( p_sys );
}
@@ -529,15 +529,15 @@ static void ProcessHeader( decoder_t *p_dec )
if( memcmp( p_dec->fmt_in.p_extra, header, 4 ) )
i_extra += 8;
- p_sys->p_block = block_Alloc( i_extra );
- if( p_sys->p_block == NULL )
+ p_sys->p_frame = vlc_frame_Alloc( i_extra );
+ if( p_sys->p_frame == NULL )
return;
- uint8_t *p_data = p_sys->p_block->p_buffer;
+ uint8_t *p_data = p_sys->p_frame->p_buffer;
if( i_extra != p_dec->fmt_in.i_extra )
{
memcpy( p_data, header, 4);
- p_data[4] = 0x80 | 0; /* STREAMINFO faked as last block */
+ p_data[4] = 0x80 | 0; /* STREAMINFO faked as last frame */
p_data[5] = 0;
p_data[6] = 0;
p_data[7] = 34; /* block size */
@@ -548,8 +548,8 @@ static void ProcessHeader( decoder_t *p_dec )
FLAC__stream_decoder_process_until_end_of_metadata( p_sys->p_flac );
msg_Dbg( p_dec, "STREAMINFO decoded" );
- block_Release( p_sys->p_block );
- p_sys->p_block = NULL;
+ vlc_frame_Release( p_sys->p_frame );
+ p_sys->p_frame = NULL;
}
/*****************************************************************************
@@ -630,20 +630,20 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY | FRAME_FLAG_CORRUPTED) )
{
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 VLCDEC_SUCCESS;
}
}
@@ -653,16 +653,16 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
ProcessHeader( p_dec );
if( !p_sys->b_stream_info )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_ECRITICAL;
}
}
- p_sys->p_block = p_block;
+ p_sys->p_frame = p_frame;
- if( p_sys->p_block->i_pts != VLC_TICK_INVALID &&
- p_sys->p_block->i_pts != date_Get( &p_sys->end_date ) )
- date_Set( &p_sys->end_date, p_sys->p_block->i_pts );
+ if( p_sys->p_frame->i_pts != VLC_TICK_INVALID &&
+ p_sys->p_frame->i_pts != date_Get( &p_sys->end_date ) )
+ date_Set( &p_sys->end_date, p_sys->p_frame->i_pts );
p_sys->p_aout_buffer = 0;
@@ -687,8 +687,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
break;
}
- block_Release( p_sys->p_block );
- p_sys->p_block = NULL;
+ vlc_frame_Release( p_sys->p_frame );
+ p_sys->p_frame = NULL;
if( p_sys->p_aout_buffer != NULL )
decoder_QueueAudio( p_dec, p_sys->p_aout_buffer );
@@ -712,7 +712,7 @@ typedef struct
FLAC__int32 *p_buffer;
unsigned int i_buffer;
- block_t *p_chain;
+ vlc_frame_t *p_chain;
/*
* FLAC properties
@@ -728,7 +728,7 @@ typedef struct
#define STREAMINFO_SIZE 34
-static block_t *Encode( encoder_t *, block_t * );
+static vlc_frame_t *Encode( encoder_t *, vlc_frame_t * );
/*****************************************************************************
* EncoderWriteCallback: called by libflac to output encoded samples
@@ -742,7 +742,7 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
VLC_UNUSED(encoder); VLC_UNUSED(current_frame);
encoder_t *p_enc = (encoder_t *)client_data;
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
if( samples == 0 )
{
@@ -762,19 +762,19 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
}
- p_block = block_Alloc( bytes );
- memcpy( p_block->p_buffer, buffer, bytes );
+ p_frame = vlc_frame_Alloc( bytes );
+ memcpy( p_frame->p_buffer, buffer, bytes );
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
p_sys->i_samples_delay -= samples;
- p_block->i_length = vlc_tick_from_samples(samples, p_enc->fmt_in.audio.i_rate);
+ p_frame->i_length = vlc_tick_from_samples(samples, p_enc->fmt_in.audio.i_rate);
/* Update pts */
- p_sys->i_pts += p_block->i_length;
+ p_sys->i_pts += p_frame->i_length;
- block_ChainAppend( &p_sys->p_chain, p_block );
+ vlc_frame_ChainAppend( &p_sys->p_chain, p_frame );
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
}
@@ -869,10 +869,10 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************
* This function spits out ogg packets.
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *Encode( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_chain;
+ vlc_frame_t *p_chain;
/* FIXME: p_aout_buf is NULL when it's time to flush*/
if( unlikely( !p_aout_buf ) ) return NULL;
diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index 3698bd9951..d1cb1e1cf4 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -95,7 +95,7 @@ typedef struct
} decoder_sys_t;
-static int DecodeBlock (decoder_t *p_dec, block_t *p_block);
+static int DecodeFrame (decoder_t *p_dec, vlc_frame_t *p_frame);
static void Flush (decoder_t *);
static int Open (vlc_object_t *p_this)
@@ -175,7 +175,7 @@ static int Open (vlc_object_t *p_this)
date_Init (&p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1);
p_dec->p_sys = p_sys;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
}
@@ -203,61 +203,61 @@ static void Flush (decoder_t *p_dec)
fluid_synth_noteoff (p_sys->synth, channel, note);
}
-static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
+static int DecodeFrame (decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_out = NULL;
+ vlc_frame_t *p_out = NULL;
- if (p_block == NULL) /* No Drain */
+ if (p_frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
+ if (p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED))
{
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 VLCDEC_SUCCESS;
}
}
- 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)
- date_Set (&p_sys->end_date, p_block->i_pts);
+ date_Set (&p_sys->end_date, p_frame->i_pts);
else
- if (p_block->i_pts < date_Get (&p_sys->end_date))
+ if (p_frame->i_pts < date_Get (&p_sys->end_date))
{
msg_Warn (p_dec, "MIDI message in the past?");
goto drop;
}
- if (p_block->i_buffer < 1)
+ if (p_frame->i_buffer < 1)
goto drop;
- uint8_t event = p_block->p_buffer[0];
- uint8_t channel = p_block->p_buffer[0] & 0xf;
+ uint8_t event = p_frame->p_buffer[0];
+ uint8_t channel = p_frame->p_buffer[0] & 0xf;
event &= 0xF0;
if (event == 0xF0)
switch (channel)
{
case 0:
- if (p_block->p_buffer[p_block->i_buffer - 1] != 0xF7)
+ if (p_frame->p_buffer[p_frame->i_buffer - 1] != 0xF7)
{
case 7:
msg_Warn (p_dec, "fragmented SysEx not implemented");
goto drop;
}
- fluid_synth_sysex (p_sys->synth, (char *)p_block->p_buffer + 1,
- p_block->i_buffer - 2, NULL, NULL, NULL, 0);
+ fluid_synth_sysex (p_sys->synth, (char *)p_frame->p_buffer + 1,
+ p_frame->i_buffer - 2, NULL, NULL, NULL, 0);
break;
case 0xF:
fluid_synth_system_reset (p_sys->synth);
break;
}
- uint8_t p1 = (p_block->i_buffer > 1) ? (p_block->p_buffer[1] & 0x7f) : 0;
- uint8_t p2 = (p_block->i_buffer > 2) ? (p_block->p_buffer[2] & 0x7f) : 0;
+ uint8_t p1 = (p_frame->i_buffer > 1) ? (p_frame->p_buffer[1] & 0x7f) : 0;
+ uint8_t p2 = (p_frame->i_buffer > 2) ? (p_frame->p_buffer[2] & 0x7f) : 0;
switch (event & 0xF0)
{
@@ -283,7 +283,7 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
}
unsigned samples =
- (p_block->i_pts - date_Get (&p_sys->end_date)) * 441 / 10000;
+ (p_frame->i_pts - date_Get (&p_sys->end_date)) * 441 / 10000;
if (samples == 0)
goto drop;
@@ -299,7 +299,7 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
fluid_synth_write_float (p_sys->synth, samples, p_out->p_buffer, 0, 2,
p_out->p_buffer, 1, 2);
drop:
- block_Release (p_block);
+ vlc_frame_Release (p_frame);
if (p_out != NULL)
decoder_QueueAudio (p_dec, p_out);
return VLCDEC_SUCCESS;
diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index 57dfdf9a68..e4d5b6ea96 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -33,12 +33,12 @@
static int DecoderOpen ( vlc_object_t * );
static void DecoderClose( vlc_object_t * );
-static int DecodeBlock( decoder_t *, block_t * );
+static int DecodeFrame( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
#ifdef ENABLE_SOUT
static int EncoderOpen ( vlc_object_t * );
-static block_t *EncoderEncode( encoder_t *, block_t * );
+static vlc_frame_t *EncoderEncode( encoder_t *, vlc_frame_t * );
#endif
vlc_module_begin ()
@@ -183,7 +183,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_ENOMEM;
/* Set output properties */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
p_dec->p_sys = p_sys;
@@ -212,54 +212,54 @@ static void Flush( decoder_t *p_dec )
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
}
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
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 VLCDEC_SUCCESS;
}
}
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
else if( 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 VLCDEC_SUCCESS;
}
/* Don't re-use the same pts twice */
- p_block->i_pts = VLC_TICK_INVALID;
+ p_frame->i_pts = VLC_TICK_INVALID;
- unsigned samples = p_block->i_buffer / p_dec->fmt_in.audio.i_channels;
+ unsigned samples = p_frame->i_buffer / p_dec->fmt_in.audio.i_channels;
if( samples == 0 )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
if( decoder_UpdateAudioFormat( p_dec ) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- block_t *p_out = decoder_NewAudioBuffer( p_dec, samples );
+ vlc_frame_t *p_out = decoder_NewAudioBuffer( p_dec, samples );
if( p_out == NULL )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -270,7 +270,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_out->i_length = date_Increment( &p_sys->end_date, samples )
- p_out->i_pts;
- const uint8_t *src = p_block->p_buffer;
+ const uint8_t *src = p_frame->p_buffer;
int16_t *dst = (int16_t *)p_out->p_buffer;
samples *= p_dec->fmt_in.audio.i_channels;
@@ -278,7 +278,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
for( unsigned i = 0; i < samples; i++ )
*(dst++) = p_sys->table[*(src++)];
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
}
@@ -1173,16 +1173,16 @@ static int EncoderOpen( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-static block_t *EncoderEncode( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *EncoderEncode( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
if( !p_aout_buf || !p_aout_buf->i_buffer ) return NULL;
- block_t *p_block = block_Alloc( p_aout_buf->i_buffer / 2 );
- if( unlikely(p_block == NULL ) )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( p_aout_buf->i_buffer / 2 );
+ if( unlikely(p_frame == NULL ) )
return NULL;
const int16_t *src = (int16_t *)p_aout_buf->p_buffer; // source
- int8_t *dst = (int8_t *)p_block->p_buffer; // sink
+ int8_t *dst = (int8_t *)p_frame->p_buffer; // sink
if( p_enc->fmt_out.i_codec == VLC_CODEC_ALAW )
{
@@ -1207,9 +1207,9 @@ static block_t *EncoderEncode( encoder_t *p_enc, block_t *p_aout_buf )
}
}
- p_block->i_dts = p_block->i_pts = p_aout_buf->i_pts;
- p_block->i_length = vlc_tick_from_samples(p_aout_buf->i_nb_samples,
+ p_frame->i_dts = p_frame->i_pts = p_aout_buf->i_pts;
+ p_frame->i_length = vlc_tick_from_samples(p_aout_buf->i_nb_samples,
p_enc->fmt_in.audio.i_rate);
- return p_block;
+ return p_frame;
}
#endif /* ENABLE_SOUT */
diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index 61cb95f4a6..e1af550e95 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -69,7 +69,7 @@ typedef struct
*****************************************************************************/
static int OpenDecoder( vlc_object_t* );
static void CloseDecoder( vlc_object_t* );
-static int DecodeBlock( decoder_t*, block_t* );
+static int DecodeFrame( decoder_t*, vlc_frame_t* );
static void Flush( decoder_t * );
#define MODULE_DESCRIPTION N_( "Uses GStreamer framework's plugins " \
@@ -523,7 +523,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys->b_running = false;
/* Queue: GStreamer thread will dump buffers into this queue,
- * DecodeBlock() will pop out the buffers from the queue */
+ * DecodeFrame() will pop out the buffers from the queue */
p_sys->p_que = gst_atomic_queue_new( 0 );
VLC_GST_CHECK( p_sys->p_que, NULL, "failed to create queue",
VLC_ENOMEM );
@@ -534,7 +534,7 @@ static int OpenDecoder( vlc_object_t *p_this )
g_object_set( G_OBJECT( p_sys->p_decode_src ), "caps", caps.p_sinkcaps,
"emit-signals", TRUE, "format", GST_FORMAT_BYTES,
"stream-type", GST_APP_STREAM_TYPE_SEEKABLE,
- /* Making DecodeBlock() to block on appsrc with max queue size of 1 byte.
+ /* Making DecodeFrame() to block on appsrc with max queue size of 1 byte.
* This will make the push_buffer() tightly coupled with the buffer
* flow from appsrc -> decoder. push_buffer() will only return when
* the same buffer it just fed to appsrc has also been fed to the
@@ -617,7 +617,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys->b_running = true;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
@@ -656,56 +656,56 @@ static void Flush( decoder_t *p_dec )
}
/* Decode */
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
picture_t *p_pic = NULL;
decoder_sys_t *p_sys = p_dec->p_sys;
GstMessage *p_msg;
- if( !p_block ) /* No Drain */
+ if( !p_frame ) /* No Drain */
return VLCDEC_SUCCESS;
- if( unlikely( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY |
- BLOCK_FLAG_CORRUPTED ) ) )
+ if( unlikely( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY |
+ FRAME_FLAG_CORRUPTED ) ) )
{
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( p_frame->i_flags & FRAME_FLAG_DISCONTINUITY )
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 );
goto done;
}
}
- if( likely( p_block->i_buffer ) )
+ if( likely( p_frame->i_buffer ) )
{
GstBuffer *p_buf;
p_buf = gst_buffer_new_wrapped_full( GST_MEMORY_FLAG_READONLY,
- p_block->p_start, p_block->i_size,
- p_block->p_buffer - p_block->p_start, p_block->i_buffer,
- p_block, ( GDestroyNotify )block_Release );
+ p_frame->p_start, p_frame->i_size,
+ p_frame->p_buffer - p_frame->p_start, p_frame->i_buffer,
+ p_frame, ( GDestroyNotify )vlc_frame_Release );
if( unlikely( p_buf == NULL ) )
{
msg_Err( p_dec, "failed to create input gstbuffer" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_ECRITICAL;
}
- if( p_block->i_dts != VLC_TICK_INVALID )
- GST_BUFFER_DTS( p_buf ) = gst_util_uint64_scale( p_block->i_dts,
+ if( p_frame->i_dts != VLC_TICK_INVALID )
+ GST_BUFFER_DTS( p_buf ) = gst_util_uint64_scale( p_frame->i_dts,
GST_SECOND, GST_MSECOND );
- if( p_block->i_pts == VLC_TICK_INVALID )
+ if( p_frame->i_pts == VLC_TICK_INVALID )
GST_BUFFER_PTS( p_buf ) = GST_BUFFER_DTS( p_buf );
else
- GST_BUFFER_PTS( p_buf ) = gst_util_uint64_scale( p_block->i_pts,
+ GST_BUFFER_PTS( p_buf ) = gst_util_uint64_scale( p_frame->i_pts,
GST_SECOND, GST_MSECOND );
- if( p_block->i_length != VLC_TICK_INVALID )
+ if( p_frame->i_length != VLC_TICK_INVALID )
GST_BUFFER_DURATION( p_buf ) = gst_util_uint64_scale(
- p_block->i_length, GST_SECOND, GST_MSECOND );
+ p_frame->i_length, GST_SECOND, GST_MSECOND );
if( p_dec->fmt_in.video.i_frame_rate &&
p_dec->fmt_in.video.i_frame_rate_base )
@@ -728,14 +728,14 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
GST_APP_SRC_CAST( p_sys->p_decode_src ), p_buf )
!= GST_FLOW_OK ) )
{
- /* block will be released internally,
+ /* frame will be released internally,
* when gst_buffer_unref() is called */
msg_Err( p_dec, "failed to push buffer" );
return VLCDEC_ECRITICAL;
}
}
else
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
/* Poll for any messages, errors */
p_msg = gst_bus_pop_filtered( p_sys->p_bus,
diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 33df5f6bce..9ae67c9d71 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -50,7 +50,7 @@ hxxx_helper_init(struct hxxx_helper *hh, vlc_object_t *p_obj,
hnal = &list[i]; \
if (hnal->b) \
{ \
- block_Release(hnal->b); \
+ vlc_frame_Release(hnal->b); \
release; \
} \
}
@@ -65,7 +65,7 @@ helper_clear_sei(struct hxxx_helper *hh)
{
if(hh->hevc.sei_list[i].b)
{
- block_Release(hh->hevc.sei_list[i].b);
+ vlc_frame_Release(hh->hevc.sei_list[i].b);
hh->hevc.sei_list[i].b = NULL;
}
}
@@ -110,13 +110,13 @@ helper_dup_buf(struct hxxx_helper_nal *p_nal,
{
if (!p_nal->b)
{
- p_nal->b = block_Alloc(i_nal_buf);
+ p_nal->b = vlc_frame_Alloc(i_nal_buf);
if (!p_nal->b)
return VLC_ENOMEM;
}
else if (p_nal->b != NULL && i_nal_buf > p_nal->b->i_buffer)
{
- block_t *b = block_TryRealloc(p_nal->b, 0, i_nal_buf);
+ vlc_frame_t *b = vlc_frame_TryRealloc(p_nal->b, 0, i_nal_buf);
if (b == NULL)
return VLC_ENOMEM;
p_nal->b = b;
@@ -516,107 +516,107 @@ hevc_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
return VLC_EGENERIC;
}
-static inline block_t *
-helper_process_block_hxxx_annexb(struct hxxx_helper *hh,
+static inline vlc_frame_t *
+helper_process_frame_hxxx_annexb(struct hxxx_helper *hh,
int(*parser)(struct hxxx_helper *,
const uint8_t*, size_t,uint8_t,bool*),
- block_t *p_block, bool *p_config_changed)
+ vlc_frame_t *p_frame, bool *p_config_changed)
{
if (p_config_changed != NULL)
{
- int i_ret = parser(hh, p_block->p_buffer, p_block->i_buffer,
+ int i_ret = parser(hh, p_frame->p_buffer, p_frame->i_buffer,
0, p_config_changed);
if (i_ret != VLC_SUCCESS)
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
- return p_block;
+ return p_frame;
}
-static block_t *
-helper_process_block_h264_annexb(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_h264_annexb(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
if (p_config_changed != NULL)
- return helper_process_block_hxxx_annexb(hh, h264_helper_parse_nal,
- p_block,p_config_changed);
- return p_block;
+ return helper_process_frame_hxxx_annexb(hh, h264_helper_parse_nal,
+ p_frame,p_config_changed);
+ return p_frame;
}
-static block_t *
-helper_process_block_hevc_annexb(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_hevc_annexb(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
if (p_config_changed != NULL)
- return helper_process_block_hxxx_annexb(hh, hevc_helper_parse_nal,
- p_block,p_config_changed);
- return p_block;
+ return helper_process_frame_hxxx_annexb(hh, hevc_helper_parse_nal,
+ p_frame,p_config_changed);
+ return p_frame;
}
-static block_t *
-helper_process_block_xvcc2annexb(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_xvcc2annexb(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
assert(helper_nal_length_valid(hh));
- h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
+ h264_AVC_to_AnnexB(p_frame->p_buffer, p_frame->i_buffer,
hh->i_nal_length_size);
- return helper_process_block_h264_annexb(hh, p_block, p_config_changed);
+ return helper_process_frame_h264_annexb(hh, p_frame, p_config_changed);
}
-static block_t *
-helper_process_block_h264_annexb2avcc(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_h264_annexb2avcc(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
- p_block = helper_process_block_h264_annexb(hh, p_block, p_config_changed);
- return p_block ? hxxx_AnnexB_to_xVC(p_block, hh->i_nal_length_size) : NULL;
+ p_frame = helper_process_frame_h264_annexb(hh, p_frame, p_config_changed);
+ return p_frame ? hxxx_AnnexB_to_xVC(p_frame, hh->i_nal_length_size) : NULL;
}
-static block_t *
-helper_process_block_hevc_annexb2hvcc(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_hevc_annexb2hvcc(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
- p_block = helper_process_block_hevc_annexb(hh, p_block, p_config_changed);
- return p_block ? hxxx_AnnexB_to_xVC(p_block, hh->i_nal_length_size) : NULL;
+ p_frame = helper_process_frame_hevc_annexb(hh, p_frame, p_config_changed);
+ return p_frame ? hxxx_AnnexB_to_xVC(p_frame, hh->i_nal_length_size) : NULL;
}
-static block_t *
-helper_process_block_h264_avcc(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_h264_avcc(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
if (p_config_changed != NULL)
{
- int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer,
- p_block->i_buffer,
+ int i_ret = h264_helper_parse_nal(hh, p_frame->p_buffer,
+ p_frame->i_buffer,
hh->i_nal_length_size,
p_config_changed);
if (i_ret != VLC_SUCCESS)
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
- return p_block;
+ return p_frame;
}
-static block_t *
-helper_process_block_hevc_hvcc(struct hxxx_helper *hh, block_t *p_block,
+static vlc_frame_t *
+helper_process_frame_hevc_hvcc(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed)
{
if (p_config_changed != NULL)
{
- int i_ret = hevc_helper_parse_nal(hh, p_block->p_buffer,
- p_block->i_buffer,
+ int i_ret = hevc_helper_parse_nal(hh, p_frame->p_buffer,
+ p_frame->i_buffer,
hh->i_nal_length_size,
p_config_changed);
if (i_ret != VLC_SUCCESS)
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
- return p_block;
+ return p_frame;
}
int
@@ -644,32 +644,32 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
if (hh->b_is_xvcC)
{
if (hh->b_need_xvcC)
- hh->pf_process_block = helper_process_block_h264_avcc;
+ hh->pf_process_frame = helper_process_frame_h264_avcc;
else
- hh->pf_process_block = helper_process_block_xvcc2annexb;
+ hh->pf_process_frame = helper_process_frame_xvcc2annexb;
}
else /* AnnexB */
{
if (hh->b_need_xvcC)
- hh->pf_process_block = helper_process_block_h264_annexb2avcc;
+ hh->pf_process_frame = helper_process_frame_h264_annexb2avcc;
else
- hh->pf_process_block = helper_process_block_h264_annexb;
+ hh->pf_process_frame = helper_process_frame_h264_annexb;
}
break;
case VLC_CODEC_HEVC:
if (hh->b_is_xvcC)
{
if (hh->b_need_xvcC)
- hh->pf_process_block = helper_process_block_hevc_hvcc;
+ hh->pf_process_frame = helper_process_frame_hevc_hvcc;
else
- hh->pf_process_block = helper_process_block_xvcc2annexb;
+ hh->pf_process_frame = helper_process_frame_xvcc2annexb;
}
else /* AnnexB */
{
if (hh->b_need_xvcC)
- hh->pf_process_block = helper_process_block_hevc_annexb2hvcc;
+ hh->pf_process_frame = helper_process_frame_hevc_annexb2hvcc;
else
- hh->pf_process_block = helper_process_block_hevc_annexb;
+ hh->pf_process_frame = helper_process_frame_hevc_annexb;
}
break;
default:
@@ -678,7 +678,7 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
return VLC_SUCCESS;;
}
-static block_t *
+static vlc_frame_t *
hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
const size_t p_nal_counts[],
const size_t p_nal_maxs[],
@@ -686,7 +686,7 @@ hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
{
static const uint8_t annexb_startcode[] = { 0x00, 0x00, 0x00, 0x01 };
- block_t *p_block_list = NULL, *p_current;
+ vlc_frame_t *p_frame_list = NULL, *p_current;
for (size_t i = 0; i < i_lists_size; ++i)
{
size_t i_nals_size = 0;
@@ -696,37 +696,37 @@ hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
i_nals_size += p_nal->b->i_buffer + sizeof annexb_startcode;
}
- block_t *p_block = block_Alloc(i_nals_size);
- if (p_block == NULL)
+ vlc_frame_t *p_frame = vlc_frame_Alloc(i_nals_size);
+ if (p_frame == NULL)
{
- if (p_block_list != NULL)
- block_Release(p_block_list);
+ if (p_frame_list != NULL)
+ vlc_frame_Release(p_frame_list);
return NULL;
}
- p_block->i_buffer = 0;
+ p_frame->i_buffer = 0;
HELPER_FOREACH_NAL(p_nal, pp_nal_lists[i], p_nal_counts[i], p_nal_maxs[i])
{
- memcpy(&p_block->p_buffer[p_block->i_buffer], annexb_startcode,
+ memcpy(&p_frame->p_buffer[p_frame->i_buffer], annexb_startcode,
sizeof annexb_startcode);
- p_block->i_buffer += sizeof annexb_startcode;
- memcpy(&p_block->p_buffer[p_block->i_buffer], p_nal->b->p_buffer,
+ p_frame->i_buffer += sizeof annexb_startcode;
+ memcpy(&p_frame->p_buffer[p_frame->i_buffer], p_nal->b->p_buffer,
p_nal->b->i_buffer);
- p_block->i_buffer += p_nal->b->i_buffer;
+ p_frame->i_buffer += p_nal->b->i_buffer;
}
- if (p_block_list == NULL)
- p_current = p_block_list = p_block;
+ if (p_frame_list == NULL)
+ p_current = p_frame_list = p_frame;
else
{
- p_current->p_next = p_block;
- p_current = p_block;
+ p_current->p_next = p_frame;
+ p_current = p_frame;
}
}
- return p_block_list;
+ return p_frame_list;
}
-block_t *
+vlc_frame_t *
h264_helper_get_annexb_config(const struct hxxx_helper *hh)
{
if (hh->h264.i_sps_count == 0 || hh->h264.i_pps_count == 0)
@@ -740,7 +740,7 @@ h264_helper_get_annexb_config(const struct hxxx_helper *hh)
return hxxx_helper_get_annexb_config( pp_nal_lists, p_nal_counts, p_nal_maxs, 2 );
}
-block_t *
+vlc_frame_t *
hevc_helper_get_annexb_config(const struct hxxx_helper *hh)
{
if (hh->hevc.i_vps_count == 0 || hh->hevc.i_sps_count == 0 ||
@@ -756,7 +756,7 @@ hevc_helper_get_annexb_config(const struct hxxx_helper *hh)
return hxxx_helper_get_annexb_config( pp_nal_lists, p_nal_counts, p_nal_maxs, 3 );
}
-block_t *
+vlc_frame_t *
h264_helper_get_avcc_config(const struct hxxx_helper *hh)
{
const struct hxxx_helper_nal *p_nal;
@@ -781,7 +781,7 @@ h264_helper_get_avcc_config(const struct hxxx_helper *hh)
pp_pps_bufs, p_pps_sizes, hh->h264.i_pps_count);
}
-block_t *
+vlc_frame_t *
hevc_helper_get_hvcc_config(const struct hxxx_helper *hh)
{
struct hevc_dcr_params params = {};
@@ -828,7 +828,7 @@ hevc_helper_get_hvcc_config(const struct hxxx_helper *hh)
if(p_dcr == NULL)
return NULL;
- return block_heap_Alloc(p_dcr, i_dcr);
+ return vlc_frame_heap_Alloc(p_dcr, i_dcr);
}
static const struct hxxx_helper_nal *
diff --git a/modules/codec/hxxx_helper.h b/modules/codec/hxxx_helper.h
index 12577e8948..ff02db1d37 100644
--- a/modules/codec/hxxx_helper.h
+++ b/modules/codec/hxxx_helper.h
@@ -22,7 +22,7 @@
# include "config.h"
#endif
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_fourcc.h>
#include "../packetizer/h264_nal.h"
@@ -30,7 +30,7 @@
struct hxxx_helper_nal
{
- block_t *b;
+ vlc_frame_t *b;
union {
void *xps;
h264_sequence_parameter_set_t *h264_sps;
@@ -74,10 +74,10 @@ struct hxxx_helper
} hevc;
};
- /* Process the block: do the AnnexB <-> xvcC conversion if needed. If
+ /* Process the frame: do the AnnexB <-> xvcC conversion if needed. If
* p_config_changed is not NULL, parse nals to detect a SPS/PPS or a video
* size change. */
- block_t * (*pf_process_block)(struct hxxx_helper *hh, block_t *p_block,
+ vlc_frame_t * (*pf_process_frame)(struct hxxx_helper *hh, vlc_frame_t *p_frame,
bool *p_config_changed);
};
@@ -88,11 +88,11 @@ void hxxx_helper_clean(struct hxxx_helper *hh);
int hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
size_t i_extra);
-block_t *h264_helper_get_annexb_config(const struct hxxx_helper *hh);
-block_t *hevc_helper_get_annexb_config(const struct hxxx_helper *hh);
+vlc_frame_t *h264_helper_get_annexb_config(const struct hxxx_helper *hh);
+vlc_frame_t *hevc_helper_get_annexb_config(const struct hxxx_helper *hh);
-block_t *h264_helper_get_avcc_config(const struct hxxx_helper *hh);
-block_t *hevc_helper_get_hvcc_config(const struct hxxx_helper *hh);
+vlc_frame_t *h264_helper_get_avcc_config(const struct hxxx_helper *hh);
+vlc_frame_t *hevc_helper_get_hvcc_config(const struct hxxx_helper *hh);
int hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
unsigned *p_w, unsigned *p_h,
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index 788a6d78c6..c85e2370be 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -77,7 +77,7 @@ typedef struct
static int OpenDecoder(vlc_object_t *);
static void CloseDecoder(vlc_object_t *);
-static int DecodeBlock(decoder_t *, block_t *);
+static int DecodeFrame(decoder_t *, vlc_frame_t *);
/*
* jpeg encoder descriptor
@@ -100,7 +100,7 @@ static const char * const ppsz_enc_options[] = {
static int OpenEncoder(vlc_object_t *);
static void CloseEncoder(vlc_object_t *);
-static block_t *EncodeBlock(encoder_t *, picture_t *);
+static vlc_frame_t *EncodeFrame(encoder_t *, picture_t *);
/*
* Module descriptor
@@ -176,7 +176,7 @@ static int OpenDecoder(vlc_object_t *p_this)
p_sys->err.output_message = user_error_message;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->fmt_out.video.i_chroma =
p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
@@ -496,19 +496,19 @@ jpeg_GetOrientation( j_decompress_ptr cinfo )
/*
* This function must be fed with a complete compressed frame.
*/
-static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
+static int DecodeFrame(decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic = 0;
p_sys->p_row_pointers = NULL;
- if (!p_block) /* No Drain */
+ if (!p_frame) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
@@ -519,7 +519,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
}
jpeg_create_decompress(&p_sys->p_jpeg);
- jpeg_mem_src(&p_sys->p_jpeg, p_block->p_buffer, p_block->i_buffer);
+ jpeg_mem_src(&p_sys->p_jpeg, p_frame->p_buffer, p_frame->i_buffer);
jpeg_save_markers( &p_sys->p_jpeg, EXIF_JPEG_MARKER, 0xffff );
jpeg_read_header(&p_sys->p_jpeg, TRUE);
@@ -574,9 +574,9 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
jpeg_destroy_decompress(&p_sys->p_jpeg);
free(p_sys->p_row_pointers);
- p_pic->date = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ p_pic->date = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
@@ -585,7 +585,7 @@ error:
jpeg_destroy_decompress(&p_sys->p_jpeg);
free(p_sys->p_row_pointers);
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
@@ -633,15 +633,15 @@ static int OpenEncoder(vlc_object_t *p_this)
p_sys->i_blocksize = 3 * p_enc->fmt_in.video.i_visible_width * p_enc->fmt_in.video.i_visible_height;
p_enc->fmt_in.i_codec = VLC_CODEC_J420;
- p_enc->pf_encode_video = EncodeBlock;
+ p_enc->pf_encode_video = EncodeFrame;
return VLC_SUCCESS;
}
/*
- * EncodeBlock
+ * EncodeFrame
*/
-static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
+static vlc_frame_t *EncodeFrame(encoder_t *p_enc, picture_t *p_pic)
{
encoder_sys_t *p_sys = p_enc->p_sys;
@@ -649,14 +649,14 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
{
return NULL;
}
- block_t *p_block = block_Alloc(p_sys->i_blocksize);
- if (p_block == NULL)
+ vlc_frame_t *p_frame = vlc_frame_Alloc(p_sys->i_blocksize);
+ if (p_frame == NULL)
{
return NULL;
}
JSAMPIMAGE p_row_pointers = NULL;
- unsigned long size = p_block->i_buffer;
+ unsigned long size = p_frame->i_buffer;
/* libjpeg longjmp's there in case of error */
if (setjmp(p_sys->setjmp_buffer))
@@ -665,7 +665,7 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
}
jpeg_create_compress(&p_sys->p_jpeg);
- jpeg_mem_dest(&p_sys->p_jpeg, &p_block->p_buffer, &size);
+ jpeg_mem_dest(&p_sys->p_jpeg, &p_frame->p_buffer, &size);
p_sys->p_jpeg.image_width = p_enc->fmt_in.video.i_visible_width;
p_sys->p_jpeg.image_height = p_enc->fmt_in.video.i_visible_height;
@@ -719,10 +719,10 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
}
free(p_row_pointers);
- p_block->i_buffer = size;
- p_block->i_dts = p_block->i_pts = p_pic->date;
+ p_frame->i_buffer = size;
+ p_frame->i_dts = p_frame->i_pts = p_pic->date;
- return p_block;
+ return p_frame;
error:
jpeg_destroy_compress(&p_sys->p_jpeg);
@@ -736,7 +736,7 @@ error:
}
free(p_row_pointers);
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
diff --git a/modules/codec/kate.c b/modules/codec/kate.c
index 81eeec9425..4db3917d35 100644
--- a/modules/codec/kate.c
+++ b/modules/codec/kate.c
@@ -155,14 +155,14 @@ static void CloseDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t *p_this );
#endif
-static int DecodeSub( decoder_t *p_dec, block_t *p_block );
-static block_t * Packetize( decoder_t *p_dec, block_t **pp_block );
+static int DecodeSub( decoder_t *p_dec, vlc_frame_t *p_frame );
+static vlc_frame_t * Packetize( decoder_t *p_dec, vlc_frame_t **pp_frame );
static void Flush( decoder_t * );
static int ProcessHeaders( decoder_t *p_dec );
static void *ProcessPacket( decoder_t *p_dec, kate_packet *p_kp,
- block_t *p_block );
+ vlc_frame_t *p_frame );
static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp,
- block_t *p_block );
+ vlc_frame_t *p_frame );
static void ParseKateComments( decoder_t * );
static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
const kate_event *ev );
@@ -458,19 +458,19 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with kate packets.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static void *DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
kate_packet kp;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
#ifdef HAVE_TIGER
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY)
+ if( p_frame->i_flags & FRAME_FLAG_DISCONTINUITY)
{
/* Hmm, should we wait before flushing the renderer ? I think not, but not certain... */
vlc_mutex_lock( &p_sys->lock );
@@ -478,49 +478,49 @@ static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
vlc_mutex_unlock( &p_sys->lock );
}
#endif
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
p_sys->i_max_stop = VLC_TICK_INVALID;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
- /* Block to Kate packet */
- kate_packet_wrap(&kp, p_block->i_buffer, p_block->p_buffer);
+ /* frame to Kate packet */
+ kate_packet_wrap(&kp, p_frame->i_buffer, p_frame->p_buffer);
if( !p_sys->b_has_headers )
{
if( ProcessHeaders( p_dec ) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket( p_dec, &kp, p_block );
+ return ProcessPacket( p_dec, &kp, p_frame );
}
-static int DecodeSub( decoder_t *p_dec, block_t *p_block )
+static int DecodeSub( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- subpicture_t *p_spu = DecodeBlock( p_dec, p_block );
+ subpicture_t *p_spu = DecodeFrame( p_dec, p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block; *pp_block = NULL;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame; *pp_frame = NULL;
+ if( p_frame == NULL )
return NULL;
- return DecodeBlock( p_dec, p_block );
+ return DecodeFrame( p_dec, p_frame );
}
/*****************************************************************************
@@ -612,34 +612,34 @@ static int ProcessHeaders( decoder_t *p_dec )
* ProcessPacket: processes a kate packet.
*****************************************************************************/
static void *ProcessPacket( decoder_t *p_dec, kate_packet *p_kp,
- block_t *p_block )
+ vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
/* Date management */
- if( p_block->i_pts != VLC_TICK_INVALID && p_block->i_pts != p_sys->i_pts )
+ if( p_frame->i_pts != VLC_TICK_INVALID && p_frame->i_pts != p_sys->i_pts )
{
- p_sys->i_pts = p_block->i_pts;
+ p_sys->i_pts = p_frame->i_pts;
}
#ifdef ENABLE_PACKETIZER
if( p_sys->b_packetizer )
{
/* Date management */
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
if( p_sys->i_headers >= p_sys->i_num_headers )
- p_block->i_length = p_sys->i_pts - p_block->i_pts;
+ p_frame->i_length = p_sys->i_pts - p_frame->i_pts;
else
- p_block->i_length = 0;
- return p_block;
+ p_frame->i_length = 0;
+ return p_frame;
}
else
#endif
{
- subpicture_t *p_buf = DecodePacket( p_dec, p_kp, p_block );
+ subpicture_t *p_buf = DecodePacket( p_dec, p_kp, p_frame );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return p_buf;
}
}
@@ -1019,7 +1019,7 @@ static void UpdateTigerFontEffect( decoder_t *p_dec )
/*****************************************************************************
* DecodePacket: decodes a Kate packet.
*****************************************************************************/
-static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t *p_block )
+static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
const kate_event *ev = NULL;
@@ -1078,8 +1078,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
return NULL;
}
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + vlc_tick_from_samples(ev->duration * p_sys->ki.gps_denominator, p_sys->ki.gps_numerator);
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + vlc_tick_from_samples(ev->duration * p_sys->ki.gps_denominator, p_sys->ki.gps_numerator);
p_spu->b_ephemer = false;
p_spu->b_absolute = false;
@@ -1087,7 +1087,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
if( p_sys->b_use_tiger)
{
p_spu_sys->p_dec_sys = p_sys;
- p_spu_sys->i_start = p_block->i_pts;
+ p_spu_sys->i_start = p_frame->i_pts;
DecSysHold( p_sys );
p_spu->i_stop = __MAX( p_sys->i_max_stop, p_spu->i_stop );
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index aff12c942a..f99f433fe8 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -67,7 +67,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeBlock( decoder_t *, block_t * );
+static int DecodeFrame( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
/* */
@@ -135,7 +135,7 @@ static int Create( vlc_object_t *p_this )
if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
return VLC_EGENERIC;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
@@ -326,34 +326,34 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock:
+ * DecodeFrame:
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
Flush( p_dec );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' )
+ if( p_frame->i_buffer == 0 || p_frame->p_buffer[0] == '\0' )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
libass_spu_updater_sys_t *p_spu_sys = malloc( sizeof(*p_spu_sys) );
if( !p_spu_sys )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -368,26 +368,26 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
msg_Warn( p_dec, "can't get spu buffer" );
free( p_spu_sys );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
p_spu_sys->p_img = NULL;
p_spu_sys->p_dec_sys = p_sys;
- p_spu_sys->i_subs_len = p_block->i_buffer;
- p_spu_sys->p_subs_data = malloc( p_block->i_buffer );
- p_spu_sys->i_pts = p_block->i_pts;
+ p_spu_sys->i_subs_len = p_frame->i_buffer;
+ p_spu_sys->p_subs_data = malloc( p_frame->i_buffer );
+ p_spu_sys->i_pts = p_frame->i_pts;
if( !p_spu_sys->p_subs_data )
{
subpicture_Delete( p_spu );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- memcpy( p_spu_sys->p_subs_data, p_block->p_buffer,
- p_block->i_buffer );
+ memcpy( p_spu_sys->p_subs_data, p_frame->p_buffer,
+ p_frame->i_buffer );
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = __MAX( p_sys->i_max_stop, p_block->i_pts + p_block->i_length );
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = __MAX( p_sys->i_max_stop, p_frame->i_pts + p_frame->i_length );
p_spu->b_ephemer = true;
p_spu->b_absolute = true;
@@ -397,13 +397,13 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( p_sys->p_track )
{
ass_process_chunk( p_sys->p_track, p_spu_sys->p_subs_data, p_spu_sys->i_subs_len,
- MS_FROM_VLC_TICK( p_block->i_pts ), MS_FROM_VLC_TICK( p_block->i_length ) );
+ MS_FROM_VLC_TICK( p_frame->i_pts ), MS_FROM_VLC_TICK( p_frame->i_length ) );
}
vlc_mutex_unlock( &p_sys->lock );
DecSysHold( p_sys ); /* Keep a reference for the returned subpicture */
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 9896f40ee6..9328d37cba 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -40,7 +40,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_cpu.h>
#include "cc.h"
#include "synchro.h"
@@ -110,7 +110,7 @@ typedef struct
static int OpenDecoder( vlc_object_t * );
static void CloseDecoder( vlc_object_t * );
-static int DecodeVideo( decoder_t *, block_t *);
+static int DecodeVideo( decoder_t *, vlc_frame_t *);
#if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
static void SendCc( decoder_t *p_dec );
#endif
@@ -249,18 +249,18 @@ static int OpenDecoder( vlc_object_t *p_this )
/*****************************************************************************
* RunDecoder: the libmpeg2 decoder
*****************************************************************************/
-static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static picture_t *DecodeFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
mpeg2_state_t state;
- 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;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
+ p_frame = *pp_frame;
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED) )
Reset( p_dec );
while( 1 )
@@ -296,7 +296,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !p_picture )
{
Reset( p_dec );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
PutPicture( p_dec, p_picture );
@@ -348,16 +348,16 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
i_dts = 0;
/* Hack to handle demuxers which only have DTS timestamps */
- if( !i_pts && !p_block->i_pts && p_block->i_dts > 0 )
+ if( !i_pts && !p_frame->i_pts && p_frame->i_dts > 0 )
{
if( p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ||
(p_current->flags &
PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
{
- i_pts = p_block->i_dts;
+ i_pts = p_frame->i_dts;
}
}
- p_block->i_pts = p_block->i_dts = 0;
+ p_frame->i_pts = p_frame->i_dts = 0;
/* End hack */
#else /* New interface */
@@ -406,7 +406,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !p_pic )
{
mpeg2_reset( p_sys->p_mpeg2dec, 1 );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
@@ -427,11 +427,11 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_cc_dts = i_dts;
if( (p_current->flags
& PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P )
- p_sys->i_cc_flags = BLOCK_FLAG_TYPE_P;
+ p_sys->i_cc_flags = FRAME_FLAG_TYPE_P;
else if( (p_current->flags
& PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
- p_sys->i_cc_flags = BLOCK_FLAG_TYPE_B;
- else p_sys->i_cc_flags = BLOCK_FLAG_TYPE_I;
+ p_sys->i_cc_flags = FRAME_FLAG_TYPE_B;
+ else p_sys->i_cc_flags = FRAME_FLAG_TYPE_I;
#if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
bool b_top_field_first = p_sys->p_info->current_picture->flags
& PIC_FLAG_TOP_FIELD_FIRST;
@@ -461,14 +461,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
case STATE_BUFFER:
- if( !p_block->i_buffer )
+ if( !p_frame->i_buffer )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- if( (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY
- | BLOCK_FLAG_CORRUPTED)) &&
+ if( (p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY
+ | FRAME_FLAG_CORRUPTED)) &&
p_sys->p_synchro &&
p_sys->p_info->sequence &&
p_sys->p_info->sequence->width != (unsigned)-1 )
@@ -490,7 +490,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
}
- if( p_block->i_flags & BLOCK_FLAG_PREROLL )
+ if( p_frame->i_flags & FRAME_FLAG_PREROLL )
{
p_sys->b_preroll = true;
}
@@ -502,27 +502,27 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
#ifdef PIC_FLAG_PTS
- if( p_block->i_pts )
+ if( p_frame->i_pts )
{
- mpeg2_pts( p_sys->p_mpeg2dec, (uint32_t)p_block->i_pts );
+ mpeg2_pts( p_sys->p_mpeg2dec, (uint32_t)p_frame->i_pts );
#else /* New interface */
- if( p_block->i_pts || p_block->i_dts )
+ if( p_frame->i_pts || p_frame->i_dts )
{
mpeg2_tag_picture( p_sys->p_mpeg2dec,
- (uint32_t)p_block->i_pts,
- (uint32_t)p_block->i_dts );
+ (uint32_t)p_frame->i_pts,
+ (uint32_t)p_frame->i_dts );
#endif
p_sys->i_previous_pts = p_sys->i_current_pts;
- p_sys->i_current_pts = p_block->i_pts;
+ p_sys->i_current_pts = p_frame->i_pts;
p_sys->i_previous_dts = p_sys->i_current_dts;
- p_sys->i_current_dts = p_block->i_dts;
+ p_sys->i_current_dts = p_frame->i_dts;
}
- mpeg2_buffer( p_sys->p_mpeg2dec, p_block->p_buffer,
- p_block->p_buffer + p_block->i_buffer );
+ mpeg2_buffer( p_sys->p_mpeg2dec, p_frame->p_buffer,
+ p_frame->p_buffer + p_frame->i_buffer );
- p_block->i_buffer = 0;
+ p_frame->i_buffer = 0;
break;
#if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
@@ -602,14 +602,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block)
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame)
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- block_t **pp_block = &p_block;
+ vlc_frame_t **pp_frame = &p_frame;
picture_t *p_pic;
- while( ( p_pic = DecodeBlock( p_dec, pp_block ) ) != NULL )
+ while( ( p_pic = DecodeFrame( p_dec, pp_frame ) ) != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
}
@@ -706,18 +706,18 @@ static picture_t *GetNewPicture( decoder_t *p_dec )
static void SendCc( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_cc = NULL;
+ vlc_frame_t *p_cc = NULL;
if( !p_sys->cc.b_reorder && p_sys->cc.i_data <= 0 )
return;
- 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;
decoder_cc_desc_t desc;
desc.i_608_channels = p_sys->cc.i_608channels;
desc.i_708_channels = p_sys->cc.i_708channels;
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index 9832e6db1a..11bfd7be30 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -49,7 +49,7 @@ static void CloseCommon ( vlc_object_t * );
#ifdef ENABLE_SOUT
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
-static block_t *EncodeFrames( encoder_t *, block_t * );
+static vlc_frame_t *EncodeFrames( encoder_t *, vlc_frame_t * );
#endif
vlc_module_begin ()
@@ -177,8 +177,8 @@ typedef struct
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeFrame ( decoder_t *, block_t * );
-static block_t *Packetize ( decoder_t *, block_t ** );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
static void Flush( decoder_t * );
/* */
@@ -186,7 +186,7 @@ static int VobHeader( unsigned *pi_rate,
unsigned *pi_channels, unsigned *pi_original_channels,
unsigned *pi_bits,
const uint8_t *p_header );
-static void VobExtract( block_t *, block_t *, unsigned i_bits );
+static void VobExtract( vlc_frame_t *, vlc_frame_t *, unsigned i_bits );
/* */
static int AobHeader( unsigned *pi_rate,
unsigned *pi_channels, unsigned *pi_layout,
@@ -194,7 +194,7 @@ static int AobHeader( unsigned *pi_rate,
unsigned *pi_padding,
aob_group_t g[2],
const uint8_t *p_header );
-static void AobExtract( block_t *, block_t *, unsigned i_bits, aob_group_t p_group[2] );
+static void AobExtract( vlc_frame_t *, vlc_frame_t *, unsigned i_bits, aob_group_t p_group[2] );
/* */
static int BdHeader( decoder_sys_t *p_sys,
unsigned *pi_rate,
@@ -203,7 +203,7 @@ static int BdHeader( decoder_sys_t *p_sys,
unsigned *pi_original_channels,
unsigned *pi_bits,
const uint8_t *p_header );
-static void BdExtract( block_t *, block_t *, unsigned, unsigned, unsigned, unsigned );
+static void BdExtract( vlc_frame_t *, vlc_frame_t *, unsigned, unsigned, unsigned, unsigned );
/* */
static int WidiHeader( unsigned *pi_rate,
unsigned *pi_channels, unsigned *pi_original_channels,
@@ -326,47 +326,47 @@ static void Flush( decoder_t *p_dec )
****************************************************************************
* Beware, this function must be fed with complete frames (PES packet).
*****************************************************************************/
-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;
+ vlc_frame_t *p_frame;
unsigned int i_rate = 0, i_original_channels = 0, i_channels = 0, i_bits = 0;
int i_frame_length;
- if( !pp_block || !*pp_block ) return NULL;
+ if( !pp_frame || !*pp_frame ) return NULL;
- p_block = *pp_block;
- *pp_block = NULL; /* So the packet doesn't get re-sent */
+ p_frame = *pp_frame;
+ *pp_frame = NULL; /* So the packet doesn't get re-sent */
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( p_block );
- *pp_block = NULL;
+ vlc_frame_Release( p_frame );
+ *pp_frame = NULL;
return NULL;
}
}
/* Date management */
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
if( 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->i_buffer <= p_sys->i_header_size )
+ if( p_frame->i_buffer <= p_sys->i_header_size )
{
msg_Err(p_dec, "frame is too short");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -379,29 +379,29 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
{
case LPCM_VOB:
i_ret = VobHeader( &i_rate, &i_channels, &i_original_channels, &i_bits,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case LPCM_AOB:
i_ret = AobHeader( &i_rate, &i_channels, &i_original_channels, &i_bits, &i_padding,
p_aob_group,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case LPCM_BD:
i_ret = BdHeader( p_sys, &i_rate, &i_channels, &i_channels_padding, &i_original_channels, &i_bits,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
case LPCM_WIDI:
i_ret = WidiHeader( &i_rate, &i_channels, &i_original_channels, &i_bits,
- p_block->p_buffer );
+ p_frame->p_buffer );
break;
default:
abort();
}
- if( i_ret || p_block->i_buffer <= p_sys->i_header_size + i_padding )
+ if( i_ret || p_frame->i_buffer <= p_sys->i_header_size + i_padding )
{
msg_Warn( p_dec, "no frame sync or too small frame" );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -409,7 +409,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if( p_dec->fmt_out.audio.i_rate != i_rate )
{
date_Init( &p_sys->end_date, i_rate, 1 );
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
@@ -417,7 +417,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->i_type == LPCM_AOB )
{
- i_frame_length = (p_block->i_buffer - p_sys->i_header_size - i_padding) /
+ i_frame_length = (p_frame->i_buffer - p_sys->i_header_size - i_padding) /
(
( (p_aob_group[0].i_bits / 8) * p_aob_group[0].i_channels ) +
( (p_aob_group[1].i_bits / 8) * p_aob_group[1].i_channels )
@@ -425,19 +425,19 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
}
else
{
- i_frame_length = (p_block->i_buffer - p_sys->i_header_size - i_padding) /
+ i_frame_length = (p_frame->i_buffer - p_sys->i_header_size - i_padding) /
(i_channels + i_channels_padding) * 8 / i_bits;
}
if( p_sys->b_packetizer )
{
- p_block->i_pts = p_block->i_dts = date_Get( &p_sys->end_date );
- p_block->i_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, i_frame_length ) -
- p_block->i_pts;
+ p_frame->i_pts;
/* Just pass on the incoming frame */
- return p_block;
+ return p_frame;
}
else
{
@@ -457,11 +457,11 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
aout_FormatPrepare(&p_dec->fmt_out.audio);
/* */
- block_t *p_aout_buffer;
+ vlc_frame_t *p_aout_buffer;
if( decoder_UpdateAudioFormat( p_dec ) != VLC_SUCCESS ||
!(p_aout_buffer = decoder_NewAudioBuffer( p_dec, i_frame_length )) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -470,22 +470,22 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
date_Increment( &p_sys->end_date, i_frame_length )
- p_aout_buffer->i_pts;
- p_block->p_buffer += p_sys->i_header_size + i_padding;
- p_block->i_buffer -= p_sys->i_header_size + i_padding;
+ p_frame->p_buffer += p_sys->i_header_size + i_padding;
+ p_frame->i_buffer -= p_sys->i_header_size + i_padding;
switch( p_sys->i_type )
{
case LPCM_WIDI:
case LPCM_VOB:
- VobExtract( p_aout_buffer, p_block, i_bits );
+ VobExtract( p_aout_buffer, p_frame, i_bits );
break;
case LPCM_AOB:
- AobExtract( p_aout_buffer, p_block, i_bits, p_aob_group );
+ AobExtract( p_aout_buffer, p_frame, i_bits, p_aob_group );
break;
default:
vlc_assert_unreachable();
case LPCM_BD:
- BdExtract( p_aout_buffer, p_block, i_frame_length, i_channels, i_channels_padding, i_bits );
+ BdExtract( p_aout_buffer, p_frame, i_frame_length, i_channels, i_channels_padding, i_bits );
break;
}
@@ -496,14 +496,14 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_dec->fmt_out.i_codec );
}
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return p_aout_buffer;
}
}
-static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- block_t *p_out = Packetize( p_dec, &p_block );
+ vlc_frame_t *p_out = Packetize( p_dec, &p_frame );
if( p_out != NULL )
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
@@ -592,10 +592,10 @@ static void CloseEncoder ( vlc_object_t *p_this )
/*****************************************************************************
* EncodeFrames: encode zero or more LCPM audio packets
*****************************************************************************/
-static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *EncodeFrames( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_first_block = NULL, *p_last_block = NULL;
+ vlc_frame_t *p_first_frame = NULL, *p_last_frame = NULL;
if( !p_aout_buf || !p_aout_buf->i_buffer ) return NULL;
@@ -629,11 +629,11 @@ static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
for ( int i = 0; i < i_num_frames; ++i )
{
- block_t *p_block = block_Alloc( i_frame_size );
- if( !p_block )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( i_frame_size );
+ if( !p_frame )
return NULL;
- uint8_t *frame = (uint8_t *)p_block->p_buffer;
+ uint8_t *frame = (uint8_t *)p_frame->p_buffer;
frame[0] = 1; /* one frame in packet */
frame[1] = 0;
frame[2] = 0; /* no first access unit */
@@ -665,13 +665,13 @@ static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
vlc_tick_t next_pts = p_aout_buf->i_pts +
vlc_tick_from_samples((i + 1) * p_sys->i_frame_samples + i_start_offset, p_sys->i_rate);
- p_block->i_pts = p_block->i_dts = this_pts;
- p_block->i_length = next_pts - this_pts;
+ p_frame->i_pts = p_frame->i_dts = this_pts;
+ p_frame->i_length = next_pts - this_pts;
- if( !p_first_block )
- p_first_block = p_last_block = p_block;
+ if( !p_first_frame )
+ p_first_frame = p_last_frame = p_frame;
else
- p_last_block = p_last_block->p_next = p_block;
+ p_last_frame = p_last_frame->p_next = p_frame;
}
memcpy( p_sys->p_buffer,
@@ -679,7 +679,7 @@ static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
i_leftover_samples * p_sys->i_channels * 2 );
p_sys->i_buffer_used = i_leftover_samples;
- return p_first_block;
+ return p_first_frame;
}
#endif
@@ -1097,7 +1097,7 @@ static int WidiHeader( unsigned *pi_rate,
return 0;
}
-static void VobExtract( block_t *p_aout_buffer, block_t *p_block,
+static void VobExtract( vlc_frame_t *p_aout_buffer, vlc_frame_t *p_frame,
unsigned i_bits )
{
/* 20/24 bits LPCM use special packing */
@@ -1105,75 +1105,75 @@ static void VobExtract( block_t *p_aout_buffer, block_t *p_block,
{
uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
- while( p_block->i_buffer / 12 )
+ while( p_frame->i_buffer / 12 )
{
/* Sample 1 */
- *(p_out++) = (p_block->p_buffer[ 0] << 24)
- | (p_block->p_buffer[ 1] << 16)
- | (p_block->p_buffer[ 8] << 8);
+ *(p_out++) = (p_frame->p_buffer[ 0] << 24)
+ | (p_frame->p_buffer[ 1] << 16)
+ | (p_frame->p_buffer[ 8] << 8);
/* Sample 2 */
- *(p_out++) = (p_block->p_buffer[ 2] << 24)
- | (p_block->p_buffer[ 3] << 16)
- | (p_block->p_buffer[ 9] << 8);
+ *(p_out++) = (p_frame->p_buffer[ 2] << 24)
+ | (p_frame->p_buffer[ 3] << 16)
+ | (p_frame->p_buffer[ 9] << 8);
/* Sample 3 */
- *(p_out++) = (p_block->p_buffer[ 4] << 24)
- | (p_block->p_buffer[ 5] << 16)
- | (p_block->p_buffer[10] << 8);
+ *(p_out++) = (p_frame->p_buffer[ 4] << 24)
+ | (p_frame->p_buffer[ 5] << 16)
+ | (p_frame->p_buffer[10] << 8);
/* Sample 4 */
- *(p_out++) = (p_block->p_buffer[ 6] << 24)
- | (p_block->p_buffer[ 7] << 16)
- | (p_block->p_buffer[11] << 8);
+ *(p_out++) = (p_frame->p_buffer[ 6] << 24)
+ | (p_frame->p_buffer[ 7] << 16)
+ | (p_frame->p_buffer[11] << 8);
- p_block->i_buffer -= 12;
- p_block->p_buffer += 12;
+ p_frame->i_buffer -= 12;
+ p_frame->p_buffer += 12;
}
}
else if( i_bits == 20 )
{
uint32_t *p_out = (uint32_t *)p_aout_buffer->p_buffer;
- while( p_block->i_buffer / 10 )
+ while( p_frame->i_buffer / 10 )
{
/* Sample 1 */
- *(p_out++) = ( p_block->p_buffer[0] << 24)
- | ( p_block->p_buffer[1] << 16)
- | ((p_block->p_buffer[8] & 0xF0) << 8);
+ *(p_out++) = ( p_frame->p_buffer[0] << 24)
+ | ( p_frame->p_buffer[1] << 16)
+ | ((p_frame->p_buffer[8] & 0xF0) << 8);
/* Sample 2 */
- *(p_out++) = ( p_block->p_buffer[2] << 24)
- | ( p_block->p_buffer[3] << 16)
- | ((p_block->p_buffer[8] & 0x0F) << 12);
+ *(p_out++) = ( p_frame->p_buffer[2] << 24)
+ | ( p_frame->p_buffer[3] << 16)
+ | ((p_frame->p_buffer[8] & 0x0F) << 12);
/* Sample 3 */
- *(p_out++) = ( p_block->p_buffer[4] << 24)
- | ( p_block->p_buffer[5] << 16)
- | ((p_block->p_buffer[9] & 0xF0) << 8);
+ *(p_out++) = ( p_frame->p_buffer[4] << 24)
+ | ( p_frame->p_buffer[5] << 16)
+ | ((p_frame->p_buffer[9] & 0xF0) << 8);
/* Sample 4 */
- *(p_out++) = ( p_block->p_buffer[6] << 24)
- | ( p_block->p_buffer[7] << 16)
- | ((p_block->p_buffer[9] & 0x0F) << 12);
+ *(p_out++) = ( p_frame->p_buffer[6] << 24)
+ | ( p_frame->p_buffer[7] << 16)
+ | ((p_frame->p_buffer[9] & 0x0F) << 12);
- p_block->i_buffer -= 10;
- p_block->p_buffer += 10;
+ p_frame->i_buffer -= 10;
+ p_frame->p_buffer += 10;
}
}
else
{
assert( i_bits == 16 );
#ifdef WORDS_BIGENDIAN
- memcpy( p_aout_buffer->p_buffer, p_block->p_buffer, p_block->i_buffer );
+ memcpy( p_aout_buffer->p_buffer, p_frame->p_buffer, p_frame->i_buffer );
#else
- swab( p_block->p_buffer, p_aout_buffer->p_buffer, p_block->i_buffer );
+ swab( p_frame->p_buffer, p_aout_buffer->p_buffer, p_frame->i_buffer );
#endif
}
}
-static void AobExtract( block_t *p_aout_buffer,
- block_t *p_block, unsigned i_aoutbits, aob_group_t p_group[2] )
+static void AobExtract( vlc_frame_t *p_aout_buffer,
+ vlc_frame_t *p_frame, unsigned i_aoutbits, aob_group_t p_group[2] )
{
uint8_t *p_out = p_aout_buffer->p_buffer;
const unsigned i_total_channels = p_group[0].i_channels +
( p_group[1].i_bits ? p_group[1].i_channels : 0 );
- while( p_block->i_buffer > 0 )
+ while( p_frame->i_buffer > 0 )
{
unsigned int i_aout_written = 0;
@@ -1182,9 +1182,9 @@ static void AobExtract( block_t *p_aout_buffer,
const aob_group_t *g = &p_group[1-i];
const unsigned int i_group_size = 2 * g->i_channels * g->i_bits / 8;
- if( p_block->i_buffer < i_group_size )
+ if( p_frame->i_buffer < i_group_size )
{
- p_block->i_buffer = 0;
+ p_frame->i_buffer = 0;
break;
}
@@ -1202,9 +1202,9 @@ static void AobExtract( block_t *p_aout_buffer,
if( g->i_bits == 24 )
{
assert( i_aoutbits == 32 );
- *p_out32 = (p_block->p_buffer[2*i_src+0] << 24)
- | (p_block->p_buffer[2*i_src+1] << 16)
- | (p_block->p_buffer[4*g->i_channels+i_src] << 8);
+ *p_out32 = (p_frame->p_buffer[2*i_src+0] << 24)
+ | (p_frame->p_buffer[2*i_src+1] << 16)
+ | (p_frame->p_buffer[4*g->i_channels+i_src] << 8);
#ifdef WORDS_BIGENDIAN
*p_out32 = vlc_bswap32(*p_out32);
#endif
@@ -1213,9 +1213,9 @@ static void AobExtract( block_t *p_aout_buffer,
else if( g->i_bits == 20 )
{
assert( i_aoutbits == 32 );
- *p_out32 = (p_block->p_buffer[2*i_src+0] << 24)
- | (p_block->p_buffer[2*i_src+1] << 16)
- | (((p_block->p_buffer[4*g->i_channels+i_src] << ((!n)?0:4) ) & 0xf0) << 8);
+ *p_out32 = (p_frame->p_buffer[2*i_src+0] << 24)
+ | (p_frame->p_buffer[2*i_src+1] << 16)
+ | (((p_frame->p_buffer[4*g->i_channels+i_src] << ((!n)?0:4) ) & 0xf0) << 8);
#ifdef WORDS_BIGENDIAN
*p_out32 = vlc_bswap32(*p_out32);
#endif
@@ -1228,17 +1228,17 @@ static void AobExtract( block_t *p_aout_buffer,
if( i_aoutbits == 16 )
{
#ifdef WORDS_BIGENDIAN
- memcpy( &p_out[2*i_dst], &p_block->p_buffer[2*i_src], 2 );
+ memcpy( &p_out[2*i_dst], &p_frame->p_buffer[2*i_src], 2 );
#else
- p_out[2*i_dst+1] = p_block->p_buffer[2*i_src+0];
- p_out[2*i_dst+0] = p_block->p_buffer[2*i_src+1];
+ p_out[2*i_dst+1] = p_frame->p_buffer[2*i_src+0];
+ p_out[2*i_dst+0] = p_frame->p_buffer[2*i_src+1];
#endif
i_aout_written += 2;
}
else
{
- *p_out32 = (p_block->p_buffer[2*i_src+0] << 24)
- | (p_block->p_buffer[2*i_src+1] << 16);
+ *p_out32 = (p_frame->p_buffer[2*i_src+0] << 24)
+ | (p_frame->p_buffer[2*i_src+1] << 16);
#ifdef WORDS_BIGENDIAN
*p_out32 = vlc_bswap32(*p_out32);
#endif
@@ -1249,20 +1249,20 @@ static void AobExtract( block_t *p_aout_buffer,
}
/* */
- p_block->i_buffer -= i_group_size;
- p_block->p_buffer += i_group_size;
+ p_frame->i_buffer -= i_group_size;
+ p_frame->p_buffer += i_group_size;
}
p_out += i_aout_written;
}
}
-static void BdExtract( block_t *p_aout_buffer, block_t *p_block,
+static void BdExtract( vlc_frame_t *p_aout_buffer, vlc_frame_t *p_frame,
unsigned i_frame_length,
unsigned i_channels, unsigned i_channels_padding,
unsigned i_bits )
{
if( i_bits != 16 || i_channels_padding > 0 )
{
- uint8_t *p_src = p_block->p_buffer;
+ uint8_t *p_src = p_frame->p_buffer;
uint8_t *p_dst = p_aout_buffer->p_buffer;
int dst_inc = ((i_bits == 16) ? 2 : 4) * i_channels;
@@ -1290,9 +1290,9 @@ static void BdExtract( block_t *p_aout_buffer, block_t *p_block,
else
{
#ifdef WORDS_BIGENDIAN
- memcpy( p_aout_buffer->p_buffer, p_block->p_buffer, p_block->i_buffer );
+ memcpy( p_aout_buffer->p_buffer, p_frame->p_buffer, p_frame->i_buffer );
#else
- swab( p_block->p_buffer, p_aout_buffer->p_buffer, p_block->i_buffer );
+ swab( p_frame->p_buffer, p_aout_buffer->p_buffer, p_frame->i_buffer );
#endif
}
}
diff --git a/modules/codec/mad.c b/modules/codec/mad.c
index b8a3ac50a2..50f52e45c8 100644
--- a/modules/codec/mad.c
+++ b/modules/codec/mad.c
@@ -43,7 +43,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_aout.h>
#include <vlc_codec.h>
@@ -65,7 +65,7 @@ typedef struct
struct mad_synth mad_synth;
int i_reject_count;
- block_t *p_last_buf;
+ vlc_frame_t *p_last_buf;
} decoder_sys_t;
/*****************************************************************************
@@ -80,14 +80,14 @@ vlc_module_begin ()
vlc_module_end ()
/*****************************************************************************
- * DecodeBlock: decode an MPEG audio frame.
+ * DecodeFrame: decode an MPEG audio frame.
*****************************************************************************/
-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;
- block_t *p_out_buf = NULL, *p_last_buf = NULL;
+ vlc_frame_t *p_out_buf = NULL, *p_last_buf = NULL;
- if( !pp_block )
+ if( !pp_frame )
{
/* Drain */
p_last_buf = p_sys->p_last_buf;
@@ -97,24 +97,24 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
else
{
- if( !*pp_block )
+ if( !*pp_frame )
return NULL;
- block_t *p_in_buf = *pp_block;
- *pp_block = NULL;
+ vlc_frame_t *p_in_buf = *pp_frame;
+ *pp_frame = NULL;
if( p_in_buf->i_buffer < MAD_BUFFER_GUARD )
{
- block_Release( p_in_buf );
+ vlc_frame_Release( p_in_buf );
return NULL;
}
/* Buffers passed to the mad_stream_buffer() function need to ends with
- * the header (MAD_BUFFER_GUARD) of the following block. Therefore,
- * this DecodeBlock() function will always return the output buffer
+ * the header (MAD_BUFFER_GUARD) of the following frame. Therefore,
+ * this DecodeFrame() function will always return the output buffer
* corresponding to the last input buffer. */
if( !p_sys->p_last_buf )
{
- /* Wait for the next block */
+ /* Wait for the next frame */
p_sys->p_last_buf = p_in_buf;
return NULL;
}
@@ -122,9 +122,9 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->p_last_buf = p_in_buf;
/* Put the header of the current buffer at the end of the last one.
- * Normally, this won't do a real realloc() since VLC blocks are
+ * Normally, this won't do a real realloc() since VLC frames are
* allocated with pre and post padding */
- p_last_buf = block_Realloc( p_last_buf, 0,
+ p_last_buf = vlc_frame_Realloc( p_last_buf, 0,
p_last_buf->i_buffer + MAD_BUFFER_GUARD );
if( !p_last_buf )
return NULL;
@@ -136,14 +136,14 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_last_buf->i_buffer );
/* Do the actual decoding now (ignore EOF error when draining). */
if ( mad_frame_decode( &p_sys->mad_frame, &p_sys->mad_stream ) == -1
- && ( pp_block != NULL || p_sys->mad_stream.error != MAD_ERROR_BUFLEN ) )
+ && ( pp_frame != NULL || p_sys->mad_stream.error != MAD_ERROR_BUFLEN ) )
{
msg_Err( p_dec, "libmad error: %s",
mad_stream_errorstr( &p_sys->mad_stream ) );
if( !MAD_RECOVERABLE( p_sys->mad_stream.error ) )
p_sys->i_reject_count = 3;
}
- else if( p_last_buf->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ else if( p_last_buf->i_flags & FRAME_FLAG_DISCONTINUITY )
{
p_sys->i_reject_count = 3;
}
@@ -206,22 +206,22 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
end:
- block_Release( p_last_buf );
+ vlc_frame_Release( p_last_buf );
return p_out_buf;
reject:
p_sys->i_reject_count--;
if( p_out_buf )
{
- block_Release( p_out_buf );
+ vlc_frame_Release( p_out_buf );
p_out_buf = NULL;
}
goto end;
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- block_t **pp_block = p_block ? &p_block : NULL, *p_out;
- while( ( p_out = DecodeBlock( p_dec, pp_block ) ) != NULL )
+ vlc_frame_t **pp_frame = p_frame ? &p_frame : NULL, *p_out;
+ while( ( p_out = DecodeFrame( p_dec, pp_frame ) ) != NULL )
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
}
@@ -231,7 +231,7 @@ static void DecodeFlush( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->p_last_buf )
- block_Release( p_sys->p_last_buf );
+ vlc_frame_Release( p_sys->p_last_buf );
p_sys->p_last_buf = NULL;
}
@@ -295,6 +295,6 @@ static void Close( vlc_object_t *p_this )
mad_frame_finish( &p_sys->mad_frame );
mad_stream_finish( &p_sys->mad_stream );
if( p_sys->p_last_buf )
- block_Release( p_sys->p_last_buf );
+ vlc_frame_Release( p_sys->p_last_buf );
free( p_sys );
}
diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index 175fd6b63f..ae910e4fde 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -611,13 +611,13 @@ error:
return VLC_EGENERIC;
}
-static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_block)
+static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
HRESULT hr;
IMFSample *input_sample = NULL;
- if (AllocateInputSample(p_dec, stream_id, &input_sample, p_block->i_buffer))
+ if (AllocateInputSample(p_dec, stream_id, &input_sample, p_frame->i_buffer))
goto error;
IMFMediaBuffer *input_media_buffer = NULL;
@@ -630,23 +630,23 @@ static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_bloc
if (FAILED(hr))
goto error;
- memcpy(buffer_start, p_block->p_buffer, p_block->i_buffer);
+ memcpy(buffer_start, p_frame->p_buffer, p_frame->i_buffer);
if (p_dec->fmt_in.i_codec == VLC_CODEC_H264)
{
/* in-place NAL to annex B conversion. */
- h264_AVC_to_AnnexB(buffer_start, p_block->i_buffer, p_sys->nal_length_size);
+ h264_AVC_to_AnnexB(buffer_start, p_frame->i_buffer, p_sys->nal_length_size);
}
hr = IMFMediaBuffer_Unlock(input_media_buffer);
if (FAILED(hr))
goto error;
- hr = IMFMediaBuffer_SetCurrentLength(input_media_buffer, p_block->i_buffer);
+ hr = IMFMediaBuffer_SetCurrentLength(input_media_buffer, p_frame->i_buffer);
if (FAILED(hr))
goto error;
- vlc_tick_t ts = p_block->i_pts == VLC_TICK_INVALID ? p_block->i_dts : p_block->i_pts;
+ vlc_tick_t ts = p_frame->i_pts == VLC_TICK_INVALID ? p_frame->i_dts : p_frame->i_pts;
/* Convert from microseconds to 100 nanoseconds unit. */
hr = IMFSample_SetSampleTime(input_sample, MSFTIME_FROM_VLC_TICK(ts));
@@ -699,7 +699,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id)
decoder_sys_t *p_sys = p_dec->p_sys;
HRESULT hr;
picture_t *picture = NULL;
- block_t *aout_buffer = NULL;
+ vlc_frame_t *aout_buffer = NULL;
DWORD output_status = 0;
MFT_OUTPUT_DATA_BUFFER output_buffer = { stream_id, p_sys->output_sample, 0, NULL };
@@ -825,35 +825,35 @@ error:
if (picture)
picture_Release(picture);
if (aout_buffer)
- block_Release(aout_buffer);
+ vlc_frame_Release(aout_buffer);
return VLC_EGENERIC;
}
-static int DecodeSync(decoder_t *p_dec, block_t *p_block)
+static int DecodeSync(decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if (!p_block) /* No Drain */
+ if (!p_frame) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
/* Drain the output stream before sending the input packet. */
if (ProcessOutputStream(p_dec, p_sys->output_stream_id))
goto error;
- if (ProcessInputStream(p_dec, p_sys->input_stream_id, p_block))
+ if (ProcessInputStream(p_dec, p_sys->input_stream_id, p_frame))
goto error;
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
error:
msg_Err(p_dec, "Error in DecodeSync()");
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
@@ -882,17 +882,17 @@ static HRESULT DequeueMediaEvent(decoder_t *p_dec)
return S_OK;
}
-static int DecodeAsync(decoder_t *p_dec, block_t *p_block)
+static int DecodeAsync(decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
HRESULT hr;
- if (!p_block) /* No Drain */
+ if (!p_frame) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
@@ -933,16 +933,16 @@ static int DecodeAsync(decoder_t *p_dec, block_t *p_block)
}
p_sys->pending_input_events -= 1;
- if (ProcessInputStream(p_dec, p_sys->input_stream_id, p_block))
+ if (ProcessInputStream(p_dec, p_sys->input_stream_id, p_frame))
goto error;
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
error:
msg_Err(p_dec, "Error in DecodeAsync()");
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/mpg123.c b/modules/codec/mpg123.c
index 054482832a..f90b84d42a 100644
--- a/modules/codec/mpg123.c
+++ b/modules/codec/mpg123.c
@@ -35,7 +35,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_codec.h>
/*****************************************************************************
@@ -54,7 +54,7 @@ typedef struct
{
mpg123_handle * p_handle;
date_t end_date;
- block_t * p_out;
+ vlc_frame_t * p_out;
bool b_opened;
} decoder_sys_t;
@@ -196,9 +196,9 @@ static int UpdateAudioFormat( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
int i_err;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -206,22 +206,22 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( !p_sys->b_opened )
{
- if( p_block )
- block_Release( p_block );
+ if( p_frame )
+ vlc_frame_Release( p_frame );
return VLCDEC_ECRITICAL;
}
- /* Feed input block */
- if( p_block != NULL )
+ /* Feed input frame */
+ if( p_frame != NULL )
{
- i_pts = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ i_pts = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
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 VLCDEC_SUCCESS;
}
}
@@ -231,13 +231,13 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
/* 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 VLCDEC_SUCCESS;
}
/* Feed mpg123 with raw data */
- i_err = mpg123_feed( p_sys->p_handle, p_block->p_buffer, p_block->i_buffer );
- block_Release( p_block );
+ i_err = mpg123_feed( p_sys->p_handle, p_frame->p_buffer, p_frame->i_buffer );
+ vlc_frame_Release( p_frame );
if( i_err != MPG123_OK )
{
@@ -249,16 +249,16 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
while( true )
{
- /* Fetch a new output block (if possible) */
+ /* Fetch a new output frame (if possible) */
if( !p_sys->p_out
|| p_sys->p_out->i_buffer != mpg123_outblock( p_sys->p_handle ) )
{
if( p_sys->p_out )
- block_Release( p_sys->p_out );
+ vlc_frame_Release( p_sys->p_out );
/* Keep the output buffer for next calls in case it's not used (in case
* of MPG123_NEED_MORE status) */
- p_sys->p_out = block_Alloc( mpg123_outblock( p_sys->p_handle ) );
+ p_sys->p_out = vlc_frame_Alloc( mpg123_outblock( p_sys->p_handle ) );
if( unlikely( !p_sys->p_out ) )
return VLCDEC_SUCCESS;
@@ -274,7 +274,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
msg_Err( p_dec, "could not replace buffer: %s",
mpg123_plain_strerror( i_err ) );
- block_Release( p_sys->p_out );
+ vlc_frame_Release( p_sys->p_out );
p_sys->p_out = NULL;
break;
}
@@ -307,7 +307,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
- block_t *p_out = p_sys->p_out;
+ vlc_frame_t *p_out = p_sys->p_out;
p_sys->p_out = NULL;
if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
@@ -318,7 +318,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
else if( p_out ) /* we need a valid date and that's not guaranteed on flush/error */
{
- block_Release( p_out );
+ vlc_frame_Release( p_out );
break;
}
}
@@ -404,7 +404,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
p_dec->fmt_out.audio.i_format = p_dec->fmt_out.i_codec;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
msg_Dbg( p_this, "%4.4s->%4.4s, bits per sample: %i",
@@ -431,6 +431,6 @@ static void CloseDecoder( vlc_object_t *p_this )
mpg123_delete( p_sys->p_handle );
ExitMPG123();
if( p_sys->p_out )
- block_Release( p_sys->p_out );
+ vlc_frame_Release( p_sys->p_out );
free( p_sys );
}
diff --git a/modules/codec/oggspots.c b/modules/codec/oggspots.c
index 3dc133229d..145bdbbf0b 100644
--- a/modules/codec/oggspots.c
+++ b/modules/codec/oggspots.c
@@ -66,12 +66,12 @@ static int OpenDecoder (vlc_object_t*);
static int OpenPacketizer(vlc_object_t*);
static void CloseDecoder (vlc_object_t*);
-static int DecodeVideo (decoder_t*, block_t*);
-static block_t* Packetize (decoder_t*, block_t**);
+static int DecodeVideo (decoder_t*, vlc_frame_t*);
+static vlc_frame_t* Packetize (decoder_t*, vlc_frame_t**);
static int ProcessHeader(decoder_t*);
-static void* ProcessPacket(decoder_t*, block_t*);
+static void* ProcessPacket(decoder_t*, vlc_frame_t*);
static void Flush (decoder_t*);
-static picture_t* DecodePacket (decoder_t*, block_t*);
+static picture_t* DecodePacket (decoder_t*, vlc_frame_t*);
/*****************************************************************************
@@ -150,45 +150,45 @@ static int OpenPacketizer(vlc_object_t* p_this)
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static void* DecodeBlock(decoder_t* p_dec, block_t* p_block)
+static void* DecodeFrame(decoder_t* p_dec, vlc_frame_t* p_frame)
{
decoder_sys_t* p_sys = p_dec->p_sys;
/* Check for headers */
if (!p_sys->b_has_headers) {
if (ProcessHeader(p_dec)) {
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket(p_dec, p_block);
+ return ProcessPacket(p_dec, p_frame);
}
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- picture_t *p_pic = DecodeBlock( p_dec, p_block );
+ picture_t *p_pic = DecodeFrame( p_dec, p_frame );
if( p_pic != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block; *pp_block = NULL;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame; *pp_frame = NULL;
+ if( p_frame == NULL )
return NULL;
- return DecodeBlock( p_dec, p_block );
+ return DecodeFrame( p_dec, p_frame );
}
/*****************************************************************************
@@ -294,37 +294,37 @@ static void Flush(decoder_t* p_dec)
/*****************************************************************************
* ProcessPacket: processes an OggSpots packet.
*****************************************************************************/
-static void* ProcessPacket(decoder_t* p_dec, block_t* p_block)
+static void* ProcessPacket(decoder_t* p_dec, vlc_frame_t* p_frame)
{
decoder_sys_t* p_sys = p_dec->p_sys;
void* p_buf;
- if ( (p_block->i_flags & BLOCK_FLAG_DISCONTINUITY) != 0 ) {
- p_sys->i_pts = p_block->i_pts;
+ if ( (p_frame->i_flags & FRAME_FLAG_DISCONTINUITY) != 0 ) {
+ p_sys->i_pts = p_frame->i_pts;
}
- if ( (p_block->i_flags & BLOCK_FLAG_CORRUPTED) != 0 ) {
- block_Release(p_block);
+ if ( (p_frame->i_flags & FRAME_FLAG_CORRUPTED) != 0 ) {
+ vlc_frame_Release(p_frame);
return NULL;
}
/* Date management */
- if (p_block->i_pts != VLC_TICK_INVALID && p_block->i_pts != p_sys->i_pts) {
- p_sys->i_pts = p_block->i_pts;
+ if (p_frame->i_pts != VLC_TICK_INVALID && p_frame->i_pts != p_sys->i_pts) {
+ p_sys->i_pts = p_frame->i_pts;
}
if (p_sys->b_packetizer) {
/* Date management */
/* FIXME: This is copied from theora but it looks wrong.
- * p_block->i_length will always be zero. */
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ * p_frame->i_length will always be zero. */
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
- p_block->i_length = p_sys->i_pts - p_block->i_pts;
+ p_frame->i_length = p_sys->i_pts - p_frame->i_pts;
- p_buf = p_block;
+ p_buf = p_frame;
}
else {
- p_buf = DecodePacket(p_dec, p_block);
+ p_buf = DecodePacket(p_dec, p_frame);
}
return p_buf;
@@ -333,34 +333,34 @@ static void* ProcessPacket(decoder_t* p_dec, block_t* p_block)
/*****************************************************************************
* DecodePacket: decodes an OggSpots packet.
*****************************************************************************/
-static picture_t* DecodePacket(decoder_t* p_dec, block_t* p_block)
+static picture_t* DecodePacket(decoder_t* p_dec, vlc_frame_t* p_frame)
{
decoder_sys_t* p_sys = p_dec->p_sys;
uint32_t i_img_offset;
picture_t* p_pic;
- if (p_block->i_buffer < 20) {
+ if (p_frame->i_buffer < 20) {
msg_Dbg(p_dec, "Packet too short");
goto error;
}
/* Byte offset */
- i_img_offset = GetDWLE(p_block->p_buffer);
+ i_img_offset = GetDWLE(p_frame->p_buffer);
if (i_img_offset < 20) {
msg_Dbg(p_dec, "Invalid byte offset");
goto error;
}
/* Image format */
- if ( !memcmp(&p_block->p_buffer[4], "PNG", 3) ) {
+ if ( !memcmp(&p_frame->p_buffer[4], "PNG", 3) ) {
p_dec->fmt_in.video.i_chroma = VLC_CODEC_PNG;
}
- else if ( !memcmp(&p_block->p_buffer[4], "JPEG", 4) ) {
+ else if ( !memcmp(&p_frame->p_buffer[4], "JPEG", 4) ) {
p_dec->fmt_in.video.i_chroma = VLC_CODEC_JPEG;
}
else {
char psz_image_type[8+1];
- strncpy(psz_image_type, (char*)&p_block->p_buffer[4], 8);
+ strncpy(psz_image_type, (char*)&p_frame->p_buffer[4], 8);
psz_image_type[sizeof(psz_image_type)-1] = '\0';
msg_Dbg(p_dec, "Unsupported image format: %s", psz_image_type);
@@ -370,10 +370,10 @@ static picture_t* DecodePacket(decoder_t* p_dec, block_t* p_block)
/* We currently ignore the rest of the header and let the image format
* handle the details */
- p_block->i_buffer -= i_img_offset;
- p_block->p_buffer += i_img_offset;
+ p_frame->i_buffer -= i_img_offset;
+ p_frame->p_buffer += i_img_offset;
- p_pic = image_Read(p_sys->p_image, p_block,
+ p_pic = image_Read(p_sys->p_image, p_frame,
&p_dec->fmt_in,
&p_dec->fmt_out.video);
if (p_pic == NULL) {
@@ -387,7 +387,7 @@ static picture_t* DecodePacket(decoder_t* p_dec, block_t* p_block)
return p_pic;
error:
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 68912a8f2d..71eeb38eb3 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -34,7 +34,7 @@
#include <vlc_aout.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame_helper.h>
#include <vlc_timestamp_helper.h>
#include <vlc_threads.h>
#include <vlc_bits.h>
@@ -46,15 +46,15 @@
#include "omxil_utils.h"
#include "../../video_output/android/display.h"
-#define BLOCK_FLAG_CSD (0x01 << BLOCK_FLAG_PRIVATE_SHIFT)
+#define FRAME_FLAG_CSD (0x01 << FRAME_FLAG_PRIVATE_SHIFT)
#define DECODE_FLAG_RESTART (0x01)
#define DECODE_FLAG_DRAIN (0x02)
/**
- * Callback called when a new block is processed from DecodeBlock.
- * It returns -1 in case of error, 0 if block should be dropped, 1 otherwise.
+ * Callback called when a new frame is processed from DecodeFrame.
+ * It returns -1 in case of error, 0 if frame should be dropped, 1 otherwise.
*/
-typedef int (*dec_on_new_block_cb)(decoder_t *, block_t **);
+typedef int (*dec_on_new_frame_cb)(decoder_t *, vlc_frame_t **);
/**
* Callback called when decoder is flushing.
@@ -62,20 +62,20 @@ typedef int (*dec_on_new_block_cb)(decoder_t *, block_t **);
typedef void (*dec_on_flush_cb)(decoder_t *);
/**
- * Callback called when DecodeBlock try to get an output buffer (pic or block).
+ * Callback called when DecodeFrame try to get an output buffer (pic or frame).
* It returns -1 in case of error, or the number of output buffer returned.
*/
typedef int (*dec_process_output_cb)(decoder_t *, mc_api_out *, picture_t **,
- block_t **);
+ vlc_frame_t **);
typedef struct
{
mc_api api;
- /* Codec Specific Data buffer: sent in DecodeBlock after a start or a flush
+ /* Codec Specific Data buffer: sent in DecodeFrame after a start or a flush
* with the BUFFER_FLAG_CODEC_CONFIG flag.*/
#define MAX_CSD_COUNT 3
- block_t *pp_csd[MAX_CSD_COUNT];
+ vlc_frame_t *pp_csd[MAX_CSD_COUNT];
size_t i_csd_count;
size_t i_csd_send;
@@ -85,7 +85,7 @@ typedef struct
int i_quirks;
/* Specific Audio/Video callbacks */
- dec_on_new_block_cb pf_on_new_block;
+ dec_on_new_frame_cb pf_on_new_frame;
dec_on_flush_cb pf_on_flush;
dec_process_output_cb pf_process_output;
@@ -99,7 +99,7 @@ typedef struct
bool b_flush_out;
/* If true, the output thread will start to dequeue output pictures */
bool b_output_ready;
- /* If true, the first input block was successfully dequeued */
+ /* If true, the first input frame was successfully dequeued */
bool b_input_dequeued;
bool b_aborted;
bool b_drained;
@@ -141,19 +141,19 @@ static int OpenDecoderNdk(vlc_object_t *);
static void CleanDecoder(decoder_t *);
static void CloseDecoder(vlc_object_t *);
-static int Video_OnNewBlock(decoder_t *, block_t **);
-static int VideoHXXX_OnNewBlock(decoder_t *, block_t **);
-static int VideoMPEG2_OnNewBlock(decoder_t *, block_t **);
-static int VideoVC1_OnNewBlock(decoder_t *, block_t **);
+static int Video_OnNewFrame(decoder_t *, vlc_frame_t **);
+static int VideoHXXX_OnNewFrame(decoder_t *, vlc_frame_t **);
+static int VideoMPEG2_OnNewFrame(decoder_t *, vlc_frame_t **);
+static int VideoVC1_OnNewFrame(decoder_t *, vlc_frame_t **);
static void Video_OnFlush(decoder_t *);
static int Video_ProcessOutput(decoder_t *, mc_api_out *, picture_t **,
- block_t **);
-static int DecodeBlock(decoder_t *, block_t *);
+ vlc_frame_t **);
+static int DecodeFrame(decoder_t *, vlc_frame_t *);
-static int Audio_OnNewBlock(decoder_t *, block_t **);
+static int Audio_OnNewFrame(decoder_t *, vlc_frame_t **);
static void Audio_OnFlush(decoder_t *);
static int Audio_ProcessOutput(decoder_t *, mc_api_out *, picture_t **,
- block_t **);
+ vlc_frame_t **);
static void DecodeFlushLocked(decoder_t *);
static void DecodeFlush(decoder_t *);
@@ -214,12 +214,12 @@ static void CSDFree(decoder_t *p_dec)
decoder_sys_t *p_sys = p_dec->p_sys;
for (unsigned int i = 0; i < p_sys->i_csd_count; ++i)
- block_Release(p_sys->pp_csd[i]);
+ vlc_frame_Release(p_sys->pp_csd[i]);
p_sys->i_csd_count = 0;
}
-/* Init the p_sys->p_csd that will be sent from DecodeBlock */
-static void CSDInit(decoder_t *p_dec, block_t *p_blocks, size_t i_count)
+/* Init the p_sys->p_csd that will be sent from DecodeFrame */
+static void CSDInit(decoder_t *p_dec, vlc_frame_t *p_frames, size_t i_count)
{
decoder_sys_t *p_sys = p_dec->p_sys;
assert(i_count <= MAX_CSD_COUNT);
@@ -228,10 +228,10 @@ static void CSDInit(decoder_t *p_dec, block_t *p_blocks, size_t i_count)
for (size_t i = 0; i < i_count; ++i)
{
- assert(p_blocks != NULL);
- p_sys->pp_csd[i] = p_blocks;
- p_sys->pp_csd[i]->i_flags = BLOCK_FLAG_CSD;
- p_blocks = p_blocks->p_next;
+ assert(p_frames != NULL);
+ p_sys->pp_csd[i] = p_frames;
+ p_sys->pp_csd[i]->i_flags = FRAME_FLAG_CSD;
+ p_frames = p_frames->p_next;
p_sys->pp_csd[i]->p_next = NULL;
}
@@ -241,12 +241,12 @@ static void CSDInit(decoder_t *p_dec, block_t *p_blocks, size_t i_count)
static int CSDDup(decoder_t *p_dec, const void *p_buf, size_t i_buf)
{
- block_t *p_block = block_Alloc(i_buf);
- if (!p_block)
+ vlc_frame_t *p_frame = vlc_frame_Alloc(i_buf);
+ if (!p_frame)
return VLC_ENOMEM;
- memcpy(p_block->p_buffer, p_buf, i_buf);
+ memcpy(p_frame->p_buffer, p_buf, i_buf);
- CSDInit(p_dec, p_block, 1);
+ CSDInit(p_dec, p_frame, 1);
return VLC_SUCCESS;
}
@@ -274,10 +274,10 @@ static int H264SetCSD(decoder_t *p_dec, bool *p_size_changed)
struct hxxx_helper *hh = &p_sys->video.hh;
assert(hh->h264.i_sps_count > 0 || hh->h264.i_pps_count > 0);
- block_t *p_spspps_blocks = h264_helper_get_annexb_config(hh);
+ vlc_frame_t *p_spspps_frames = h264_helper_get_annexb_config(hh);
- if (p_spspps_blocks != NULL)
- CSDInit(p_dec, p_spspps_blocks, 2);
+ if (p_spspps_frames != NULL)
+ CSDInit(p_dec, p_spspps_frames, 2);
HXXXInitSize(p_dec, p_size_changed);
@@ -293,13 +293,13 @@ static int HEVCSetCSD(decoder_t *p_dec, bool *p_size_changed)
assert(hh->hevc.i_vps_count > 0 || hh->hevc.i_sps_count > 0 ||
hh->hevc.i_pps_count > 0 );
- block_t *p_xps_blocks = hevc_helper_get_annexb_config(hh);
- if (p_xps_blocks != NULL)
+ vlc_frame_t *p_xps_frames = hevc_helper_get_annexb_config(hh);
+ if (p_xps_frames != NULL)
{
- block_t *p_monolith = block_ChainGather(p_xps_blocks);
+ vlc_frame_t *p_monolith = vlc_frame_ChainGather(p_xps_frames);
if (p_monolith == NULL)
{
- block_ChainRelease(p_xps_blocks);
+ vlc_frame_ChainRelease(p_xps_frames);
return VLC_ENOMEM;
}
CSDInit(p_dec, p_monolith, 1);
@@ -317,12 +317,12 @@ static int ParseVideoExtraH264(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
int i_ret = hxxx_helper_set_extra(hh, p_extra, i_extra);
if (i_ret != VLC_SUCCESS)
return i_ret;
- assert(hh->pf_process_block != NULL);
+ assert(hh->pf_process_frame != NULL);
if (p_sys->api.i_quirks & MC_API_VIDEO_QUIRKS_ADAPTIVE)
p_sys->b_adaptive = true;
- p_sys->pf_on_new_block = VideoHXXX_OnNewBlock;
+ p_sys->pf_on_new_frame = VideoHXXX_OnNewFrame;
if (hh->h264.i_sps_count > 0 || hh->h264.i_pps_count > 0)
return H264SetCSD(p_dec, NULL);
@@ -337,12 +337,12 @@ static int ParseVideoExtraHEVC(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
int i_ret = hxxx_helper_set_extra(hh, p_extra, i_extra);
if (i_ret != VLC_SUCCESS)
return i_ret;
- assert(hh->pf_process_block != NULL);
+ assert(hh->pf_process_frame != NULL);
if (p_sys->api.i_quirks & MC_API_VIDEO_QUIRKS_ADAPTIVE)
p_sys->b_adaptive = true;
- p_sys->pf_on_new_block = VideoHXXX_OnNewBlock;
+ p_sys->pf_on_new_frame = VideoHXXX_OnNewFrame;
if (hh->hevc.i_vps_count > 0 || hh->hevc.i_sps_count > 0 ||
hh->hevc.i_pps_count > 0 )
@@ -371,7 +371,7 @@ static int ParseVideoExtraVc1(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
if (offset >= i_extra - 4)
return VLC_EGENERIC;
- p_sys->pf_on_new_block = VideoVC1_OnNewBlock;
+ p_sys->pf_on_new_frame = VideoVC1_OnNewFrame;
return CSDDup(p_dec, p_extra + offset, i_extra - offset);
}
@@ -430,7 +430,7 @@ static int ParseExtra(decoder_t *p_dec)
break;
case VLC_CODEC_MPGV:
case VLC_CODEC_MP2V:
- p_sys->pf_on_new_block = VideoMPEG2_OnNewBlock;
+ p_sys->pf_on_new_frame = VideoMPEG2_OnNewFrame;
break;
}
/* Set default CSD */
@@ -686,7 +686,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
p_dec->fmt_in.i_codec, false);
break;
}
- p_sys->pf_on_new_block = Video_OnNewBlock;
+ p_sys->pf_on_new_frame = Video_OnNewFrame;
p_sys->pf_on_flush = Video_OnFlush;
p_sys->pf_process_output = Video_ProcessOutput;
@@ -745,7 +745,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
}
else
{
- p_sys->pf_on_new_block = Audio_OnNewBlock;
+ p_sys->pf_on_new_frame = Audio_OnNewFrame;
p_sys->pf_on_flush = Audio_OnFlush;
p_sys->pf_process_output = Audio_ProcessOutput;
p_sys->audio.i_channels = p_dec->fmt_in.audio.i_channels;
@@ -794,7 +794,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
goto bailout;
}
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = DecodeFlush;
return VLC_SUCCESS;
@@ -926,17 +926,17 @@ static void RemoveInflightPictures(decoder_t *p_dec)
}
static int Video_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
- picture_t **pp_out_pic, block_t **pp_out_block)
+ picture_t **pp_out_pic, vlc_frame_t **pp_out_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- (void) pp_out_block;
+ (void) pp_out_frame;
assert(pp_out_pic);
if (p_out->type == MC_OUT_TYPE_BUF)
{
picture_t *p_pic = NULL;
- /* If the oldest input block had no PTS, the timestamp of
+ /* If the oldest input frame had no PTS, the timestamp of
* the frame returned by MediaCodec might be wrong so we
* overwrite it with the corresponding dts. Call FifoGet
* first in order to avoid a gap if buffers are released
@@ -1064,15 +1064,15 @@ static uint32_t pi_audio_order_src[] =
};
static int Audio_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
- picture_t **pp_out_pic, block_t **pp_out_block)
+ picture_t **pp_out_pic, vlc_frame_t **pp_out_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
(void) pp_out_pic;
- assert(pp_out_block);
+ assert(pp_out_frame);
if (p_out->type == MC_OUT_TYPE_BUF)
{
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
if (p_out->buf.p_ptr == NULL)
{
/* This can happen when receiving an EOS buffer */
@@ -1085,38 +1085,38 @@ static int Audio_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
return p_sys->api.release_out(&p_sys->api, p_out->buf.i_index, false);
}
- p_block = block_Alloc(p_out->buf.i_size);
- if (!p_block)
+ p_frame = vlc_frame_Alloc(p_out->buf.i_size);
+ if (!p_frame)
return -1;
- p_block->i_nb_samples = p_out->buf.i_size
+ p_frame->i_nb_samples = p_out->buf.i_size
/ p_dec->fmt_out.audio.i_bytes_per_frame;
if (p_sys->audio.b_extract)
{
- aout_ChannelExtract(p_block->p_buffer,
+ aout_ChannelExtract(p_frame->p_buffer,
p_dec->fmt_out.audio.i_channels,
p_out->buf.p_ptr, p_sys->audio.i_channels,
- p_block->i_nb_samples, p_sys->audio.pi_extraction,
+ p_frame->i_nb_samples, p_sys->audio.pi_extraction,
p_dec->fmt_out.audio.i_bitspersample);
}
else
- memcpy(p_block->p_buffer, p_out->buf.p_ptr, p_out->buf.i_size);
+ memcpy(p_frame->p_buffer, p_out->buf.p_ptr, p_out->buf.i_size);
if (p_out->buf.i_ts != 0
&& p_out->buf.i_ts != date_Get(&p_sys->audio.i_end_date))
date_Set(&p_sys->audio.i_end_date, p_out->buf.i_ts);
- p_block->i_pts = date_Get(&p_sys->audio.i_end_date);
- p_block->i_length = date_Increment(&p_sys->audio.i_end_date,
- p_block->i_nb_samples)
- - p_block->i_pts;
+ p_frame->i_pts = date_Get(&p_sys->audio.i_end_date);
+ p_frame->i_length = date_Increment(&p_sys->audio.i_end_date,
+ p_frame->i_nb_samples)
+ - p_frame->i_pts;
if (p_sys->api.release_out(&p_sys->api, p_out->buf.i_index, false))
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return -1;
}
- *pp_out_block = p_block;
+ *pp_out_frame = p_frame;
return 1;
} else {
uint32_t i_layout_dst;
@@ -1261,10 +1261,10 @@ static void *OutThread(void *data)
if (i_ret == 1)
{
picture_t *p_pic = NULL;
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
if (p_sys->pf_process_output(p_dec, &out, &p_pic,
- &p_block) == -1 && !out.b_eos)
+ &p_frame) == -1 && !out.b_eos)
{
msg_Err(p_dec, "pf_process_output failed");
vlc_restorecancel(canc);
@@ -1272,8 +1272,8 @@ static void *OutThread(void *data)
}
if (p_pic)
decoder_QueueVideo(p_dec, p_pic);
- else if (p_block)
- decoder_QueueAudio(p_dec, p_block);
+ else if (p_frame)
+ decoder_QueueAudio(p_dec, p_frame);
if (out.b_eos)
{
@@ -1307,19 +1307,19 @@ static void *OutThread(void *data)
return NULL;
}
-static block_t *GetNextBlock(decoder_sys_t *p_sys, block_t *p_block)
+static vlc_frame_t *GetNextFrame(decoder_sys_t *p_sys, vlc_frame_t *p_frame)
{
if (p_sys->i_csd_send < p_sys->i_csd_count)
return p_sys->pp_csd[p_sys->i_csd_send++];
else
- return p_block;
+ return p_frame;
}
-static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
+static int QueueFrameLocked(decoder_t *p_dec, vlc_frame_t *p_in_frame,
bool b_drain)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
bool b_dequeue_timeout = false;
assert(p_sys->api.b_started);
@@ -1328,8 +1328,8 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
&& !p_sys->b_adaptive)
return VLC_EGENERIC; /* Wait for CSDs */
- /* Queue CSD blocks and input blocks */
- while (b_drain || (p_block = GetNextBlock(p_sys, p_in_block)))
+ /* Queue CSD frames and input frames */
+ while (b_drain || (p_frame = GetNextFrame(p_sys, p_in_frame)))
{
int i_index;
@@ -1352,26 +1352,26 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
if (i_index >= 0)
{
- assert(b_drain || p_block != NULL);
- if (p_block != NULL)
+ assert(b_drain || p_frame != NULL);
+ if (p_frame != NULL)
{
- b_config = (p_block->i_flags & BLOCK_FLAG_CSD);
+ b_config = (p_frame->i_flags & FRAME_FLAG_CSD);
if (!b_config)
{
- i_ts = p_block->i_pts;
- if (!i_ts && p_block->i_dts)
- i_ts = p_block->i_dts;
+ i_ts = p_frame->i_pts;
+ if (!i_ts && p_frame->i_dts)
+ i_ts = p_frame->i_dts;
}
- p_buf = p_block->p_buffer;
- i_size = p_block->i_buffer;
+ p_buf = p_frame->p_buffer;
+ i_size = p_frame->i_buffer;
}
if (p_sys->api.queue_in(&p_sys->api, i_index, p_buf, i_size,
i_ts, b_config) == 0)
{
- if (!b_config && p_block != NULL)
+ if (!b_config && p_frame != NULL)
{
- if (p_block->i_flags & BLOCK_FLAG_PREROLL)
+ if (p_frame->i_flags & FRAME_FLAG_PREROLL)
p_sys->i_preroll_end = i_ts;
/* One input buffer is queued, signal OutThread that will
@@ -1379,8 +1379,8 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
p_sys->b_output_ready = true;
vlc_cond_broadcast(&p_sys->cond);
- assert(p_block == p_in_block),
- p_in_block = NULL;
+ assert(p_frame == p_in_frame),
+ p_in_frame = NULL;
}
b_dequeue_timeout = false;
if (b_drain)
@@ -1398,7 +1398,7 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
* Vout is paused and when the Decoder is flushing. In that case,
* the Vout won't release any output buffers, therefore MediaCodec
* won't dequeue any input buffers. To work around this issue,
- * release all output buffers if DecodeBlock is waiting more than
+ * release all output buffers if DecodeFrame is waiting more than
* 2secs for a new input buffer. */
if (!b_dequeue_timeout)
{
@@ -1446,7 +1446,7 @@ error:
return VLC_EGENERIC;
}
-static int DecodeBlock(decoder_t *p_dec, block_t *p_in_block)
+static int DecodeFrame(decoder_t *p_dec, vlc_frame_t *p_in_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
int i_ret;
@@ -1461,28 +1461,28 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_in_block)
goto reload;
}
- if (p_in_block == NULL)
+ if (p_in_frame == NULL)
{
- /* No input block, decoder is draining */
+ /* No input frame, decoder is draining */
msg_Err(p_dec, "Decoder is draining");
if (p_sys->b_output_ready)
- QueueBlockLocked(p_dec, NULL, true);
+ QueueFrameLocked(p_dec, NULL, true);
goto end;
}
- if (p_in_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
+ if (p_in_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED))
{
if (p_sys->b_output_ready)
- QueueBlockLocked(p_dec, NULL, true);
+ QueueFrameLocked(p_dec, NULL, true);
DecodeFlushLocked(p_dec);
if (p_sys->b_aborted)
goto end;
- if (p_in_block->i_flags & BLOCK_FLAG_CORRUPTED)
+ if (p_in_frame->i_flags & FRAME_FLAG_CORRUPTED)
goto end;
}
- if (p_in_block->i_flags & BLOCK_FLAG_INTERLACED_MASK
+ if (p_in_frame->i_flags & FRAME_FLAG_INTERLACED_MASK
&& !(p_sys->api.i_quirks & MC_API_VIDEO_QUIRKS_SUPPORT_INTERLACED))
{
/* Before Android 21 and depending on the vendor, MediaCodec can
@@ -1493,25 +1493,25 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_in_block)
goto reload;
}
- /* Parse input block */
- if ((i_ret = p_sys->pf_on_new_block(p_dec, &p_in_block)) != 1)
+ /* Parse input frame */
+ if ((i_ret = p_sys->pf_on_new_frame(p_dec, &p_in_frame)) != 1)
{
if (i_ret != 0)
{
AbortDecoderLocked(p_dec);
- msg_Err(p_dec, "pf_on_new_block failed");
+ msg_Err(p_dec, "pf_on_new_frame failed");
}
goto end;
}
if (p_sys->i_decode_flags & (DECODE_FLAG_DRAIN|DECODE_FLAG_RESTART))
{
- msg_Warn(p_dec, "Draining from DecodeBlock");
+ msg_Warn(p_dec, "Draining from DecodeFrame");
const bool b_restart = p_sys->i_decode_flags & DECODE_FLAG_RESTART;
p_sys->i_decode_flags = 0;
/* Drain and flush before restart to unblock OutThread */
if (p_sys->b_output_ready)
- QueueBlockLocked(p_dec, NULL, true);
+ QueueFrameLocked(p_dec, NULL, true);
DecodeFlushLocked(p_dec);
if (p_sys->b_aborted)
goto end;
@@ -1524,7 +1524,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_in_block)
switch (i_ret)
{
case VLC_SUCCESS:
- msg_Warn(p_dec, "Restarted from DecodeBlock");
+ msg_Warn(p_dec, "Restarted from DecodeFrame");
break;
case VLC_ENOOBJ:
break;
@@ -1538,12 +1538,12 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_in_block)
/* Abort if MediaCodec is not yet started */
if (p_sys->api.b_started)
- QueueBlockLocked(p_dec, p_in_block, false);
+ QueueframeLocked(p_dec, p_in_frame, false);
end:
- if (p_in_block)
- block_Release(p_in_block);
- /* Too late to reload here, we already modified/released the input block,
+ if (p_in_frame)
+ vlc_frame_Release(p_in_frame);
+ /* Too late to reload here, we already modified/released the input frame,
* do it next time. */
int ret = p_sys->b_aborted && p_sys->b_has_format ? VLCDEC_ECRITICAL
: VLCDEC_SUCCESS;
@@ -1558,26 +1558,26 @@ reload:
return VLCDEC_RELOAD;
}
-static int Video_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
+static int Video_OnNewFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
timestamp_FifoPut(p_sys->video.timestamp_fifo,
- p_block->i_pts ? VLC_TICK_INVALID : p_block->i_dts);
+ p_frame->i_pts ? VLC_TICK_INVALID : p_frame->i_dts);
return 1;
}
-static int VideoHXXX_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
+static int VideoHXXX_OnNewFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
struct hxxx_helper *hh = &p_sys->video.hh;
bool b_config_changed = false;
bool *p_config_changed = p_sys->b_adaptive ? NULL : &b_config_changed;
- *pp_block = hh->pf_process_block(hh, *pp_block, p_config_changed);
- if (!*pp_block)
+ *pp_frame = hh->pf_process_frame(hh, *pp_frame, p_config_changed);
+ if (!*pp_frame)
return 0;
if (b_config_changed)
{
@@ -1614,16 +1614,16 @@ static int VideoHXXX_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
}
}
- return Video_OnNewBlock(p_dec, pp_block);
+ return Video_OnNewFrame(p_dec, pp_frame);
}
-static int VideoMPEG2_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
+static int VideoMPEG2_OnNewFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
- if (pp_block == NULL || (*pp_block)->i_buffer <= 7)
+ if (pp_frame == NULL || (*pp_frame)->i_buffer <= 7)
return 1;
decoder_sys_t *p_sys = p_dec->p_sys;
- const int startcode = (*pp_block)->p_buffer[3];
+ const int startcode = (*pp_frame)->p_buffer[3];
/* DAR aspect ratio from the DVD MPEG2 standard */
static const int mpeg2_aspect[16][2] =
@@ -1638,7 +1638,7 @@ static int VideoMPEG2_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
if (startcode == 0xB3 /* SEQUENCE_HEADER_STARTCODE */)
{
- int mpeg_dar_code = (*pp_block)->p_buffer[7] >> 4;
+ int mpeg_dar_code = (*pp_frame)->p_buffer[7] >> 4;
if (mpeg_dar_code >= 16)
return 0;
@@ -1650,20 +1650,20 @@ static int VideoMPEG2_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
return 1;
}
-static int VideoVC1_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
+static int VideoVC1_OnNewFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
/* Adding frame start code */
- p_block = *pp_block = block_Realloc(p_block, 4, p_block->i_buffer);
- if (p_block == NULL)
+ p_frame = *pp_frame = vlc_frame_Realloc(p_frame, 4, p_frame->i_buffer);
+ if (p_frame == NULL)
return VLC_ENOMEM;
- p_block->p_buffer[0] = 0x00;
- p_block->p_buffer[1] = 0x00;
- p_block->p_buffer[2] = 0x01;
- p_block->p_buffer[3] = 0x0d;
+ p_frame->p_buffer[0] = 0x00;
+ p_frame->p_buffer[1] = 0x00;
+ p_frame->p_buffer[2] = 0x01;
+ p_frame->p_buffer[3] = 0x0d;
- return Video_OnNewBlock(p_dec, pp_block);
+ return Video_OnNewFrame(p_dec, pp_frame);
}
static void Video_OnFlush(decoder_t *p_dec)
@@ -1678,17 +1678,17 @@ static void Video_OnFlush(decoder_t *p_dec)
InvalidateAllPictures(p_dec);
}
-static int Audio_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
+static int Audio_OnNewFrame(decoder_t *p_dec, vlc_frame_t **pp_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
/* We've just started the stream, wait for the first PTS. */
if (date_Get(&p_sys->audio.i_end_date) == VLC_TICK_INVALID)
{
- if (p_block->i_pts == VLC_TICK_INVALID)
+ if (p_frame->i_pts == VLC_TICK_INVALID)
return 0;
- date_Set(&p_sys->audio.i_end_date, p_block->i_pts);
+ date_Set(&p_sys->audio.i_end_date, p_frame->i_pts);
}
return 1;
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 5f3a5370b3..299dda2808 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -32,7 +32,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_cpu.h>
#include "../../packetizer/h264_nal.h"
#include "../../packetizer/hevc_nal.h"
@@ -65,9 +65,9 @@ static int OpenEncoder( vlc_object_t * );
static int OpenGeneric( vlc_object_t *, bool b_encode );
static void CloseGeneric( vlc_object_t * );
-static int DecodeVideo( decoder_t *, block_t * );
-static int DecodeAudio ( decoder_t *, block_t * );
-static block_t *EncodeVideo( encoder_t *, picture_t * );
+static int DecodeVideo( decoder_t *, vlc_frame_t * );
+static int DecodeAudio ( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *EncodeVideo( encoder_t *, picture_t * );
static void Flush( decoder_t * );
static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE, OMX_PTR, OMX_EVENTTYPE,
@@ -1267,12 +1267,12 @@ error:
return -1;
}
-static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_block,
+static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, vlc_frame_t **pp_frame,
unsigned int i_input_used, bool *p_reconfig )
{
decoder_sys_t *p_sys = p_dec->p_sys;
OMX_BUFFERHEADERTYPE *p_header;
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
/* Send the input buffer to the component */
OMX_FIFO_GET_TIMEOUT(&p_port->fifo, p_header, 10000);
@@ -1287,21 +1287,21 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
if(p_header)
{
bool decode_more = false;
- p_header->nFilledLen = p_block->i_buffer - i_input_used;
+ p_header->nFilledLen = p_frame->i_buffer - i_input_used;
p_header->nOffset = 0;
p_header->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
- if (p_sys->b_use_pts && p_block->i_pts)
- p_header->nTimeStamp = ToOmxTicks(p_block->i_pts);
+ if (p_sys->b_use_pts && p_frame->i_pts)
+ p_header->nTimeStamp = ToOmxTicks(p_frame->i_pts);
else
- p_header->nTimeStamp = ToOmxTicks(p_block->i_dts);
+ p_header->nTimeStamp = ToOmxTicks(p_frame->i_dts);
/* In direct mode we pass the input pointer as is.
* Otherwise we memcopy the data */
if(p_port->b_direct)
{
p_header->pOutputPortPrivate = p_header->pBuffer;
- p_header->pBuffer = p_block->p_buffer;
- p_header->pAppPrivate = p_block;
+ p_header->pBuffer = p_frame->p_buffer;
+ p_header->pAppPrivate = p_frame;
i_input_used = p_header->nFilledLen;
}
else
@@ -1310,11 +1310,11 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
{
p_header->nFilledLen = p_header->nAllocLen;
}
- memcpy(p_header->pBuffer, p_block->p_buffer + i_input_used, p_header->nFilledLen);
+ memcpy(p_header->pBuffer, p_frame->p_buffer + i_input_used, p_header->nFilledLen);
i_input_used += p_header->nFilledLen;
- if (i_input_used == p_block->i_buffer)
+ if (i_input_used == p_frame->i_buffer)
{
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
}
else
{
@@ -1334,10 +1334,10 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
OMX_EmptyThisBuffer(p_port->omx_handle, p_header);
p_port->b_flushed = false;
if (decode_more)
- return DecodeVideoInput( p_dec, p_port, pp_block, i_input_used,
+ return DecodeVideoInput( p_dec, p_port, pp_frame, i_input_used,
p_reconfig );
else
- *pp_block = NULL; /* Avoid being fed the same packet again */
+ *pp_frame = NULL; /* Avoid being fed the same packet again */
}
return 0;
@@ -1361,26 +1361,26 @@ static void Flush( decoder_t *p_dec )
/*****************************************************************************
* DecodeVideo: Called to decode one frame
*****************************************************************************/
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
OMX_ERRORTYPE omx_error;
unsigned int i;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
/* Check for errors from codec */
if(p_sys->b_error)
{
msg_Dbg(p_dec, "error during decoding");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- 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 );
Flush( p_dec );
return VLCDEC_SUCCESS;
}
@@ -1399,13 +1399,13 @@ static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
}
/* Loop as long as we haven't either got an input buffer (and cleared
- * *pp_block) or got an output picture */
+ * *pp_frame) or got an output picture */
int max_polling_attempts = 100;
int attempts = 0;
- while( p_block ) {
+ while( p_frame ) {
bool b_reconfig = false;
- if( DecodeVideoInput( p_dec, &p_sys->in, &p_block, 0, &b_reconfig ) != 0 )
+ if( DecodeVideoInput( p_dec, &p_sys->in, &p_frame, 0, &b_reconfig ) != 0 )
goto error;
picture_t *p_pic = NULL;
@@ -1449,27 +1449,27 @@ error:
/*****************************************************************************
* DecodeAudio: Called to decode one frame
*****************************************************************************/
-int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
+int DecodeAudio ( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
OMX_BUFFERHEADERTYPE *p_header;
OMX_ERRORTYPE omx_error;
unsigned int i;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
/* Check for errors from codec */
if(p_sys->b_error)
{
msg_Dbg(p_dec, "error during decoding");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- 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 );
date_Set( &p_sys->end_date, VLC_TICK_INVALID );
if(!p_sys->in.b_flushed)
{
@@ -1483,17 +1483,17 @@ int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
- if( !p_block->i_pts )
+ if( !p_frame->i_pts )
{
/* We've just started the stream, wait for the first PTS. */
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
/* Take care of decoded frames first */
- while (p_block != NULL)
+ while (p_frame != NULL)
{
unsigned int i_samples = 0;
@@ -1506,7 +1506,7 @@ int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
{
if( decoder_UpdateAudioFormat( p_dec ) )
break;
- block_t *p_buffer = decoder_NewAudioBuffer( p_dec, i_samples );
+ vlc_frame_t *p_buffer = decoder_NewAudioBuffer( p_dec, i_samples );
if( !p_buffer ) break; /* No audio buffer available */
memcpy( p_buffer->p_buffer, p_header->pBuffer, p_buffer->i_buffer );
@@ -1539,18 +1539,18 @@ int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
if (!p_header)
continue;
- p_header->nFilledLen = p_block->i_buffer;
+ p_header->nFilledLen = p_frame->i_buffer;
p_header->nOffset = 0;
p_header->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
- p_header->nTimeStamp = ToOmxTicks(p_block->i_dts);
+ p_header->nTimeStamp = ToOmxTicks(p_frame->i_dts);
/* In direct mode we pass the input pointer as is.
* Otherwise we memcopy the data */
if(p_sys->in.b_direct)
{
p_header->pOutputPortPrivate = p_header->pBuffer;
- p_header->pBuffer = p_block->p_buffer;
- p_header->pAppPrivate = p_block;
+ p_header->pBuffer = p_frame->p_buffer;
+ p_header->pAppPrivate = p_frame;
}
else
{
@@ -1561,15 +1561,15 @@ int DecodeAudio ( decoder_t *p_dec, block_t *p_block )
(unsigned)p_header->nAllocLen);
p_header->nFilledLen = p_header->nAllocLen;
}
- memcpy(p_header->pBuffer, p_block->p_buffer, p_header->nFilledLen );
- block_Release(p_block);
+ memcpy(p_header->pBuffer, p_frame->p_buffer, p_header->nFilledLen );
+ vlc_frame_Release(p_frame);
}
OMX_DBG( "EmptyThisBuffer %p, %p, %u", (void *)p_header,
(void *)p_header->pBuffer, (unsigned)p_header->nFilledLen );
OMX_EmptyThisBuffer(p_sys->omx_handle, p_header);
p_sys->in.b_flushed = false;
- p_block = NULL;
+ p_frame = NULL;
}
reconfig:
@@ -1592,7 +1592,7 @@ error:
/*****************************************************************************
* EncodeVideo: Called to encode one frame
*****************************************************************************/
-static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
+static vlc_frame_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
{
decoder_t *p_dec = ( decoder_t *)p_enc;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -1600,7 +1600,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
unsigned int i;
OMX_BUFFERHEADERTYPE *p_header;
- block_t *p_block = 0;
+ vlc_frame_t *p_frame = 0;
if( !p_pic ) return NULL;
@@ -1648,7 +1648,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
}
/* Wait for the decoded frame */
- while(!p_block)
+ while(!p_frame)
{
OMX_FIFO_GET(&p_sys->out.fifo, p_header);
@@ -1660,17 +1660,17 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
msg_Dbg(p_dec, "received codec config %i", (int)p_header->nFilledLen);
}
- p_block = p_header->pAppPrivate;
- if(!p_block)
+ p_frame = p_header->pAppPrivate;
+ if(!p_frame)
{
/* We're not in direct rendering mode.
- * Get a new block and copy the content */
- p_block = block_Alloc( p_header->nFilledLen );
- memcpy(p_block->p_buffer, p_header->pBuffer, p_header->nFilledLen );
+ * Get a new frame and copy the content */
+ p_frame = vlc_frame_Alloc( p_header->nFilledLen );
+ memcpy(p_frame->p_buffer, p_header->pBuffer, p_header->nFilledLen );
}
- p_block->i_buffer = p_header->nFilledLen;
- p_block->i_pts = p_block->i_dts = FromOmxTicks(p_header->nTimeStamp);
+ p_frame->i_buffer = p_header->nFilledLen;
+ p_frame->i_pts = p_frame->i_dts = FromOmxTicks(p_header->nTimeStamp);
p_header->nFilledLen = 0;
p_header->pAppPrivate = 0;
}
@@ -1681,7 +1681,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
}
msg_Dbg(p_dec, "done");
- return p_block;
+ return p_frame;
error:
p_sys->b_error = true;
return NULL;
@@ -1775,9 +1775,9 @@ static OMX_ERRORTYPE OmxEmptyBufferDone( OMX_HANDLETYPE omx_handle,
if(omx_header->pAppPrivate || omx_header->pOutputPortPrivate)
{
- block_t *p_block = (block_t *)omx_header->pAppPrivate;
+ vlc_frame_t *p_frame = (vlc_frame_t *)omx_header->pAppPrivate;
omx_header->pBuffer = omx_header->pOutputPortPrivate;
- if(p_block) block_Release(p_block);
+ if(p_frame) vlc_frame_Release(p_frame);
omx_header->pAppPrivate = 0;
}
OMX_FIFO_PUT(&p_sys->in.fifo, omx_header);
diff --git a/modules/codec/omxil/omxil_core.c b/modules/codec/omxil/omxil_core.c
index 5fe0f9a9bf..c233220957 100644
--- a/modules/codec/omxil/omxil_core.c
+++ b/modules/codec/omxil/omxil_core.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_cpu.h>
#include "omxil.h"
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index b6a707751c..5bc51978f4 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.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_cpu.h>
#include "omxil.h"
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index 62855d1cc4..7e343856b3 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -154,13 +154,13 @@ static const uint32_t pi_3channels_in[] =
* Local prototypes
****************************************************************************/
-static int DecodeAudio ( decoder_t *, block_t * );
+static int DecodeAudio ( decoder_t *, vlc_frame_t * );
static void Flush( decoder_t * );
static int ProcessHeaders( decoder_t * );
static int ProcessInitialHeader ( decoder_t *, ogg_packet * );
-static block_t *ProcessPacket( decoder_t *, ogg_packet *, block_t * );
+static vlc_frame_t *ProcessPacket( decoder_t *, ogg_packet *, vlc_frame_t * );
-static block_t *DecodePacket( decoder_t *, ogg_packet *, int, vlc_tick_t );
+static vlc_frame_t *DecodePacket( decoder_t *, ogg_packet *, int, vlc_tick_t );
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
@@ -192,18 +192,18 @@ static int OpenDecoder( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket;
- /* Block to Ogg packet */
- oggpacket.packet = p_block->p_buffer;
- oggpacket.bytes = p_block->i_buffer;
+ /* Frame to Ogg packet */
+ oggpacket.packet = p_frame->p_buffer;
+ oggpacket.bytes = p_frame->i_buffer;
oggpacket.granulepos = -1;
oggpacket.b_o_s = 0;
@@ -215,23 +215,23 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
if( ProcessHeaders( p_dec ) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket( p_dec, &oggpacket, p_block );
+ return ProcessPacket( p_dec, &oggpacket, p_frame );
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- p_block = DecodeBlock( p_dec, p_block );
- if( p_block != NULL )
- decoder_QueueAudio( p_dec, p_block );
+ p_frame = DecodeFrame( p_dec, p_frame );
+ if( p_frame != NULL )
+ decoder_QueueAudio( p_dec, p_frame );
return VLCDEC_SUCCESS;
}
@@ -406,51 +406,51 @@ static void Flush( decoder_t *p_dec )
/*****************************************************************************
* ProcessPacket: processes a Opus packet.
*****************************************************************************/
-static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
- block_t *p_block )
+static vlc_frame_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
+ vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
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;
}
}
/* Date management */
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
if( 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;
}
/* trimming info */
- vlc_tick_t i_max_duration = (p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE) ?
- p_block->i_length : 0;
+ vlc_tick_t i_max_duration = (p_frame->i_flags & FRAME_FLAG_END_OF_SEQUENCE) ?
+ p_frame->i_length : 0;
- block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket,
- p_block->i_nb_samples,
+ vlc_frame_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket,
+ p_frame->i_nb_samples,
i_max_duration );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return p_aout_buffer;
}
/*****************************************************************************
* DecodePacket: decodes a Opus packet.
*****************************************************************************/
-static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
+static vlc_frame_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
int i_nb_samples, vlc_tick_t i_duration )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -470,7 +470,7 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
if( decoder_UpdateAudioFormat( p_dec ) )
return NULL;
- block_t *p_aout_buffer=decoder_NewAudioBuffer( p_dec, spp );
+ vlc_frame_t *p_aout_buffer=decoder_NewAudioBuffer( p_dec, spp );
if ( !p_aout_buffer )
{
msg_Err(p_dec, "Oops: No new buffer was returned!");
@@ -489,7 +489,7 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
if( spp < 0 || i_nb_samples <= 0 || i_end_trim >= i_nb_samples)
{
- block_Release(p_aout_buffer);
+ vlc_frame_Release(p_aout_buffer);
if( spp < 0 )
msg_Err( p_dec, "Error: corrupted stream?" );
return NULL;
@@ -550,11 +550,11 @@ typedef struct
float *buffer;
unsigned i_nb_samples;
int i_samples_delay;
- block_t *padding;
+ vlc_frame_t *padding;
int nb_streams;
} encoder_sys_t;
-static unsigned fill_buffer(encoder_t *enc, unsigned src_start, block_t *src,
+static unsigned fill_buffer(encoder_t *enc, unsigned src_start, vlc_frame_t *src,
unsigned samples)
{
encoder_sys_t *p_sys = enc->p_sys;
@@ -572,7 +572,7 @@ static unsigned fill_buffer(encoder_t *enc, unsigned src_start, block_t *src,
return src_start;
}
-static block_t *Encode(encoder_t *enc, block_t *buf)
+static vlc_frame_t *Encode(encoder_t *enc, vlc_frame_t *buf)
{
encoder_sys_t *sys = enc->p_sys;
@@ -585,7 +585,7 @@ static block_t *Encode(encoder_t *enc, block_t *buf)
sys->i_samples_delay += buf->i_nb_samples;
- block_t *result = NULL;
+ vlc_frame_t *result = NULL;
unsigned src_start = 0;
unsigned padding_start = 0;
/* The maximum Opus frame size is 1275 bytes + TOC sequence length. */
@@ -593,7 +593,7 @@ static block_t *Encode(encoder_t *enc, block_t *buf)
while (sys->i_nb_samples + buf->i_nb_samples >= OPUS_FRAME_SIZE)
{
- block_t *out_block = block_Alloc(OPUS_MAX_ENCODED_BYTES);
+ vlc_frame_t *out_frame = vlc_frame_Alloc(OPUS_MAX_ENCODED_BYTES);
/* add padding to beginning */
if (sys->padding)
@@ -603,7 +603,7 @@ static block_t *Encode(encoder_t *enc, block_t *buf)
__MIN(sys->padding->i_nb_samples, leftover_space));
if (sys->padding->i_nb_samples <= 0)
{
- block_Release(sys->padding);
+ vlc_frame_Release(sys->padding);
sys->padding = NULL;
}
}
@@ -618,27 +618,27 @@ static block_t *Encode(encoder_t *enc, block_t *buf)
}
opus_int32 bytes_encoded = opus_multistream_encode_float(sys->enc, sys->buffer,
- OPUS_FRAME_SIZE, out_block->p_buffer, out_block->i_buffer);
+ OPUS_FRAME_SIZE, out_frame->p_buffer, out_frame->i_buffer);
if (bytes_encoded < 0)
{
- block_Release(out_block);
+ vlc_frame_Release(out_frame);
}
else
{
- out_block->i_length = vlc_tick_from_samples( OPUS_FRAME_SIZE,
+ out_frame->i_length = vlc_tick_from_samples( OPUS_FRAME_SIZE,
enc->fmt_in.audio.i_rate );
- out_block->i_dts = out_block->i_pts = i_pts;
+ out_frame->i_dts = out_frame->i_pts = i_pts;
sys->i_samples_delay -= OPUS_FRAME_SIZE;
- i_pts += out_block->i_length;
+ i_pts += out_frame->i_length;
sys->i_nb_samples = 0;
- out_block->i_buffer = bytes_encoded;
- block_ChainAppend(&result, out_block);
+ out_frame->i_buffer = bytes_encoded;
+ vlc_frame_ChainAppend(&result, out_frame);
}
}
@@ -731,7 +731,7 @@ static int OpenEncoder(vlc_object_t *p_this)
{
const unsigned padding_samples = sys->i_samples_delay *
enc->fmt_out.audio.i_channels;
- sys->padding = block_Alloc(padding_samples * sizeof(float));
+ sys->padding = vlc_frame_Alloc(padding_samples * sizeof(float));
if (!sys->padding) {
status = VLC_ENOMEM;
goto error;
@@ -762,7 +762,7 @@ static void CloseEncoder(vlc_object_t *p_this)
opus_multistream_encoder_destroy(sys->enc);
if (sys->padding)
- block_Release(sys->padding);
+ vlc_frame_Release(sys->padding);
free(sys->buffer);
free(sys);
}
diff --git a/modules/codec/png.c b/modules/codec/png.c
index 402459d8e1..3943f8e281 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -65,7 +65,7 @@ typedef struct
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeBlock ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
/*
* png encoder descriptor
@@ -79,7 +79,7 @@ typedef struct
static int OpenEncoder(vlc_object_t *);
static void CloseEncoder(vlc_object_t *);
-static block_t *EncodeBlock(encoder_t *, picture_t *);
+static vlc_frame_t *EncodeFrame(encoder_t *, picture_t *);
/*****************************************************************************
* Module descriptor
@@ -128,22 +128,22 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.video.color_range = COLOR_RANGE_FULL;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
return VLC_SUCCESS;
}
static void user_read( png_structp p_png, png_bytep data, png_size_t i_length )
{
- block_t *p_block = (block_t *)png_get_io_ptr( p_png );
- if( i_length > p_block->i_buffer ) {
+ vlc_frame_t *p_frame = (vlc_frame_t *)png_get_io_ptr( p_png );
+ if( i_length > p_frame->i_buffer ) {
png_error( p_png, "not enough data" );
return;
}
- memcpy( data, p_block->p_buffer, i_length );
- p_block->p_buffer += i_length;
- p_block->i_buffer -= i_length;
+ memcpy( data, p_frame->p_buffer, i_length );
+ p_frame->p_buffer += i_length;
+ p_frame->i_buffer -= i_length;
}
static void user_flush( png_structp p_png )
@@ -154,19 +154,19 @@ static void user_flush( png_structp p_png )
static void user_write( png_structp p_png, png_bytep data, png_size_t i_length )
{
- block_t *p_block = (block_t *)png_get_io_ptr( p_png );
- if( i_length > p_block->i_buffer ) {
+ vlc_frame_t *p_frame = (vlc_frame_t *)png_get_io_ptr( p_png );
+ if( i_length > p_frame->i_buffer ) {
char err_str[64];
snprintf( err_str, sizeof(err_str),
"block size %zu too small for %zu encoded bytes",
- p_block->i_buffer, i_length );
+ p_frame->i_buffer, i_length );
png_error( p_png, err_str );
return;
}
- memcpy( p_block->p_buffer, data, i_length );
- p_block->p_buffer += i_length;
- p_block->i_buffer -= i_length;
+ memcpy( p_frame->p_buffer, data, i_length );
+ p_frame->p_buffer += i_length;
+ p_frame->i_buffer -= i_length;
}
static void user_error( png_structp p_png, png_const_charp error_msg )
@@ -183,11 +183,11 @@ static void user_warning( png_structp p_png, png_const_charp warning_msg )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with a complete compressed frame.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic = 0;
@@ -200,21 +200,21 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
png_infop p_info, p_end_info;
png_bytep *volatile p_row_pointers = NULL;
- if( !p_block ) /* No Drain */
+ if( !p_frame ) /* No Drain */
return VLCDEC_SUCCESS;
p_sys->b_error = false;
- 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 VLCDEC_SUCCESS;
}
p_png = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
if( p_png == NULL )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -222,7 +222,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( p_info == NULL )
{
png_destroy_read_struct( &p_png, NULL, NULL );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -230,7 +230,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( p_end_info == NULL )
{
png_destroy_read_struct( &p_png, &p_info, NULL );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -238,7 +238,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( setjmp( png_jmpbuf( p_png ) ) )
goto error;
- png_set_read_fn( p_png, p_block, user_read );
+ png_set_read_fn( p_png, p_frame, user_read );
png_set_error_fn( p_png, p_sys, user_error, user_warning );
png_read_info( p_png, p_info );
@@ -305,9 +305,9 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
png_destroy_read_struct( &p_png, &p_info, &p_end_info );
free( p_row_pointers );
- p_pic->date = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ p_pic->date = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
@@ -315,7 +315,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
free( p_row_pointers );
png_destroy_read_struct( &p_png, &p_info, &p_end_info );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -352,15 +352,15 @@ static int OpenEncoder(vlc_object_t *p_this)
p_enc->fmt_in.video.i_bmask = 0;
video_format_FixRgb( &p_enc->fmt_in.video );
- p_enc->pf_encode_video = EncodeBlock;
+ p_enc->pf_encode_video = EncodeFrame;
return VLC_SUCCESS;
}
/*
- * EncodeBlock
+ * EncodeFrame
*/
-static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
+static vlc_frame_t *EncodeFrame(encoder_t *p_enc, picture_t *p_pic)
{
encoder_sys_t *p_sys = p_enc->p_sys;
@@ -369,8 +369,8 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
return NULL;
}
- block_t *p_block = block_Alloc( p_sys->i_blocksize );
- if( p_block == NULL )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( p_sys->i_blocksize );
+ if( p_frame == NULL )
{
return NULL;
}
@@ -378,7 +378,7 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
png_structp p_png = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 );
if( p_png == NULL )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
@@ -388,8 +388,8 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
png_set_compression_level( p_png, 1 );
/* save buffer start */
- uint8_t *p_start = p_block->p_buffer;
- size_t i_start = p_block->i_buffer;
+ uint8_t *p_start = p_frame->p_buffer;
+ size_t i_start = p_frame->i_buffer;
p_sys->b_error = false;
png_infop p_info = NULL;
@@ -398,7 +398,7 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
if( setjmp( png_jmpbuf( p_png ) ) )
goto error;
- png_set_write_fn( p_png, p_block, user_write, user_flush );
+ png_set_write_fn( p_png, p_frame, user_write, user_flush );
png_set_error_fn( p_png, p_sys, user_error, user_warning );
p_info = png_create_info_struct( p_png );
@@ -429,18 +429,18 @@ static block_t *EncodeBlock(encoder_t *p_enc, picture_t *p_pic)
png_destroy_write_struct( &p_png, &p_info );
/* restore original buffer position */
- p_block->p_buffer = p_start;
- p_block->i_buffer = i_start - p_block->i_buffer;
+ p_frame->p_buffer = p_start;
+ p_frame->i_buffer = i_start - p_frame->i_buffer;
- p_block->i_dts = p_block->i_pts = p_pic->date;
+ p_frame->i_dts = p_frame->i_pts = p_pic->date;
- return p_block;
+ return p_frame;
error:
png_destroy_write_struct( &p_png, p_info ? &p_info : NULL );
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index 743fab5a90..c91a579a24 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -278,7 +278,7 @@ typedef struct async_task_t
fifo_item_t fifo;
mfxBitstream bs; // Intel's bitstream structure.
mfxSyncPoint *syncp; // Async Task Sync Point.
- block_t *block; // VLC's block structure to be returned by Encode.
+ vlc_frame_t *frame; // VLC's frame structure to be returned by Encode.
} async_task_t;
TYPED_FIFO(async_task_t, async_task_t)
@@ -299,7 +299,7 @@ typedef struct
// as it doesn't like constantly changing buffers
} encoder_sys_t;
-static block_t *Encode(encoder_t *, picture_t *);
+static vlc_frame_t *Encode(encoder_t *, picture_t *);
static void clear_unused_frames(encoder_sys_t *sys)
@@ -658,25 +658,25 @@ static void Close(vlc_object_t *this)
/*
* The behavior in the next function comes from x264.c
*/
-static void qsv_set_block_flags(block_t *block, uint16_t frame_type)
+static void qsv_set_frame_flags(vlc_frame_t *frame, uint16_t frame_type)
{
if (frame_type & MFX_FRAMETYPE_IDR)
- block->i_flags = BLOCK_FLAG_TYPE_I;
+ frame->i_flags = FRAME_FLAG_TYPE_I;
else if ((frame_type & MFX_FRAMETYPE_P) || (frame_type & MFX_FRAMETYPE_I))
- block->i_flags = BLOCK_FLAG_TYPE_P;
+ frame->i_flags = FRAME_FLAG_TYPE_P;
else if (frame_type & MFX_FRAMETYPE_B)
- block->i_flags = BLOCK_FLAG_TYPE_B;
+ frame->i_flags = FRAME_FLAG_TYPE_B;
else
- block->i_flags = BLOCK_FLAG_TYPE_PB;
+ frame->i_flags = FRAME_FLAG_TYPE_PB;
}
/*
* Convert the Intel Media SDK's timestamps into VLC's format.
*/
-static void qsv_set_block_ts(encoder_t *enc, encoder_sys_t *sys, block_t *block, mfxBitstream *bs)
+static void qsv_set_frame_ts(encoder_t *enc, encoder_sys_t *sys, vlc_frame_t *frame, mfxBitstream *bs)
{
- block->i_pts = FROM_SCALE_NZ(bs->TimeStamp) + sys->offset_pts;
- block->i_dts = FROM_SCALE_NZ(bs->DecodeTimeStamp) + sys->offset_pts;
+ frame->i_pts = FROM_SCALE_NZ(bs->TimeStamp) + sys->offset_pts;
+ frame->i_dts = FROM_SCALE_NZ(bs->DecodeTimeStamp) + sys->offset_pts;
/* HW encoder (with old driver versions) and some parameters
combinations doesn't set the DecodeTimeStamp field so we warn
@@ -688,12 +688,12 @@ static void qsv_set_block_ts(encoder_t *enc, encoder_sys_t *sys, block_t *block,
" and that you have the last version of Intel's drivers installed.");
}
-static block_t *qsv_synchronize_block(encoder_t *enc, async_task_t *task)
+static vlc_frame_t *qsv_synchronize_frame(encoder_t *enc, async_task_t *task)
{
encoder_sys_t *sys = enc->p_sys;
mfxStatus sts;
- /* Synchronize and fill block_t. If the SyncOperation fails we leak :-/ (or we can segfault, ur choice) */
+ /* Synchronize and fill vlc_frame_t. If the SyncOperation fails we leak :-/ (or we can segfault, ur choice) */
do {
sts = MFXVideoCORE_SyncOperation(sys->session, *task->syncp, QSV_SYNCPOINT_WAIT);
} while (sts == MFX_WRN_IN_EXECUTION);
@@ -707,28 +707,28 @@ static block_t *qsv_synchronize_block(encoder_t *enc, async_task_t *task)
msg_Dbg(enc, "Empty encoded block");
return NULL;
}
- block_t *block = task->block;
- block->i_buffer = task->bs.DataLength;
- block->p_buffer += task->bs.DataOffset;
+ vlc_frame_t *frame = task->frame;
+ frame->i_buffer = task->bs.DataLength;
+ frame->p_buffer += task->bs.DataOffset;
- qsv_set_block_ts(enc, sys, block, &task->bs);
- qsv_set_block_flags(block, task->bs.FrameType);
+ qsv_set_frame_ts(enc, sys, frame, &task->bs);
+ qsv_set_frame_flags(frame, task->bs.FrameType);
- /* msg_Dbg(enc, "block->i_pts = %lld, block->i_dts = %lld", block->i_pts, block->i_dts); */
+ /* msg_Dbg(enc, "frame->i_pts = %lld, frame->i_dts = %lld", frame->i_pts, frame->i_dts); */
/* msg_Dbg(enc, "FrameType = %#.4x, TimeStamp = %lld (pts %lld), DecodeTimeStamp = %lld syncp=0x%x",*/
- /* task->bs.FrameType, task->bs.TimeStamp, block->i_pts, task->bs.DecodeTimeStamp, *task->syncp); */
+ /* task->bs.FrameType, task->bs.TimeStamp, frame->i_pts, task->bs.DecodeTimeStamp, *task->syncp); */
/* Copied from x264.c: This isn't really valid for streams with B-frames */
- block->i_length = vlc_tick_from_samples( enc->fmt_in.video.i_frame_rate_base,
+ frame->i_length = vlc_tick_from_samples( enc->fmt_in.video.i_frame_rate_base,
enc->fmt_in.video.i_frame_rate );
// Buggy DTS (value comes from experiments)
if (task->bs.DecodeTimeStamp < -10000)
- block->i_dts = sys->last_dts + block->i_length;
- sys->last_dts = block->i_dts;
+ frame->i_dts = sys->last_dts + frame->i_length;
+ sys->last_dts = frame->i_dts;
task->bs.DataLength = task->bs.DataOffset = 0;
- return block;
+ return frame;
}
static int submit_frame(encoder_t *enc, picture_t *pic, QSVFrame **new_frame)
@@ -804,14 +804,14 @@ static async_task_t *encode_frame(encoder_t *enc, picture_t *pic)
goto done;
}
- /* Allocate block_t and prepare mfxBitstream for encoder */
- if (!(task->block = block_Alloc(sys->params.mfx.BufferSizeInKB * 1000))) {
- msg_Err(enc, "Unable to allocate block for encoder output");
+ /* Allocate vlc_frame_t and prepare mfxBitstream for encoder */
+ if (!(task->frame = vlc_frame_Alloc(sys->params.mfx.BufferSizeInKB * 1000))) {
+ msg_Err(enc, "Unable to allocate frame for encoder output");
goto done;
}
memset(&task->bs, 0, sizeof(task->bs));
- task->bs.MaxLength = task->block->i_buffer;
- task->bs.Data = task->block->p_buffer;
+ task->bs.MaxLength = task->frame->i_buffer;
+ task->bs.Data = task->frame->p_buffer;
if (qsv_frame) {
surf = &qsv_frame->surface;
@@ -841,8 +841,8 @@ static async_task_t *encode_frame(encoder_t *enc, picture_t *pic)
done:
if (sts < MFX_ERR_NONE || (task != NULL && !task->syncp)) {
- if (task->block != NULL)
- block_Release(task->block);
+ if (task->frame != NULL)
+ vlc_frame_Release(task->frame);
free(task);
task = NULL;
}
@@ -856,12 +856,12 @@ done:
* - Main encoding phase : synchronizing the oldest task each call.
* - Empty : pic = 0, we empty the decoder. Synchronizing the remaining tasks.
*/
-static block_t *Encode(encoder_t *this, picture_t *pic)
+static vlc_frame_t *Encode(encoder_t *this, picture_t *pic)
{
encoder_t *enc = (encoder_t *)this;
encoder_sys_t *sys = enc->p_sys;
async_task_t *task;
- block_t *block = NULL;
+ vlc_frame_t *frame = NULL;
if (likely(pic != NULL))
{
@@ -875,10 +875,10 @@ static block_t *Encode(encoder_t *this, picture_t *pic)
{
assert(async_task_t_fifo_Show(&sys->packets)->syncp != 0);
async_task_t *task = async_task_t_fifo_Get(&sys->packets);
- block = qsv_synchronize_block( enc, task );
+ frame = qsv_synchronize_frame( enc, task );
free(task->syncp);
free(task);
}
- return block;
+ return frame;
}
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 3c3e789dfe..8a80399c61 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -140,65 +140,65 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with complete frames.
****************************************************************************/
-static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
- date_Set( &p_sys->pts, p_block->i_dts );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ date_Set( &p_sys->pts, p_frame->i_dts );
+ 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 && p_block->i_dts == VLC_TICK_INVALID &&
+ if( p_frame->i_pts == VLC_TICK_INVALID && p_frame->i_dts == VLC_TICK_INVALID &&
date_Get( &p_sys->pts ) == 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;
}
/* Date management: If there is a pts avaliable, use that. */
- if( p_block->i_pts != VLC_TICK_INVALID )
+ if( p_frame->i_pts != VLC_TICK_INVALID )
{
- date_Set( &p_sys->pts, p_block->i_pts );
+ date_Set( &p_sys->pts, p_frame->i_pts );
}
- else if( p_block->i_dts != VLC_TICK_INVALID )
+ else if( p_frame->i_dts != VLC_TICK_INVALID )
{
/* NB, davidf doesn't quite agree with this in general, it is ok
* for rawvideo since it is in order (ie pts=dts), however, it
* may not be ok for an out-of-order codec, so don't copy this
* without thinking */
- date_Set( &p_sys->pts, p_block->i_dts );
+ date_Set( &p_sys->pts, p_frame->i_dts );
}
- if( p_block->i_buffer < p_sys->size )
+ if( p_frame->i_buffer < p_sys->size )
{
msg_Warn( p_dec, "invalid frame size (%zu < %zu)",
- p_block->i_buffer, p_sys->size );
+ p_frame->i_buffer, p_sys->size );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- return p_block;
+ return p_frame;
}
/*****************************************************************************
* FillPicture:
*****************************************************************************/
-static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
+static void FillPicture( decoder_t *p_dec, vlc_frame_t *p_frame, picture_t *p_pic )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- const uint8_t *p_src = p_block->p_buffer;
+ const uint8_t *p_src = p_frame->p_buffer;
for( int i = 0; i < p_pic->i_planes; i++ )
{
@@ -219,13 +219,13 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
/*****************************************************************************
* DecodeFrame: decodes a video frame.
*****************************************************************************/
-static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- p_block = DecodeBlock( p_dec, p_block );
- if( p_block == NULL )
+ p_frame = DecodeFrame( p_dec, p_frame );
+ if( p_frame == NULL )
return VLCDEC_SUCCESS;
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -236,21 +236,21 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
p_pic = decoder_NewPicture( p_dec );
if( p_pic == NULL )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- FillPicture( p_dec, p_block, p_pic );
+ FillPicture( p_dec, p_frame, p_pic );
/* Date management: 1 frame per packet */
p_pic->date = date_Get( &p_sys->pts );
date_Increment( &p_sys->pts, 1 );
- if( p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK )
+ if( p_frame->i_flags & FRAME_FLAG_INTERLACED_MASK )
{
p_pic->b_progressive = false;
- p_pic->i_nb_fields = (p_block->i_flags & BLOCK_FLAG_SINGLE_FIELD) ? 1 : 2;
- if( p_block->i_flags & BLOCK_FLAG_TOP_FIELD_FIRST )
+ p_pic->i_nb_fields = (p_frame->i_flags & FRAME_FLAG_SINGLE_FIELD) ? 1 : 2;
+ if( p_frame->i_flags & FRAME_FLAG_TOP_FIELD_FIRST )
p_pic->b_top_field_first = true;
else
p_pic->b_top_field_first = false;
@@ -258,7 +258,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
else
p_pic->b_progressive = true;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
}
@@ -270,7 +270,7 @@ static int OpenDecoder( vlc_object_t *p_this )
int ret = OpenCommon( p_dec );
if( ret == VLC_SUCCESS )
{
- p_dec->pf_decode = DecodeFrame;
+ p_dec->pf_decode = Decode;
p_dec->pf_flush = Flush;
}
return ret;
@@ -279,26 +279,26 @@ static int OpenDecoder( vlc_object_t *p_this )
/*****************************************************************************
* SendFrame: send a video frame to the stream output.
*****************************************************************************/
-static block_t *SendFrame( decoder_t *p_dec, block_t **pp_block )
+static vlc_frame_t *SendFrame( decoder_t *p_dec, vlc_frame_t **pp_frame )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame;
+ if( p_frame == NULL )
return NULL;
- *pp_block = NULL;
+ *pp_frame = NULL;
- p_block = DecodeBlock( p_dec, p_block );
- if( p_block == NULL )
+ p_frame = DecodeFrame( p_dec, p_frame );
+ if( p_frame == NULL )
return NULL;
decoder_sys_t *p_sys = p_dec->p_sys;
/* Date management: 1 frame per packet */
- p_block->i_dts = p_block->i_pts = date_Get( &p_sys->pts );
+ p_frame->i_dts = p_frame->i_pts = date_Get( &p_sys->pts );
date_Increment( &p_sys->pts, 1 );
- return p_block;
+ return p_frame;
}
static int OpenPacketizer( vlc_object_t *p_this )
diff --git a/modules/codec/rtpvideo.c b/modules/codec/rtpvideo.c
index 8ce4de8238..497467d63a 100644
--- a/modules/codec/rtpvideo.c
+++ b/modules/codec/rtpvideo.c
@@ -35,7 +35,7 @@
* Local prototypes
****************************************************************************/
static int OpenEncoder( vlc_object_t * );
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict );
/*****************************************************************************
* Module descriptor
@@ -62,7 +62,7 @@ static int OpenEncoder( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict )
{
VLC_UNUSED( p_enc );
if( !p_pict ) return NULL;
@@ -71,11 +71,11 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
p_pict->p[1].i_visible_lines * p_pict->p[1].i_visible_pitch +
p_pict->p[2].i_visible_lines * p_pict->p[2].i_visible_pitch;
- block_t *p_block = block_Alloc( i_length );
- if( !p_block ) return NULL;
+ vlc_frame_t *p_frame = vlc_frame_Alloc( i_length );
+ if( !p_frame ) return NULL;
- p_block->i_dts = p_block->i_pts = p_pict->date;
- uint8_t *p_outdata = p_block->p_buffer;
+ p_frame->i_dts = p_frame->i_pts = p_pict->date;
+ uint8_t *p_outdata = p_frame->p_buffer;
const int i_xdec = 2;
const int i_ydec = 2;
@@ -103,5 +103,5 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
p_v += p_pict->p[2].i_pitch - p_pict->p[2].i_visible_pitch;
}
- return p_block;
+ return p_frame;
}
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index 522946199e..79b83386cc 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -524,7 +524,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int DecodeBlock ( decoder_t *p_dec, block_t *p_block );
+static int DecodeFrame ( decoder_t *p_dec, vlc_frame_t *p_frame );
static void Flush( decoder_t * );
struct picture_free_t
@@ -587,7 +587,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_I420;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
@@ -716,16 +716,16 @@ static SchroFrame *CreateSchroFrameFromPic( decoder_t *p_dec )
}
/*****************************************************************************
- * SchroBufferFree: schro_buffer callback to release the associated block_t
+ * SchroBufferFree: schro_buffer callback to release the associated vlc_frame_t
*****************************************************************************/
static void SchroBufferFree( SchroBuffer *buf, void *priv )
{
- block_t *p_block = priv;
+ vlc_frame_t *p_frame = priv;
- if( !p_block )
+ if( !p_frame )
return;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
(void)buf;
}
@@ -753,48 +753,48 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* Blocks need not be Dirac dataunit aligned.
- * If a block has a PTS signaled, it applies to the first picture at or after p_block
+ * If a frame has a PTS signaled, it applies to the first picture at or after p_frame
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( !p_block ) /* No Drain */
+ if( !p_frame ) /* No Drain */
return VLCDEC_SUCCESS;
else {
/* reset the decoder when seeking as the decode in progress is invalid */
- /* discard the block as it is just a null magic block */
- if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ /* discard the frame as it is just a null magic frame */
+ if( p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
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 VLCDEC_SUCCESS;
}
}
SchroBuffer *p_schrobuffer;
- p_schrobuffer = schro_buffer_new_with_data( p_block->p_buffer, p_block->i_buffer );
+ p_schrobuffer = schro_buffer_new_with_data( p_frame->p_buffer, p_frame->i_buffer );
p_schrobuffer->free = SchroBufferFree;
- p_schrobuffer->priv = p_block;
- if( p_block->i_pts != VLC_TICK_INVALID ) {
+ p_schrobuffer->priv = p_frame;
+ if( p_frame->i_pts != VLC_TICK_INVALID ) {
vlc_tick_t *p_pts = malloc( sizeof(*p_pts) );
if( p_pts ) {
- *p_pts = p_block->i_pts;
+ *p_pts = p_frame->i_pts;
/* if this call fails, p_pts is freed automatically */
p_schrobuffer->tag = schro_tag_new( p_pts, free );
}
}
- /* this stops the same block being fed back into this function if
+ /* this stops the same frame being fed back into this function if
* we were on the next iteration of this loop to output a picture */
schro_decoder_autoparse_push( p_sys->p_schro, p_schrobuffer );
- /* DO NOT refer to p_block after this point, it may have been freed */
+ /* DO NOT refer to p_frame after this point, it may have been freed */
}
while( 1 )
@@ -873,7 +873,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict );
/*****************************************************************************
@@ -902,9 +902,9 @@ typedef struct
bool b_auto_field_coding;
uint32_t i_input_picnum;
- block_fifo_t *p_dts_fifo;
+ vlc_frame_fifo_t *p_dts_fifo;
- block_t *p_chain;
+ vlc_frame_t *p_chain;
struct picture_pts_t pts_tlb[SCHRO_PTS_TLB_SIZE];
vlc_tick_t i_pts_offset;
@@ -1096,7 +1096,7 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.i_codec = VLC_CODEC_DIRAC;
p_enc->fmt_out.i_cat = VIDEO_ES;
- if( ( p_sys->p_dts_fifo = block_FifoNew() ) == NULL )
+ if( ( p_sys->p_dts_fifo = vlc_frame_FifoNew() ) == NULL )
{
CloseEncoder( p_this );
return VLC_ENOMEM;
@@ -1390,20 +1390,20 @@ static SchroFrame *CreateSchroFrameFromInputPic( encoder_t *p_enc, picture_t *p
}
/* Attempt to find dirac picture number in an encapsulation unit */
-static int ReadDiracPictureNumber( uint32_t *p_picnum, block_t *p_block )
+static int ReadDiracPictureNumber( uint32_t *p_picnum, vlc_frame_t *p_frame )
{
uint32_t u_pos = 4;
/* protect against falling off the edge */
- while( u_pos + 13 < p_block->i_buffer )
+ while( u_pos + 13 < p_frame->i_buffer )
{
/* find the picture startcode */
- if( p_block->p_buffer[u_pos] & 0x08 )
+ if( p_frame->p_buffer[u_pos] & 0x08 )
{
- *p_picnum = GetDWBE( p_block->p_buffer + u_pos + 9 );
+ *p_picnum = GetDWBE( p_frame->p_buffer + u_pos + 9 );
return 1;
}
/* skip to the next dirac data unit */
- uint32_t u_npo = GetDWBE( p_block->p_buffer + u_pos + 1 );
+ uint32_t u_npo = GetDWBE( p_frame->p_buffer + u_pos + 1 );
assert( u_npo <= UINT32_MAX - u_pos );
if( u_npo == 0 )
u_npo = 13;
@@ -1413,11 +1413,11 @@ static int ReadDiracPictureNumber( uint32_t *p_picnum, block_t *p_block )
}
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pic )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_block, *p_output_chain = NULL;
- SchroFrame *p_frame;
+ vlc_frame_t *p_frame, *p_output_chain = NULL;
+ SchroFrame *p_sframe;
bool b_go = true;
if( !p_pic ) {
@@ -1480,10 +1480,10 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
Schro finishes with it */
picture_Hold( p_pic );
- p_frame = CreateSchroFrameFromInputPic( p_enc, p_pic );
- if( !p_frame )
+ p_sframe = CreateSchroFrameFromInputPic( p_enc, p_pic );
+ if( !p_sframe )
return NULL;
- schro_encoder_push_frame( p_sys->p_schro, p_frame );
+ schro_encoder_push_frame( p_sys->p_schro, p_sframe );
/* store pts in a lookaside buffer, so that the same pts may
@@ -1493,12 +1493,12 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
/* store dts in a queue, so that they appear in order in
* coded order */
- p_block = block_Alloc( 1 );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( 1 );
+ if( !p_frame )
return NULL;
- p_block->i_dts = p_pic->date - p_sys->i_pts_offset;
- block_FifoPut( p_sys->p_dts_fifo, p_block );
- p_block = NULL;
+ p_frame->i_dts = p_pic->date - p_sys->i_pts_offset;
+ vlc_frame_FifoPut( p_sys->p_dts_fifo, p_frame );
+ p_frame = NULL;
/* for field coding mode, insert an extra value into both the
* pts lookaside buffer and dts queue, offset to correspond
@@ -1507,12 +1507,12 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date + p_sys->i_field_duration );
p_sys->i_input_picnum++;
- p_block = block_Alloc( 1 );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( 1 );
+ if( !p_frame )
return NULL;
- p_block->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_duration;
- block_FifoPut( p_sys->p_dts_fifo, p_block );
- p_block = NULL;
+ p_frame->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_duration;
+ vlc_frame_FifoPut( p_sys->p_dts_fifo, p_frame );
+ p_frame = NULL;
}
}
@@ -1537,21 +1537,21 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
uint32_t u_pic_num;
int i_presentation_frame;
p_enc_buf = schro_encoder_pull( p_sys->p_schro, &i_presentation_frame );
- p_block = block_Alloc( p_enc_buf->length );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( p_enc_buf->length );
+ if( !p_frame )
return NULL;
- memcpy( p_block->p_buffer, p_enc_buf->data, p_enc_buf->length );
+ memcpy( p_frame->p_buffer, p_enc_buf->data, p_enc_buf->length );
schro_buffer_unref( p_enc_buf );
/* Presence of a Sequence header indicates a seek point */
- if( 0 == p_block->p_buffer[4] )
+ if( 0 == p_frame->p_buffer[4] )
{
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
if( !p_enc->fmt_out.p_extra ) {
const uint8_t eos[] = { 'B','B','C','D',0x10,0,0,0,13,0,0,0,0 };
- uint32_t len = GetDWBE( p_block->p_buffer + 5 );
+ uint32_t len = GetDWBE( p_frame->p_buffer + 5 );
/* if it hasn't been done so far, stash a copy of the
* sequence header for muxers such as ogg */
/* The OggDirac spec advises that a Dirac EOS DataUnit
@@ -1565,22 +1565,22 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
p_enc->fmt_out.p_extra = malloc( len + sizeof( eos ) );
if( !p_enc->fmt_out.p_extra )
return NULL;
- memcpy( p_enc->fmt_out.p_extra, p_block->p_buffer, len );
+ memcpy( p_enc->fmt_out.p_extra, p_frame->p_buffer, len );
memcpy( (uint8_t*)p_enc->fmt_out.p_extra + len, eos, sizeof( eos ) );
SetDWBE( (uint8_t*)p_enc->fmt_out.p_extra + len + sizeof(eos) - 4, len );
p_enc->fmt_out.i_extra = len + sizeof( eos );
}
}
- if( ReadDiracPictureNumber( &u_pic_num, p_block ) ) {
- block_t *p_dts_block = block_FifoGet( p_sys->p_dts_fifo );
- p_block->i_dts = p_dts_block->i_dts;
- p_block->i_pts = GetPicturePTS( p_enc, u_pic_num );
- block_Release( p_dts_block );
- block_ChainAppend( &p_output_chain, p_block );
+ if( ReadDiracPictureNumber( &u_pic_num, p_frame ) ) {
+ vlc_frame_t *p_dts_frame = vlc_frame_FifoGet( p_sys->p_dts_fifo );
+ p_frame->i_dts = p_dts_frame->i_dts;
+ p_frame->i_pts = GetPicturePTS( p_enc, u_pic_num );
+ vlc_frame_Release( p_dts_frame );
+ vlc_frame_ChainAppend( &p_output_chain, p_frame );
} else {
/* End of sequence */
- block_ChainAppend( &p_output_chain, p_block );
+ vlc_frame_ChainAppend( &p_output_chain, p_frame );
}
break;
}
@@ -1607,9 +1607,9 @@ static void CloseEncoder( vlc_object_t *p_this )
free( p_sys->p_format );
if( p_sys->p_dts_fifo )
- block_FifoRelease( p_sys->p_dts_fifo );
+ vlc_frame_FifoRelease( p_sys->p_dts_fifo );
- block_ChainRelease( p_sys->p_chain );
+ vlc_frame_ChainRelease( p_sys->p_chain );
free( p_sys );
}
diff --git a/modules/codec/scte18.c b/modules/codec/scte18.c
index 73ee7cda21..9bccc39168 100644
--- a/modules/codec/scte18.c
+++ b/modules/codec/scte18.c
@@ -87,15 +87,15 @@ static void scte18_cea_Free( scte18_cea_t *p_cea )
free( p_cea );
}
-static scte18_cea_t * scte18_cea_Decode( atsc_a65_handle_t *p_handle, const block_t *p_block )
+static scte18_cea_t * scte18_cea_Decode( atsc_a65_handle_t *p_handle, const vlc_frame_t *p_frame )
{
size_t len;
scte18_cea_t *p_cea = scte18_cea_New();
if( !p_cea )
return NULL;
- const uint8_t *p_buffer = p_block->p_buffer;
- size_t i_buffer = p_block->i_buffer;
+ const uint8_t *p_buffer = p_frame->p_buffer;
+ size_t i_buffer = p_frame->i_buffer;
if( i_buffer < 34 || p_buffer[0] != 0 )
goto error;
@@ -169,18 +169,18 @@ error:
return NULL;
}
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if ( p_block == NULL ) /* No Drain */
+ if ( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
subpicture_t *p_spu = NULL;
- if (p_block->i_flags & (BLOCK_FLAG_CORRUPTED))
+ if (p_frame->i_flags & (FRAME_FLAG_CORRUPTED))
goto exit;
decoder_sys_t *p_sys = p_dec->p_sys;
- scte18_cea_t *p_cea = scte18_cea_Decode( p_sys->p_handle, p_block );
+ scte18_cea_t *p_cea = scte18_cea_Decode( p_sys->p_handle, p_frame );
if( p_cea )
{
p_spu = decoder_NewSubpictureText( p_dec );
@@ -188,7 +188,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
{
subtext_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
- p_spu->i_start = p_block->i_pts;
+ p_spu->i_start = p_frame->i_pts;
if( p_cea->alert_message_time_remaining )
p_spu->i_stop = p_spu->i_start + vlc_tick_from_sec( p_cea->alert_message_time_remaining );
else
@@ -214,7 +214,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
exit:
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/scte27.c b/modules/codec/scte27.c
index 372dc01d9e..76511f4274 100644
--- a/modules/codec/scte27.c
+++ b/modules/codec/scte27.c
@@ -405,14 +405,14 @@ error:
return NULL;
}
-static int Decode(decoder_t *dec, block_t *b)
+static int Decode(decoder_t *dec, vlc_frame_t *b)
{
decoder_sys_t *sys = dec->p_sys;
if (b == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if (b->i_flags & (BLOCK_FLAG_CORRUPTED))
+ if (b->i_flags & (FRAME_FLAG_CORRUPTED))
goto exit;
while (b->i_buffer > 3) {
@@ -484,7 +484,7 @@ static int Decode(decoder_t *dec, block_t *b)
}
exit:
- block_Release(b);
+ vlc_frame_Release(b);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/sdl_image.c b/modules/codec/sdl_image.c
index 013c3fba81..04fb6277bb 100644
--- a/modules/codec/sdl_image.c
+++ b/modules/codec/sdl_image.c
@@ -48,7 +48,7 @@ typedef struct
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeBlock ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
/*****************************************************************************
* Module descriptor
@@ -114,33 +114,33 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
return VLC_SUCCESS;
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with a complete compressed frame.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic = NULL;
SDL_Surface *p_surface;
SDL_RWops *p_rw;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
- p_rw = SDL_RWFromConstMem( p_block->p_buffer, p_block->i_buffer );
+ p_rw = SDL_RWFromConstMem( p_frame->p_buffer, p_frame->i_buffer );
/* Decode picture. */
p_surface = IMG_LoadTyped_RW( p_rw, 1, (char*)p_sys->psz_sdl_type );
@@ -255,14 +255,14 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
- p_pic->date = (p_block->i_pts != VLC_TICK_INVALID) ?
- p_block->i_pts : p_block->i_dts;
+ p_pic->date = (p_frame->i_pts != VLC_TICK_INVALID) ?
+ p_frame->i_pts : p_frame->i_dts;
decoder_QueueVideo( p_dec, p_pic );
error:
if ( p_surface != NULL ) SDL_FreeSurface( p_surface );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/shine.c b/modules/codec/shine.c
index c07430368a..fa4f43e53f 100644
--- a/modules/codec/shine.c
+++ b/modules/codec/shine.c
@@ -30,8 +30,8 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_block.h>
-#include <vlc_block_helper.h>
+#include <vlc_frame.h>
+#include <vlc_frame_helper.h>
#include <vlc_bits.h>
#include <vlc_aout.h>
@@ -44,7 +44,7 @@ typedef struct
{
shine_t s;
unsigned int samples_per_frame;
- block_fifo_t *p_fifo;
+ vlc_frame_fifo_t *p_fifo;
unsigned int i_buffer;
uint8_t *p_buffer;
@@ -56,7 +56,7 @@ typedef struct
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
-static block_t *EncodeFrame ( encoder_t *, block_t * );
+static vlc_frame_t *EncodeFrame ( encoder_t *, vlc_frame_t * );
vlc_module_begin();
set_category( CAT_INPUT );
@@ -114,7 +114,7 @@ static int OpenEncoder( vlc_object_t *p_this )
if( !p_sys )
goto enomem;
- if( !( p_sys->p_fifo = block_FifoNew() ) )
+ if( !( p_sys->p_fifo = vlc_frame_FifoNew() ) )
{
free( p_sys );
goto enomem;
@@ -153,25 +153,25 @@ enomem:
return VLC_ENOMEM;
}
-/* We split/pack PCM blocks to a fixed size: p_sys->samples_per_frame * 4 bytes */
-static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
+/* We split/pack PCM frames to a fixed size: p_sys->samples_per_frame * 4 bytes */
+static vlc_frame_t *GetPCM( encoder_t *p_enc, vlc_frame_t *p_frame )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_pcm_block;
+ vlc_frame_t *p_pcm_frame;
- if( !p_block ) goto buffered; /* just return a block if we can */
+ if( !p_frame ) goto buffered; /* just return a frame if we can */
/* Put the PCM samples sent by VLC in the Fifo */
- while( p_sys->i_buffer + p_block->i_buffer >= p_sys->samples_per_frame * 4 )
+ while( p_sys->i_buffer + p_frame->i_buffer >= p_sys->samples_per_frame * 4 )
{
unsigned int i_buffer = 0;
- p_pcm_block = block_Alloc( p_sys->samples_per_frame * 4 );
- if( !p_pcm_block )
+ p_pcm_frame = vlc_frame_Alloc( p_sys->samples_per_frame * 4 );
+ if( !p_pcm_frame )
break;
if( p_sys->i_buffer )
{
- memcpy( p_pcm_block->p_buffer, p_sys->p_buffer, p_sys->i_buffer );
+ memcpy( p_pcm_frame->p_buffer, p_sys->p_buffer, p_sys->i_buffer );
i_buffer = p_sys->i_buffer;
p_sys->i_buffer = 0;
@@ -179,24 +179,24 @@ static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
p_sys->p_buffer = NULL;
}
- memcpy( p_pcm_block->p_buffer + i_buffer,
- p_block->p_buffer, p_sys->samples_per_frame * 4 - i_buffer );
- p_block->p_buffer += p_sys->samples_per_frame * 4 - i_buffer;
+ memcpy( p_pcm_frame->p_buffer + i_buffer,
+ p_frame->p_buffer, p_sys->samples_per_frame * 4 - i_buffer );
+ p_frame->p_buffer += p_sys->samples_per_frame * 4 - i_buffer;
- p_block->i_buffer -= p_sys->samples_per_frame * 4 - i_buffer;
+ p_frame->i_buffer -= p_sys->samples_per_frame * 4 - i_buffer;
- block_FifoPut( p_sys->p_fifo, p_pcm_block );
+ vlc_frame_FifoPut( p_sys->p_fifo, p_pcm_frame );
}
- /* We hadn't enough data to make a block, put it in standby */
- if( p_block->i_buffer )
+ /* We hadn't enough data to make a frame, put it in standby */
+ if( p_frame->i_buffer )
{
uint8_t *p_tmp;
if( p_sys->i_buffer > 0 )
- p_tmp = realloc( p_sys->p_buffer, p_block->i_buffer + p_sys->i_buffer );
+ p_tmp = realloc( p_sys->p_buffer, p_frame->i_buffer + p_sys->i_buffer );
else
- p_tmp = malloc( p_block->i_buffer );
+ p_tmp = malloc( p_frame->i_buffer );
if( !p_tmp )
{
@@ -207,70 +207,70 @@ static block_t *GetPCM( encoder_t *p_enc, block_t *p_block )
}
p_sys->p_buffer = p_tmp;
memcpy( p_sys->p_buffer + p_sys->i_buffer,
- p_block->p_buffer, p_block->i_buffer );
+ p_frame->p_buffer, p_frame->i_buffer );
- p_sys->i_buffer += p_block->i_buffer;
- p_block->i_buffer = 0;
+ p_sys->i_buffer += p_frame->i_buffer;
+ p_frame->i_buffer = 0;
}
buffered:
- /* and finally get a block back */
- return block_FifoCount( p_sys->p_fifo ) > 0 ? block_FifoGet( p_sys->p_fifo ) : NULL;
+ /* and finally get a frame back */
+ return vlc_frame_FifoCount( p_sys->p_fifo ) > 0 ? vlc_frame_FifoGet( p_sys->p_fifo ) : NULL;
}
-static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
+static vlc_frame_t *EncodeFrame( encoder_t *p_enc, vlc_frame_t *p_frame )
{
- if (!p_block) /* TODO: flush */
+ if (!p_frame) /* TODO: flush */
return NULL;
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_pcm_block;
- block_t *p_chain = NULL;
- unsigned int i_samples = p_block->i_buffer >> 2 /* s16l stereo */;
- vlc_tick_t start_date = p_block->i_pts;
+ vlc_frame_t *p_pcm_frame;
+ vlc_frame_t *p_chain = NULL;
+ unsigned int i_samples = p_frame->i_buffer >> 2 /* s16l stereo */;
+ vlc_tick_t start_date = p_frame->i_pts;
start_date -= vlc_tick_from_samples(i_samples, p_enc->fmt_out.audio.i_rate);
VLC_UNUSED(p_enc);
do {
- p_pcm_block = GetPCM( p_enc, p_block );
- if( !p_pcm_block )
+ p_pcm_frame = GetPCM( p_enc, p_frame );
+ if( !p_pcm_frame )
break;
- p_block = NULL; /* we don't need it anymore */
+ p_frame = NULL; /* we don't need it anymore */
int16_t pcm_planar_buf[SHINE_MAX_SAMPLES * 2];
int16_t *pcm_planar_buf_chans[2] = {
&pcm_planar_buf[0],
&pcm_planar_buf[p_sys->samples_per_frame],
};
- aout_Deinterleave( pcm_planar_buf, p_pcm_block->p_buffer,
+ aout_Deinterleave( pcm_planar_buf, p_pcm_frame->p_buffer,
p_sys->samples_per_frame, p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.i_codec);
int written;
unsigned char *buf = shine_encode_buffer(p_sys->s, pcm_planar_buf_chans, &written);
- block_Release( p_pcm_block );
+ vlc_frame_Release( p_pcm_frame );
if (written <= 0)
break;
- block_t *p_mp3_block = block_Alloc( written );
- if( !p_mp3_block )
+ vlc_frame_t *p_mp3_frame = vlc_frame_Alloc( written );
+ if( !p_mp3_frame )
break;
- memcpy( p_mp3_block->p_buffer, buf, written );
+ memcpy( p_mp3_frame->p_buffer, buf, written );
/* date management */
- p_mp3_block->i_length = vlc_tick_from_samples(p_sys->samples_per_frame,
+ p_mp3_frame->i_length = vlc_tick_from_samples(p_sys->samples_per_frame,
p_enc->fmt_out.audio.i_rate);
- start_date += p_mp3_block->i_length;
- p_mp3_block->i_dts = p_mp3_block->i_pts = start_date;
+ start_date += p_mp3_frame->i_length;
+ p_mp3_frame->i_dts = p_mp3_frame->i_pts = start_date;
- p_mp3_block->i_nb_samples = p_sys->samples_per_frame;
+ p_mp3_frame->i_nb_samples = p_sys->samples_per_frame;
- block_ChainAppend( &p_chain, p_mp3_block );
+ vlc_frame_ChainAppend( &p_chain, p_mp3_frame );
- } while( p_pcm_block );
+ } while( p_pcm_frame );
return p_chain;
}
@@ -283,13 +283,13 @@ static void CloseEncoder( vlc_object_t *p_this )
entrant.busy = false;
vlc_mutex_unlock( &entrant.lock );
- /* TODO: we should send the last PCM block padded with 0
- * But we don't know if other blocks will come before it's too late */
+ /* TODO: we should send the last PCM frame padded with 0
+ * But we don't know if other frames will come before it's too late */
if( p_sys->i_buffer )
free( p_sys->p_buffer );
shine_close(p_sys->s);
- block_FifoRelease( p_sys->p_fifo );
+ vlc_frame_FifoRelease( p_sys->p_fifo );
free( p_sys );
}
diff --git a/modules/codec/spdif.c b/modules/codec/spdif.c
index edb3e899e4..497c6aabf4 100644
--- a/modules/codec/spdif.c
+++ b/modules/codec/spdif.c
@@ -39,10 +39,10 @@ vlc_module_begin()
vlc_module_end()
static int
-DecodeBlock(decoder_t *p_dec, block_t *p_block)
+DecodeFrame(decoder_t *p_dec, vlc_frame_t *p_frame)
{
- if (p_block != NULL)
- decoder_QueueAudio( p_dec, p_block );
+ if (p_frame != NULL)
+ decoder_QueueAudio( p_dec, p_frame );
return VLCDEC_SUCCESS;
}
@@ -81,7 +81,7 @@ OpenDecoder(vlc_object_t *p_this)
if (decoder_UpdateAudioFormat(p_dec))
return VLC_EGENERIC;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = NULL;
return VLC_SUCCESS;
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 678244b230..3a720d2ed4 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -177,16 +177,16 @@ typedef struct
* Local prototypes
****************************************************************************/
-static block_t *Packetize ( decoder_t *, block_t ** );
-static int DecodeAudio ( decoder_t *, block_t * );
-static int DecodeRtpSpeexPacket( decoder_t *, block_t *);
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
+static int DecodeAudio ( decoder_t *, vlc_frame_t * );
+static int DecodeRtpSpeexPacket( decoder_t *, vlc_frame_t *);
static int ProcessHeaders( decoder_t * );
static int ProcessInitialHeader ( decoder_t *, ogg_packet * );
-static block_t *ProcessPacket( decoder_t *, ogg_packet *, block_t ** );
+static vlc_frame_t *ProcessPacket( decoder_t *, ogg_packet *, vlc_frame_t ** );
static void Flush( decoder_t * );
-static block_t *DecodePacket( decoder_t *, ogg_packet * );
-static block_t *SendPacket( decoder_t *, block_t * );
+static vlc_frame_t *DecodePacket( decoder_t *, ogg_packet * );
+static vlc_frame_t *SendPacket( decoder_t *, vlc_frame_t * );
static void ParseSpeexComments( decoder_t *, ogg_packet * );
@@ -316,38 +316,38 @@ cleanup:
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-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;
ogg_packet oggpacket;
- block_t *block = *pp_block;
+ vlc_frame_t *frame = *pp_frame;
- if( block != NULL )
+ if( frame != NULL )
{
- if( block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
+ if( frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY) )
{
Flush( p_dec );
- if( block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( frame->i_flags & FRAME_FLAG_CORRUPTED )
{
- block_Release( block );
- *pp_block = NULL;
+ vlc_frame_Release( frame );
+ *pp_frame = NULL;
return NULL;
}
}
- /* Block to Ogg packet */
- oggpacket.packet = block->p_buffer;
- oggpacket.bytes = block->i_buffer;
+ /* Frame to Ogg packet */
+ oggpacket.packet = frame->p_buffer;
+ oggpacket.bytes = frame->i_buffer;
}
else
{
if( p_sys->b_packetizer ) return NULL;
- /* Block to Ogg packet */
+ /* Frame to Ogg packet */
oggpacket.packet = NULL;
oggpacket.bytes = 0;
}
@@ -366,39 +366,39 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( CreateDefaultHeader( p_dec ) )
{
- if( block != NULL )
- block_Release( block );
+ if( frame != NULL )
+ vlc_frame_Release( frame );
return NULL;
}
}
else if( ProcessHeaders( p_dec ) )
{
- if( block != NULL )
- block_Release( block );
+ if( frame != NULL )
+ vlc_frame_Release( frame );
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket( p_dec, &oggpacket, pp_block );
+ return ProcessPacket( p_dec, &oggpacket, pp_frame );
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- block_t **pp_block = &p_block, *p_out;
- while( ( p_out = DecodeBlock( p_dec, pp_block ) ) != NULL )
+ vlc_frame_t **pp_frame = &p_frame, *p_out;
+ while( ( p_out = DecodeFrame( p_dec, pp_frame ) ) != NULL )
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- return DecodeBlock( p_dec, pp_block );
+ return DecodeFrame( p_dec, pp_frame );
}
/*****************************************************************************
@@ -560,27 +560,27 @@ static void Flush( decoder_t *p_dec )
/*****************************************************************************
* ProcessPacket: processes a Speex packet.
*****************************************************************************/
-static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
- block_t **pp_block )
+static vlc_frame_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
+ vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
/* Date management */
- if( p_block && p_block->i_pts != VLC_TICK_INVALID &&
- p_block->i_pts != date_Get( &p_sys->end_date ) )
+ if( p_frame && p_frame->i_pts != VLC_TICK_INVALID &&
+ p_frame->i_pts != date_Get( &p_sys->end_date ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
- if( p_block ) block_Release( p_block );
+ if( p_frame ) vlc_frame_Release( p_frame );
return NULL;
}
- *pp_block = NULL; /* To avoid being fed the same packet again */
+ *pp_frame = NULL; /* To avoid being fed the same packet again */
if( p_sys->b_packetizer )
{
@@ -589,7 +589,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
short *p_frame_holder = NULL;
int i_bits_before = 0, i_bits_after = 0, i_bytes_in_speex_frame = 0,
i_pcm_output_size = 0, i_bits_in_speex_frame = 0;
- block_t *p_new_block = NULL;
+ vlc_frame_t *p_new_frame = NULL;
i_pcm_output_size = p_sys->p_header->frame_size;
p_frame_holder = (short*)xmalloc( sizeof(short)*i_pcm_output_size );
@@ -605,15 +605,15 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
(8 - (i_bits_in_speex_frame % 8)) )
/ 8;
- p_new_block = block_Alloc( i_bytes_in_speex_frame );
- memset( p_new_block->p_buffer, 0xff, i_bytes_in_speex_frame );
+ p_new_frame = vlc_frame_Alloc( i_bytes_in_speex_frame );
+ memset( p_new_frame->p_buffer, 0xff, i_bytes_in_speex_frame );
/*
* Copy the first frame in this packet to a new packet.
*/
speex_bits_rewind( &p_sys->bits );
speex_bits_write( &p_sys->bits,
- (char*)p_new_block->p_buffer,
+ (char*)p_new_frame->p_buffer,
(int)i_bytes_in_speex_frame );
/*
@@ -633,12 +633,12 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
*/
i_bytes_in_speex_frame--;
speex_bits_write( &p_sys->bits,
- (char*)p_block->p_buffer,
- p_block->i_buffer - i_bytes_in_speex_frame );
- p_block = block_Realloc( p_block,
+ (char*)p_frame->p_buffer,
+ p_frame->i_buffer - i_bytes_in_speex_frame );
+ p_frame = vlc_frame_Realloc( p_frame,
0,
- p_block->i_buffer-i_bytes_in_speex_frame );
- *pp_block = p_block;
+ p_frame->i_buffer-i_bytes_in_speex_frame );
+ *pp_frame = p_frame;
}
else
{
@@ -646,31 +646,31 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
}
free( p_frame_holder );
- return SendPacket( p_dec, p_new_block);
+ return SendPacket( p_dec, p_new_frame);
}
else
{
- return SendPacket( p_dec, p_block );
+ return SendPacket( p_dec, p_frame );
}
}
else
{
- block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket );
+ vlc_frame_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket );
- if( p_block )
- block_Release( p_block );
+ if( p_frame )
+ vlc_frame_Release( p_frame );
return p_aout_buffer;
}
}
-static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
+static int DecodeRtpSpeexPacket( decoder_t *p_dec, vlc_frame_t *p_speex_bit_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_aout_buffer;
+ vlc_frame_t *p_aout_buffer;
int i_decode_ret;
unsigned int i_speex_frame_size;
- if ( !p_speex_bit_block || p_speex_bit_block->i_pts == VLC_TICK_INVALID )
+ if ( !p_speex_bit_frame || p_speex_bit_frame->i_pts == VLC_TICK_INVALID )
return VLCDEC_SUCCESS;
/*
@@ -735,7 +735,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
}
if ( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
- date_Set( &p_sys->end_date, p_speex_bit_block->i_dts );
+ date_Set( &p_sys->end_date, p_speex_bit_frame->i_dts );
/*
Ask for a new audio output buffer and make sure
@@ -756,8 +756,8 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
Read the Speex payload into the SpeexBits buffer.
*/
speex_bits_read_from( &p_sys->bits,
- (char*)p_speex_bit_block->p_buffer,
- p_speex_bit_block->i_buffer );
+ (char*)p_speex_bit_frame->p_buffer,
+ p_speex_bit_frame->i_buffer );
/*
Decode the input and ensure that no errors
@@ -780,7 +780,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
p_sys->i_frame_in_packet++;
- block_Release( p_speex_bit_block );
+ vlc_frame_Release( p_speex_bit_frame );
decoder_QueueAudio( p_dec, p_aout_buffer );
return VLCDEC_SUCCESS;
}
@@ -788,7 +788,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
/*****************************************************************************
* DecodePacket: decodes a Speex packet.
*****************************************************************************/
-static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
+static vlc_frame_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -803,7 +803,7 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
/* Decode one frame at a time */
if( p_sys->i_frame_in_packet < p_sys->p_header->frames_per_packet )
{
- block_t *p_aout_buffer;
+ vlc_frame_t *p_aout_buffer;
if( p_sys->p_header->frame_size == 0 )
return NULL;
@@ -855,19 +855,19 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
/*****************************************************************************
* SendPacket: send an ogg packet to the stream output.
*****************************************************************************/
-static block_t *SendPacket( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *SendPacket( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
/* Date management */
- p_block->i_dts = p_block->i_pts = date_Get( &p_sys->end_date );
+ p_frame->i_dts = p_frame->i_pts = date_Get( &p_sys->end_date );
- p_block->i_length =
+ p_frame->i_length =
date_Increment( &p_sys->end_date,
p_sys->p_header->frame_size ) -
- p_block->i_pts;
+ p_frame->i_pts;
- return p_block;
+ return p_frame;
}
/*****************************************************************************
@@ -951,7 +951,7 @@ typedef struct
int i_frame_size;
} encoder_sys_t;
-static block_t *Encode ( encoder_t *, block_t * );
+static vlc_frame_t *Encode ( encoder_t *, vlc_frame_t * );
/*****************************************************************************
* OpenEncoder: probe the encoder and return score
@@ -1082,10 +1082,10 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************
* This function spits out ogg packets.
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *Encode( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_block, *p_chain = NULL;
+ vlc_frame_t *p_frame, *p_chain = NULL;
/* Encoder gets NULL when it's time to flush */
if( unlikely( !p_aout_buf ) ) return NULL;
@@ -1151,18 +1151,18 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
MAX_FRAME_BYTES );
speex_bits_reset( &p_sys->bits );
- p_block = block_Alloc( i_out );
- memcpy( p_block->p_buffer, p_sys->p_buffer_out, i_out );
+ p_frame = vlc_frame_Alloc( i_out );
+ memcpy( p_frame->p_buffer, p_sys->p_buffer_out, i_out );
- p_block->i_length = vlc_tick_from_samples(
+ p_frame->i_length = vlc_tick_from_samples(
p_sys->i_frame_length * p_sys->header.frames_per_packet,
p_enc->fmt_in.audio.i_rate );
- p_block->i_dts = p_block->i_pts = i_pts;
+ p_frame->i_dts = p_frame->i_pts = i_pts;
/* Update pts */
- i_pts += p_block->i_length;
- block_ChainAppend( &p_chain, p_block );
+ i_pts += p_frame->i_length;
+ vlc_frame_ChainAppend( &p_chain, p_frame );
}
diff --git a/modules/codec/spudec/spudec.c b/modules/codec/spudec/spudec.c
index ae5ec215f5..a1a4065e51 100644
--- a/modules/codec/spudec/spudec.c
+++ b/modules/codec/spudec/spudec.c
@@ -64,9 +64,9 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t * Reassemble( decoder_t *, block_t * );
-static int Decode ( decoder_t *, block_t * );
-static block_t * Packetize ( decoder_t *, block_t ** );
+static vlc_frame_t * Reassemble( decoder_t *, vlc_frame_t * );
+static int Decode ( decoder_t *, vlc_frame_t * );
+static vlc_frame_t * Packetize ( decoder_t *, vlc_frame_t ** );
static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
{
@@ -84,7 +84,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
p_sys->b_disabletrans = var_InheritBool( p_dec, "dvdsub-transparency" );
p_sys->i_spu_size = 0;
p_sys->i_spu = 0;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
if( b_packetizer )
{
@@ -119,9 +119,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_sys );
@@ -130,25 +130,25 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_spu_block;
+ vlc_frame_t *p_spu_frame;
subpicture_t *p_spu;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- p_spu_block = Reassemble( p_dec, p_block );
+ p_spu_frame = Reassemble( p_dec, p_frame );
- if( ! p_spu_block )
+ if( ! p_spu_frame )
{
return VLCDEC_SUCCESS;
}
/* FIXME: what the, we shouldn’t need to allocate 64k of buffer --sam. */
- p_sys->i_spu = block_ChainExtract( p_spu_block, p_sys->buffer, 65536 );
- p_sys->i_pts = p_spu_block->i_pts;
- block_ChainRelease( p_spu_block );
+ p_sys->i_spu = vlc_frame_ChainExtract( p_spu_frame, p_sys->buffer, 65536 );
+ p_sys->i_pts = p_spu_frame->i_pts;
+ vlc_frame_ChainRelease( p_spu_frame );
/* Parse and decode */
p_spu = ParsePacket( p_dec );
@@ -157,7 +157,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_sys->i_spu_size = 0;
p_sys->i_rle_size = 0;
p_sys->i_spu = 0;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
@@ -167,16 +167,16 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
/*****************************************************************************
* 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;
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block; *pp_block = NULL;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame; *pp_frame = NULL;
+ if( p_frame == NULL )
return NULL;
- block_t *p_spu = Reassemble( p_dec, p_block );
+ vlc_frame_t *p_spu = Reassemble( p_dec, p_frame );
if( ! p_spu )
{
@@ -190,43 +190,43 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
p_sys->i_spu_size = 0;
p_sys->i_rle_size = 0;
p_sys->i_spu = 0;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
- return block_ChainGather( p_spu );
+ return vlc_frame_ChainGather( p_spu );
}
/*****************************************************************************
* Reassemble:
*****************************************************************************/
-static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *Reassemble( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- 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_sys->i_spu_size <= 0 &&
- ( p_block->i_pts == VLC_TICK_INVALID || p_block->i_buffer < 4 ) )
+ ( p_frame->i_pts == VLC_TICK_INVALID || p_frame->i_buffer < 4 ) )
{
msg_Dbg( p_dec, "invalid starting packet (size < 4 or pts <=0)" );
msg_Dbg( p_dec, "spu size: %d, i_pts: %"PRId64" i_buffer: %zu",
- p_sys->i_spu_size, p_block->i_pts, p_block->i_buffer );
- block_Release( p_block );
+ p_sys->i_spu_size, p_frame->i_pts, p_frame->i_buffer );
+ vlc_frame_Release( p_frame );
return NULL;
}
- block_ChainAppend( &p_sys->p_block, p_block );
- p_sys->i_spu += p_block->i_buffer;
+ vlc_frame_ChainAppend( &p_sys->p_frame, p_frame );
+ p_sys->i_spu += p_frame->i_buffer;
if( p_sys->i_spu_size <= 0 )
{
- p_sys->i_spu_size = ( p_block->p_buffer[0] << 8 )|
- p_block->p_buffer[1];
- p_sys->i_rle_size = ( ( p_block->p_buffer[2] << 8 )|
- p_block->p_buffer[3] ) - 4;
+ p_sys->i_spu_size = ( p_frame->p_buffer[0] << 8 )|
+ p_frame->p_buffer[1];
+ p_sys->i_rle_size = ( ( p_frame->p_buffer[2] << 8 )|
+ p_frame->p_buffer[3] ) - 4;
/* msg_Dbg( p_dec, "i_spu_size=%d i_rle=%d",
p_sys->i_spu_size, p_sys->i_rle_size ); */
@@ -236,9 +236,9 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
p_sys->i_spu_size = 0;
p_sys->i_rle_size = 0;
p_sys->i_spu = 0;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
}
@@ -250,7 +250,7 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
msg_Dbg( p_dec, "SPU packets size=%d should be %d",
p_sys->i_spu, p_sys->i_spu_size );
- return p_sys->p_block;
+ return p_sys->p_frame;
}
return NULL;
}
diff --git a/modules/codec/spudec/spudec.h b/modules/codec/spudec/spudec.h
index f2f29f0012..30d5bf29f0 100644
--- a/modules/codec/spudec/spudec.h
+++ b/modules/codec/spudec/spudec.h
@@ -32,7 +32,7 @@ typedef struct
unsigned int i_rle_size;
unsigned int i_spu;
- block_t *p_block;
+ vlc_frame_t *p_frame;
/* We will never overflow */
uint8_t buffer[65536];
diff --git a/modules/codec/stl.c b/modules/codec/stl.c
index a00e0290a1..eda151688a 100644
--- a/modules/codec/stl.c
+++ b/modules/codec/stl.c
@@ -376,32 +376,32 @@ static void ResetGroups(decoder_sys_t *p_sys)
}
}
-static int Decode(decoder_t *p_dec, block_t *p_block)
+static int Decode(decoder_t *p_dec, vlc_frame_t *p_frame)
{
- if (p_block == NULL) /* No Drain */
+ if (p_frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
decoder_sys_t *p_sys = p_dec->p_sys;
- if(p_block->i_buffer < STL_TTI_SIZE)
- p_block->i_flags |= BLOCK_FLAG_CORRUPTED;
+ if(p_frame->i_buffer < STL_TTI_SIZE)
+ p_frame->i_flags |= FRAME_FLAG_CORRUPTED;
- if(p_block->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY))
+ if(p_frame->i_flags & (FRAME_FLAG_CORRUPTED|FRAME_FLAG_DISCONTINUITY))
{
ResetGroups(p_dec->p_sys);
- 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 VLCDEC_SUCCESS;
}
}
const char *psz_charset = cct_nums[p_sys->cct - CCT_BEGIN].str;
- for (size_t i = 0; i < p_block->i_buffer / STL_TTI_SIZE; i++)
+ for (size_t i = 0; i < p_frame->i_buffer / STL_TTI_SIZE; i++)
{
- stl_sg_t *p_group = &p_sys->groups[p_block->p_buffer[0]];
- if(ParseTTI(p_group, &p_block->p_buffer[i * STL_TTI_SIZE], psz_charset, p_sys->i_fps) &&
+ stl_sg_t *p_group = &p_sys->groups[p_frame->p_buffer[0]];
+ if(ParseTTI(p_group, &p_frame->p_buffer[i * STL_TTI_SIZE], psz_charset, p_sys->i_fps) &&
p_group->p_segment != NULL )
{
/* output */
@@ -412,16 +412,16 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
p_sub->b_absolute = false;
- if(p_group->i_end != VLC_TICK_INVALID && p_group->i_start >= p_block->i_dts)
+ if(p_group->i_end != VLC_TICK_INVALID && p_group->i_start >= p_frame->i_dts)
{
p_sub->i_start = VLC_TICK_0 + p_group->i_start;
p_sub->i_stop = VLC_TICK_0 + p_group->i_end;
}
else
{
- p_sub->i_start = p_block->i_pts;
- p_sub->i_stop = p_block->i_pts + p_block->i_length;
- p_sub->b_ephemer = (p_block->i_length == VLC_TICK_INVALID);
+ p_sub->i_start = p_frame->i_pts;
+ p_sub->i_stop = p_frame->i_pts + p_frame->i_length;
+ p_sub->b_ephemer = (p_frame->i_length == VLC_TICK_INVALID);
}
decoder_QueueSub(p_dec, p_sub);
}
@@ -430,7 +430,7 @@ static int Decode(decoder_t *p_dec, block_t *p_block)
ResetGroups(p_sys);
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 0016332906..0878243a2d 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -209,8 +209,8 @@ typedef struct
} decoder_sys_t;
-static int DecodeBlock ( decoder_t *, block_t * );
-static subpicture_t *ParseText ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
+static subpicture_t *ParseText ( decoder_t *, vlc_frame_t * );
static text_segment_t *ParseSubtitles(int *pi_align, const char * );
/*****************************************************************************
@@ -238,7 +238,7 @@ static int OpenDecoder( vlc_object_t *p_this )
if( p_sys == NULL )
return VLC_ENOMEM;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->fmt_out.i_codec = 0;
/* init of p_sys */
@@ -315,26 +315,26 @@ static int OpenDecoder( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with complete subtitles units.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
subpicture_t *p_spu;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
- p_spu = ParseText( p_dec, p_block );
+ p_spu = ParseText( p_dec, p_frame );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -357,16 +357,16 @@ static void CloseDecoder( vlc_object_t *p_this )
/*****************************************************************************
* ParseText: parse an text subtitle packet and send it to the video output
*****************************************************************************/
-static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
+static subpicture_t *ParseText( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
return NULL;
/* We cannot display a subpicture with no date */
- if( p_block->i_pts == VLC_TICK_INVALID )
+ if( p_frame->i_pts == VLC_TICK_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return NULL;
@@ -375,7 +375,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
/* Check validity of packet data */
/* An "empty" line containing only \0 can be used to force
and ephemer picture from the screen */
- if( p_block->i_buffer < 1 )
+ if( p_frame->i_buffer < 1 )
{
msg_Warn( p_dec, "no subtitle data" );
return NULL;
@@ -387,11 +387,11 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
if( p_sys->iconv_handle == (vlc_iconv_t)-1 ||
p_sys->b_autodetect_utf8 )
{
- psz_subtitle = malloc( p_block->i_buffer + 1 );
+ psz_subtitle = malloc( p_frame->i_buffer + 1 );
if( psz_subtitle == NULL )
return NULL;
- memcpy( psz_subtitle, p_block->p_buffer, p_block->i_buffer );
- psz_subtitle[p_block->i_buffer] = '\0';
+ memcpy( psz_subtitle, p_frame->p_buffer, p_frame->i_buffer );
+ psz_subtitle[p_frame->i_buffer] = '\0';
}
if( p_sys->iconv_handle == (vlc_iconv_t)-1 )
@@ -417,12 +417,12 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
if( !p_sys->b_autodetect_utf8 )
{
- size_t inbytes_left = p_block->i_buffer;
+ size_t inbytes_left = p_frame->i_buffer;
size_t outbytes_left = 6 * inbytes_left;
char *psz_new_subtitle = xmalloc( outbytes_left + 1 );
char *psz_convert_buffer_out = psz_new_subtitle;
const char *psz_convert_buffer_in =
- psz_subtitle ? psz_subtitle : (char *)p_block->p_buffer;
+ psz_subtitle ? psz_subtitle : (char *)p_frame->p_buffer;
size_t ret = vlc_iconv( p_sys->iconv_handle,
&psz_convert_buffer_in, &inbytes_left,
@@ -454,9 +454,9 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
free( psz_subtitle );
return NULL;
}
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + p_block->i_length;
- p_spu->b_ephemer = (p_block->i_length == VLC_TICK_INVALID);
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + p_frame->i_length;
+ p_spu->b_ephemer = (p_frame->i_length == VLC_TICK_INVALID);
p_spu->b_absolute = false;
subtext_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c
index 553c48e726..3e3579441f 100644
--- a/modules/codec/substx3g.c
+++ b/modules/codec/substx3g.c
@@ -36,10 +36,10 @@
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
#ifdef ENABLE_SOUT
static int OpenEncoder ( vlc_object_t * );
-static block_t * Encode( encoder_t *, subpicture_t * );
+static vlc_frame_t * Encode( encoder_t *, subpicture_t * );
#endif
vlc_module_begin ()
@@ -292,31 +292,31 @@ static void FontSizeConvert( const text_style_t *p_reference, text_style_t *p_st
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
subpicture_t *p_spu = NULL;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( ( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) ) ||
- p_block->i_buffer < sizeof(uint16_t) )
+ if( ( p_frame->i_flags & (FRAME_FLAG_CORRUPTED) ) ||
+ p_frame->i_buffer < sizeof(uint16_t) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- uint8_t *p_buf = p_block->p_buffer;
+ uint8_t *p_buf = p_frame->p_buffer;
/* Read our raw string and create the styled segment for HTML */
uint16_t i_psz_bytelength = GetWBE( p_buf );
- if( p_block->i_buffer < i_psz_bytelength + 2U )
+ if( p_frame->i_buffer < i_psz_bytelength + 2U )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
- const uint8_t *p_pszstart = p_block->p_buffer + sizeof(uint16_t);
+ const uint8_t *p_pszstart = p_frame->p_buffer + sizeof(uint16_t);
char *psz_subtitle;
if ( i_psz_bytelength > 2 &&
( !memcmp( p_pszstart, "\xFE\xFF", 2 ) || !memcmp( p_pszstart, "\xFF\xFE", 2 ) )
@@ -362,7 +362,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
mp4_box_iterator_t it;
mp4_box_iterator_Init( &it, p_buf,
- p_block->i_buffer - (p_buf - p_block->p_buffer) );
+ p_frame->i_buffer - (p_buf - p_frame->p_buffer) );
/* Parse our styles */
if( p_dec->fmt_in.i_codec != VLC_CODEC_QTXT )
while( mp4_box_iterator_Next( &it ) )
@@ -412,9 +412,9 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
}
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + p_block->i_length;
- p_spu->b_ephemer = (p_block->i_length == VLC_TICK_INVALID);
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + p_frame->i_length;
+ p_spu->b_ephemer = (p_frame->i_length == VLC_TICK_INVALID);
p_spu->b_absolute = false;
p_spu_sys->region.align = SUBPICTURE_ALIGN_BOTTOM;
@@ -439,7 +439,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_spu_sys->region.p_segments = p_text_segments;
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -649,10 +649,10 @@ static bool NeedStyling( const text_segment_t *p_segment )
return false;
}
-static block_t *GetStylBlock( const text_segment_t *p_segment, size_t i_styles )
+static vlc_frame_t *GetStylBlock( const text_segment_t *p_segment, size_t i_styles )
{
size_t i_start = 0;
- block_t *p_styl = block_Alloc( 10 + 12 * i_styles );
+ vlc_frame_t *p_styl = vlc_frame_Alloc( 10 + 12 * i_styles );
if( p_styl )
{
SetDWBE( p_styl->p_buffer, p_styl->i_buffer );
@@ -679,7 +679,7 @@ static block_t *GetStylBlock( const text_segment_t *p_segment, size_t i_styles )
return p_styl;
}
-static block_t * Encode( encoder_t *p_enc, subpicture_t *p_spu )
+static vlc_frame_t * Encode( encoder_t *p_enc, subpicture_t *p_spu )
{
VLC_UNUSED(p_enc);
const text_segment_t *p_segments = (p_spu->p_region)
@@ -696,26 +696,26 @@ static block_t * Encode( encoder_t *p_enc, subpicture_t *p_spu )
i_len += strlen( p_segment->psz_text );
}
- block_t *p_block = block_Alloc( i_len + 2 );
- if( !p_block )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( i_len + 2 );
+ if( !p_frame )
return NULL;
- SetWBE(p_block->p_buffer, i_len);
- p_block->i_buffer = 2;
+ SetWBE(p_frame->p_buffer, i_len);
+ p_frame->i_buffer = 2;
for(const text_segment_t *p_segment = p_segments;
p_segment; p_segment = p_segment->p_next )
{
size_t i_seglen = strlen(p_segment->psz_text);
- memcpy(&p_block->p_buffer[p_block->i_buffer],
+ memcpy(&p_frame->p_buffer[p_frame->i_buffer],
p_segment->psz_text, i_seglen);
- p_block->i_buffer += i_seglen;
+ p_frame->i_buffer += i_seglen;
}
- p_block->i_dts = p_block->i_pts = p_spu->i_start;
- p_block->i_length = p_spu->i_stop - p_spu->i_start;
+ p_frame->i_dts = p_frame->i_pts = p_spu->i_start;
+ p_frame->i_length = p_spu->i_stop - p_spu->i_start;
if( i_styles > 0 )
- p_block->p_next = GetStylBlock( p_segments, i_styles );
+ p_frame->p_next = GetStylBlock( p_segments, i_styles );
- return block_ChainGather( p_block );
+ return vlc_frame_ChainGather( p_frame );
}
#endif
diff --git a/modules/codec/subsusf.c b/modules/codec/subsusf.c
index c02c52b52f..4d40c3dac7 100644
--- a/modules/codec/subsusf.c
+++ b/modules/codec/subsusf.c
@@ -98,11 +98,11 @@ typedef struct
int i_images;
} decoder_sys_t;
-static int DecodeBlock ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
static char *CreatePlainText( char * );
static int ParseImageAttachments( decoder_t *p_dec );
-static subpicture_t *ParseText ( decoder_t *, block_t * );
+static subpicture_t *ParseText ( decoder_t *, vlc_frame_t * );
static void ParseUSFHeader( decoder_t * );
static subpicture_region_t *ParseUSFString( decoder_t *, char * );
static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, const char *psz_filename, int i_transparent_color );
@@ -125,7 +125,7 @@ static int OpenDecoder( vlc_object_t *p_this )
if( ( p_dec->p_sys = p_sys = calloc(1, sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM;
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->fmt_out.i_codec = 0;
/* init of p_sys */
@@ -148,20 +148,20 @@ static int OpenDecoder( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with complete subtitles units.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
subpicture_t *p_spu;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- p_spu = ParseText( p_dec, p_block );
+ p_spu = ParseText( p_dec, p_frame );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -210,17 +210,17 @@ static void CloseDecoder( vlc_object_t *p_this )
/*****************************************************************************
* ParseText: parse an text subtitle packet and send it to the video output
*****************************************************************************/
-static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
+static subpicture_t *ParseText( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
char *psz_subtitle = NULL;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
return NULL;
/* We cannot display a subpicture with no date */
- if( p_block->i_pts == VLC_TICK_INVALID )
+ if( p_frame->i_pts == VLC_TICK_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return NULL;
@@ -229,15 +229,15 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
/* Check validity of packet data */
/* An "empty" line containing only \0 can be used to force
and ephemer picture from the screen */
- if( p_block->i_buffer < 1 )
+ if( p_frame->i_buffer < 1 )
{
msg_Warn( p_dec, "no subtitle data" );
return NULL;
}
/* Should be resiliant against bad subtitles */
- psz_subtitle = strndup( (const char *)p_block->p_buffer,
- p_block->i_buffer );
+ psz_subtitle = strndup( (const char *)p_frame->p_buffer,
+ p_frame->i_buffer );
if( psz_subtitle == NULL )
return NULL;
@@ -260,9 +260,9 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
/* Decode USF strings */
p_spu->p_region = ParseUSFString( p_dec, psz_subtitle );
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + p_block->i_length;
- p_spu->b_ephemer = (p_block->i_length == VLC_TICK_INVALID);
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + p_frame->i_length;
+ p_spu->b_ephemer = (p_frame->i_length == VLC_TICK_INVALID);
p_spu->b_absolute = false;
p_spu->i_original_picture_width = p_sys->i_original_width;
p_spu->i_original_picture_height = p_sys->i_original_height;
@@ -501,16 +501,16 @@ static int ParseImageAttachments( decoder_t *p_dec )
p_image = image_HandlerCreate( p_dec );
if( p_image != NULL )
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
- p_block = block_Alloc( p_attach->i_data );
+ p_frame = vlc_frame_Alloc( p_attach->i_data );
- if( p_block != NULL )
+ if( p_frame != NULL )
{
es_format_t es_in;
video_format_t fmt_out;
- memcpy( p_block->p_buffer, p_attach->p_data, p_attach->i_data );
+ memcpy( p_frame->p_buffer, p_attach->p_data, p_attach->i_data );
es_format_Init( &es_in, VIDEO_ES, type );
es_in.video.i_chroma = type;
@@ -526,7 +526,7 @@ static int ParseImageAttachments( decoder_t *p_dec )
var_SetString( p_dec, "codec", "sdl_image" );
}
- p_pic = image_Read( p_image, p_block, &es_in, &fmt_out );
+ p_pic = image_Read( p_image, p_frame, &es_in, &fmt_out );
var_Destroy( p_dec, "codec" );
es_format_Clean( &es_in );
video_format_Clean( &fmt_out );
diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c
index 8b91a68da3..1967052736 100644
--- a/modules/codec/svcdsub.c
+++ b/modules/codec/svcdsub.c
@@ -63,12 +63,12 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int Decode( decoder_t *, block_t * );
-static block_t *Packetize ( decoder_t *, block_t ** );
-static block_t *Reassemble ( decoder_t *, block_t * );
-static void ParseHeader( decoder_t *, block_t * );
-static subpicture_t *DecodePacket( decoder_t *, block_t * );
-static void SVCDSubRenderImage( decoder_t *, block_t *, subpicture_region_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
+static vlc_frame_t *Reassemble ( decoder_t *, vlc_frame_t * );
+static void ParseHeader( decoder_t *, vlc_frame_t * );
+static subpicture_t *DecodePacket( decoder_t *, vlc_frame_t * );
+static void SVCDSubRenderImage( decoder_t *, vlc_frame_t *, subpicture_region_t * );
#define GETINT16(p) GetWBE(p) ; p +=2;
@@ -82,7 +82,7 @@ typedef struct
{
packet_state_t i_state; /* data-gathering state for this subtitle */
- block_t *p_spu; /* Bytes of the packet. */
+ vlc_frame_t *p_spu; /* Bytes of the packet. */
uint16_t i_image; /* image number in the subtitle stream */
uint8_t i_packet; /* packet number for above image number */
@@ -159,27 +159,27 @@ void DecoderClose( 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_spu ) block_ChainRelease( p_sys->p_spu );
+ if( p_sys->p_spu ) vlc_frame_ChainRelease( p_sys->p_spu );
free( p_sys );
}
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
#ifndef NDEBUG
msg_Dbg( p_dec, "Decode" );
#endif
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( !(p_block = Reassemble( p_dec, p_block )) )
+ if( !(p_frame = Reassemble( p_dec, p_frame )) )
return VLCDEC_SUCCESS;
/* Parse and decode */
- subpicture_t *p_spu = DecodePacket( p_dec, p_block );
+ subpicture_t *p_spu = DecodePacket( p_dec, p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -188,16 +188,16 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
/*****************************************************************************
* 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 )
{
- block_t *p_block, *p_spu;
+ vlc_frame_t *p_frame, *p_spu;
- if( pp_block == NULL || *pp_block == NULL ) return NULL;
+ if( pp_frame == NULL || *pp_frame == NULL ) return NULL;
- p_block = *pp_block;
- *pp_block = NULL;
+ p_frame = *pp_frame;
+ *pp_frame = NULL;
- if( !(p_spu = Reassemble( p_dec, p_block )) ) return NULL;
+ if( !(p_spu = Reassemble( p_dec, p_frame )) ) return NULL;
p_spu->i_dts = p_spu->i_pts;
p_spu->i_length = VLC_TICK_INVALID;
@@ -214,7 +214,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
parse the header, if this is the beginning, and combine the packets
into one complete subtitle unit.
- If everything is complete, we will return a block. Otherwise return
+ If everything is complete, we will return a frame. Otherwise return
NULL.
@@ -230,28 +230,28 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
*****************************************************************************/
#define SPU_HEADER_LEN 5
-static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
+static vlc_frame_t *Reassemble( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t *p_buffer;
uint16_t i_expected_image;
uint8_t i_packet, i_expected_packet;
- 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_buffer < SPU_HEADER_LEN )
+ if( p_frame->i_buffer < SPU_HEADER_LEN )
{
msg_Dbg( p_dec, "invalid packet header (size %zu < %u)" ,
- p_block->i_buffer, SPU_HEADER_LEN );
- block_Release( p_block );
+ p_frame->i_buffer, SPU_HEADER_LEN );
+ vlc_frame_Release( p_frame );
return NULL;
}
- p_buffer = p_block->p_buffer;
+ p_buffer = p_frame->p_buffer;
if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY )
{
@@ -293,22 +293,22 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
i_expected_packet, i_packet );
}
- p_block->p_buffer += SPU_HEADER_LEN;
- p_block->i_buffer -= SPU_HEADER_LEN;
+ p_frame->p_buffer += SPU_HEADER_LEN;
+ p_frame->i_buffer -= SPU_HEADER_LEN;
p_sys->i_packet = i_packet;
- /* First packet in the subtitle block */
- if( !p_sys->i_packet ) ParseHeader( p_dec, p_block );
+ /* First packet in the subtitle frame */
+ if( !p_sys->i_packet ) ParseHeader( p_dec, p_frame );
- block_ChainAppend( &p_sys->p_spu, p_block );
+ vlc_frame_ChainAppend( &p_sys->p_spu, p_frame );
if( p_sys->i_state == SUBTITLE_BLOCK_COMPLETE )
{
- block_t *p_spu = block_ChainGather( p_sys->p_spu );
+ vlc_frame_t *p_spu = vlc_frame_ChainGather( p_sys->p_spu );
if( unlikely( !p_spu ) )
{
- block_ChainRelease( p_sys->p_spu );
+ vlc_frame_ChainRelease( p_sys->p_spu );
p_sys->i_state = SUBTITLE_BLOCK_EMPTY;
p_sys->p_spu = NULL;
@@ -362,10 +362,10 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
byte[] limited RLE image data in interlace order (0,2,4... 1,3,5) with
2-bits per palette number
******************************************************************************/
-static void ParseHeader( decoder_t *p_dec, block_t *p_block )
+static void ParseHeader( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- uint8_t *p = p_block->p_buffer;
+ uint8_t *p = p_frame->p_buffer;
uint8_t i_options, i_cmd;
int i;
@@ -397,7 +397,7 @@ static void ParseHeader( decoder_t *p_dec, block_t *p_block )
/* Actually, this is measured against a different origin, so we have to
* adjust it */
p_sys->second_field_offset = GETINT16(p);
- p_sys->i_image_offset = p - p_block->p_buffer;
+ p_sys->i_image_offset = p - p_frame->p_buffer;
p_sys->i_image_length = p_sys->i_spu_size - p_sys->i_image_offset;
p_sys->metadata_length = p_sys->i_image_offset;
@@ -424,7 +424,7 @@ static void ParseHeader( decoder_t *p_dec, block_t *p_block )
* This function parses and decodes an SPU packet and, if valid, returns a
* subpicture.
*****************************************************************************/
-static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
+static subpicture_t *DecodePacket( decoder_t *p_dec, vlc_frame_t *p_data )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu;
@@ -505,7 +505,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
However we'll transform this so that that the RLE is expanded and
interlacing will also be removed.
*****************************************************************************/
-static void SVCDSubRenderImage( decoder_t *p_dec, block_t *p_data,
+static void SVCDSubRenderImage( decoder_t *p_dec, vlc_frame_t *p_data,
subpicture_region_t *p_region )
{
decoder_sys_t *p_sys = p_dec->p_sys;
diff --git a/modules/codec/svg.c b/modules/codec/svg.c
index a39200bbe6..68ef3d9641 100644
--- a/modules/codec/svg.c
+++ b/modules/codec/svg.c
@@ -45,7 +45,7 @@
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeBlock ( decoder_t *, block_t * );
+static int DecodeFrame ( decoder_t *, vlc_frame_t * );
#define TEXT_WIDTH N_("Image width")
#define LONG_TEXT_WIDTH N_("Specify the width to decode the image too")
@@ -111,17 +111,17 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_BGRA;
/* Set callbacks */
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
return VLC_SUCCESS;
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with a complete image.
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = (decoder_sys_t *) p_dec->p_sys;
picture_t *p_pic = NULL;
@@ -131,16 +131,16 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
cairo_surface_t *surface = NULL;
cairo_t *cr = NULL;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- 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 VLCDEC_SUCCESS;
}
- rsvg = rsvg_handle_new_from_data( p_block->p_buffer, p_block->i_buffer, NULL );
+ rsvg = rsvg_handle_new_from_data( p_frame->p_buffer, p_frame->i_buffer, NULL );
if( !rsvg )
goto done;
@@ -244,7 +244,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
goto done;
}
- p_pic->date = p_block->i_pts != VLC_TICK_INVALID ? p_block->i_pts : p_block->i_dts;
+ p_pic->date = p_frame->i_pts != VLC_TICK_INVALID ? p_frame->i_pts : p_frame->i_dts;
done:
if( rsvg )
@@ -254,7 +254,7 @@ done:
if( surface )
cairo_surface_destroy( surface );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_pic != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
diff --git a/modules/codec/t140.c b/modules/codec/t140.c
index c6e997ef19..11e9fe27ed 100644
--- a/modules/codec/t140.c
+++ b/modules/codec/t140.c
@@ -38,7 +38,7 @@ vlc_module_begin ()
vlc_module_end ()
-static block_t *Encode ( encoder_t *, subpicture_t * );
+static vlc_frame_t *Encode ( encoder_t *, subpicture_t * );
static int Open( vlc_object_t *p_this )
@@ -79,12 +79,12 @@ static void Close( vlc_object_t *p_this )
}
-static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
+static vlc_frame_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
{
VLC_UNUSED( p_enc );
subpicture_region_t *p_region;
- block_t *p_block;
+ vlc_frame_t *p_frame;
size_t len = 0;
if( p_spu == NULL )
@@ -106,26 +106,26 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
len += strlen( p_segment->psz_text );
}
- p_block = block_Alloc( len + 1 );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( len + 1 );
+ if( !p_frame )
return NULL;
- p_block->i_buffer = 0;
+ p_frame->i_buffer = 0;
for( const text_segment_t *p_segment = p_region->p_text;
p_segment; p_segment = p_segment->p_next )
{
if( p_segment->psz_text == NULL )
continue;
len = strlen( p_segment->psz_text );
- memcpy( &p_block->p_buffer[p_block->i_buffer],
+ memcpy( &p_frame->p_buffer[p_frame->i_buffer],
p_segment->psz_text, len );
- p_block->i_buffer += len;
+ p_frame->i_buffer += len;
}
- p_block->p_buffer[p_block->i_buffer] = 0;
+ p_frame->p_buffer[p_frame->i_buffer] = 0;
- p_block->i_pts = p_block->i_dts = p_spu->i_start;
+ p_frame->i_pts = p_frame->i_dts = p_spu->i_start;
if( !p_spu->b_ephemer && ( p_spu->i_stop > p_spu->i_start ) )
- p_block->i_length = p_spu->i_stop - p_spu->i_start;
+ p_frame->i_length = p_spu->i_stop - p_spu->i_start;
- return p_block;
+ return p_frame;
}
diff --git a/modules/codec/telx.c b/modules/codec/telx.c
index 317f23c659..813cc6d4d0 100644
--- a/modules/codec/telx.c
+++ b/modules/codec/telx.c
@@ -48,7 +48,7 @@
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
#define OVERRIDE_PAGE_TEXT N_("Override page")
#define OVERRIDE_PAGE_LONGTEXT N_("Override the indicated page, try this if " \
@@ -426,7 +426,7 @@ static void decode_string( char * res, int res_len,
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
@@ -443,15 +443,15 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
char psz_line[256];
int total;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
dbg((p_dec, "start of telx packet with header %2x\n",
- * (uint8_t *) p_block->p_buffer));
- len = p_block->i_buffer;
+ * (uint8_t *) p_frame->p_buffer));
+ len = p_frame->i_buffer;
for ( int offset = 1; offset + 46 <= len; offset += 46 )
{
- uint8_t * packet = (uint8_t *) p_block->p_buffer+offset;
+ uint8_t * packet = (uint8_t *) p_frame->p_buffer+offset;
// int vbi = ((0x20 & packet[2]) != 0 ? 0 : 313) + (0x1F & packet[2]);
// dbg((p_dec, "vbi %d header %02x %02x %02x\n", vbi, packet[0], packet[1], packet[2]));
@@ -528,14 +528,14 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_sys->b_erase[magazine] = (1 & (flag >> 7));
- dbg((p_dec, "%ld --> %ld\n", (long int) p_block->i_pts, (long int)(p_sys->prev_pts+1500000)));
+ dbg((p_dec, "%ld --> %ld\n", (long int) p_frame->i_pts, (long int)(p_sys->prev_pts+1500000)));
/* kludge here :
* we ignore the erase flag if it happens less than 1.5 seconds
* before last caption
* TODO make this time configurable
* UPDATE the kludge seems to be no more necessary
* so it's commented out*/
- if ( /*p_block->i_pts > p_sys->prev_pts + 1500000 && */
+ if ( /*p_frame->i_pts > p_sys->prev_pts + 1500000 && */
p_sys->b_erase[magazine] )
{
dbg((p_dec, "ERASE !\n"));
@@ -591,7 +591,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
if (t[0])
- p_sys->prev_pts = p_block->i_pts;
+ p_sys->prev_pts = p_frame->i_pts;
dbg((p_dec, "%d %d : ", magazine, row));
dbg((p_dec, "%s\n", t));
@@ -700,13 +700,13 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_spu->p_region->i_y = 10;
p_spu->p_region->p_text = text_segment_New(psz_text);
- p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + p_block->i_length;
- p_spu->b_ephemer = (p_block->i_length == 0);
+ p_spu->i_start = p_frame->i_pts;
+ p_spu->i_stop = p_frame->i_pts + p_frame->i_length;
+ p_spu->b_ephemer = (p_frame->i_length == 0);
p_spu->b_absolute = false;
- dbg((p_dec, "%ld --> %ld\n", (long int) p_block->i_pts/100000, (long int)p_block->i_length/100000));
+ dbg((p_dec, "%ld --> %ld\n", (long int) p_frame->i_pts/100000, (long int)p_frame->i_length/100000));
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_spu != NULL )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
@@ -718,6 +718,6 @@ error:
p_spu = NULL;
}
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/textst.c b/modules/codec/textst.c
index 567f97edf0..0da1556590 100644
--- a/modules/codec/textst.c
+++ b/modules/codec/textst.c
@@ -227,33 +227,33 @@ static void textst_FillRegions(decoder_t *p_dec, const uint8_t *p_data, size_t i
}
}
-static int Decode(decoder_t *p_dec, block_t *p_block)
+static int Decode(decoder_t *p_dec, vlc_frame_t *p_frame)
{
subpicture_t *p_sub = NULL;
- if (p_block == NULL) /* No Drain */
+ if (p_frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- if (p_block->i_buffer > 18 &&
- (p_block->i_flags & BLOCK_FLAG_CORRUPTED) == 0 &&
+ if (p_frame->i_buffer > 18 &&
+ (p_frame->i_flags & FRAME_FLAG_CORRUPTED) == 0 &&
(p_sub = decoder_NewSubpictureText(p_dec)))
{
- p_sub->i_start = FROM_SCALE(((int64_t)(p_block->p_buffer[3] & 0x01) << 32) | GetDWBE(&p_block->p_buffer[4]));
- p_sub->i_stop = FROM_SCALE(((int64_t)(p_block->p_buffer[8] & 0x01) << 32) | GetDWBE(&p_block->p_buffer[9]));
- if (p_sub->i_start < p_block->i_dts)
+ p_sub->i_start = FROM_SCALE(((int64_t)(p_frame->p_buffer[3] & 0x01) << 32) | GetDWBE(&p_frame->p_buffer[4]));
+ p_sub->i_stop = FROM_SCALE(((int64_t)(p_frame->p_buffer[8] & 0x01) << 32) | GetDWBE(&p_frame->p_buffer[9]));
+ if (p_sub->i_start < p_frame->i_dts)
{
- p_sub->i_stop += p_block->i_dts - p_sub->i_start;
- p_sub->i_start = p_block->i_dts;
+ p_sub->i_stop += p_frame->i_dts - p_sub->i_start;
+ p_sub->i_start = p_frame->i_dts;
}
subtext_updater_sys_t *p_spusys = p_sub->updater.p_sys;
- textst_FillRegions(p_dec, &p_block->p_buffer[13], p_block->i_buffer - 13,
+ textst_FillRegions(p_dec, &p_frame->p_buffer[13], p_frame->i_buffer - 13,
&p_spusys->region);
p_sub->b_absolute = false;
decoder_QueueSub(p_dec, p_sub);
}
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/theora.c b/modules/codec/theora.c
index 5ed08a9b84..dea02823ec 100644
--- a/modules/codec/theora.c
+++ b/modules/codec/theora.c
@@ -81,10 +81,10 @@ static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeVideo ( decoder_t *, block_t * );
-static block_t *Packetize ( decoder_t *, block_t ** );
+static int DecodeVideo ( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
static int ProcessHeaders( decoder_t * );
-static void *ProcessPacket ( decoder_t *, ogg_packet *, block_t * );
+static void *ProcessPacket ( decoder_t *, ogg_packet *, vlc_frame_t * );
static void Flush( decoder_t * );
static picture_t *DecodePacket( decoder_t *, ogg_packet * );
@@ -95,7 +95,7 @@ static void theora_CopyPicture( picture_t *, th_ycbcr_buffer );
#ifdef ENABLE_SOUT
static int OpenEncoder( vlc_object_t *p_this );
static void CloseEncoder( vlc_object_t *p_this );
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict );
#endif
/*****************************************************************************
@@ -194,19 +194,19 @@ static int OpenPacketizer( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static void *DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket;
- /* Block to Ogg packet */
- oggpacket.packet = p_block->p_buffer;
- oggpacket.bytes = p_block->i_buffer;
- oggpacket.granulepos = p_block->i_dts;
+ /* Frame to Ogg packet */
+ oggpacket.packet = p_frame->p_buffer;
+ oggpacket.bytes = p_frame->i_buffer;
+ oggpacket.granulepos = p_frame->i_dts;
oggpacket.b_o_s = 0;
oggpacket.e_o_s = 0;
oggpacket.packetno = 0;
@@ -216,34 +216,34 @@ static void *DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
if( ProcessHeaders( p_dec ) )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket( p_dec, &oggpacket, p_block );
+ return ProcessPacket( p_dec, &oggpacket, p_frame );
}
-static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
+static int DecodeVideo( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- picture_t *p_pic = DecodeBlock( p_dec, p_block );
+ picture_t *p_pic = DecodeFrame( p_dec, p_frame );
if( p_pic != NULL )
decoder_QueueVideo( p_dec, p_pic );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- block_t *p_block = *pp_block; *pp_block = NULL;
- if( p_block == NULL )
+ vlc_frame_t *p_frame = *pp_frame; *pp_frame = NULL;
+ if( p_frame == NULL )
return NULL;
- return DecodeBlock( p_dec, p_block );
+ return DecodeFrame( p_dec, p_frame );
}
/*****************************************************************************
@@ -446,43 +446,43 @@ static void Flush( decoder_t *p_dec )
* ProcessPacket: processes a theora packet.
*****************************************************************************/
static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
- block_t *p_block )
+ vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
void *p_buf;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
Flush( p_dec );
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
{
/* Don't send the a corrupted packet to
* theora_decode, otherwise we get purple/green display artifacts
* appearing in the video output */
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return NULL;
}
}
/* Date management */
- if( p_block->i_pts != VLC_TICK_INVALID && p_block->i_pts != p_sys->i_pts )
+ if( p_frame->i_pts != VLC_TICK_INVALID && p_frame->i_pts != p_sys->i_pts )
{
- p_sys->i_pts = p_block->i_pts;
+ p_sys->i_pts = p_frame->i_pts;
}
if( p_sys->b_packetizer )
{
/* Date management */
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
- p_block->i_length = p_sys->i_pts - p_block->i_pts;
+ p_frame->i_length = p_sys->i_pts - p_frame->i_pts;
- p_buf = p_block;
+ p_buf = p_frame;
}
else
{
p_buf = DecodePacket( p_dec, p_oggpacket );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
}
/* Date management */
@@ -801,11 +801,11 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************
* This function spits out ogg packets.
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict )
{
encoder_sys_t *p_sys = p_enc->p_sys;
ogg_packet oggpacket;
- block_t *p_block;
+ vlc_frame_t *p_frame;
th_ycbcr_buffer ycbcr;
unsigned i;
@@ -889,17 +889,17 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
th_encode_packetout( p_sys->tcx, 0, &oggpacket );
- /* Ogg packet to block */
- p_block = block_Alloc( oggpacket.bytes );
- memcpy( p_block->p_buffer, oggpacket.packet, oggpacket.bytes );
- p_block->i_dts = p_block->i_pts = p_pict->date;
+ /* Ogg packet to frame */
+ p_frame = vlc_frame_Alloc( oggpacket.bytes );
+ memcpy( p_frame->p_buffer, oggpacket.packet, oggpacket.bytes );
+ p_frame->i_dts = p_frame->i_pts = p_pict->date;
if( th_packet_iskeyframe( &oggpacket ) )
{
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
}
- return p_block;
+ return p_frame;
}
/*****************************************************************************
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index 16c92ec12a..b00bb53ca4 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -1165,10 +1165,10 @@ static picture_t * picture_CreateFromPNG( decoder_t *p_dec,
es_format_Init( &es_in, VIDEO_ES, VLC_CODEC_PNG );
es_in.video.i_chroma = es_in.i_codec;
- block_t *p_block = block_Alloc( i_data );
- if( !p_block )
+ vlc_frame_t *p_frame = vlc_frame_Alloc( i_data );
+ if( !p_frame )
return NULL;
- memcpy( p_block->p_buffer, p_data, i_data );
+ memcpy( p_frame->p_buffer, p_data, i_data );
picture_t *p_pic = NULL;
struct vlc_logger *logger = p_dec->obj.logger;
@@ -1178,10 +1178,10 @@ static picture_t * picture_CreateFromPNG( decoder_t *p_dec,
image_handler_t *p_image = image_HandlerCreate( p_dec );
if( p_image )
{
- p_pic = image_Read( p_image, p_block, &es_in, &fmt_out );
+ p_pic = image_Read( p_image, p_frame, &es_in, &fmt_out );
image_HandlerDelete( p_image );
}
- else block_Release( p_block );
+ else vlc_frame_Release( p_frame );
p_dec->obj.no_interact = no_interact;
p_dec->obj.logger = logger;
es_format_Clean( &es_in );
@@ -1222,7 +1222,7 @@ static void TTMLRegionsToSpuBitmapRegions( decoder_t *p_dec, subpicture_t *p_spu
}
}
-static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
+static int ParseFrame( decoder_t *p_dec, const vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -1237,17 +1237,17 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
tt_time_Init( &temporal_extent.dur );
temporal_extent.begin.base = 0;
- if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
+ if( p_frame->i_flags & FRAME_FLAG_CORRUPTED )
return VLCDEC_SUCCESS;
/* We cannot display a subpicture with no date */
- if( p_block->i_pts == VLC_TICK_INVALID )
+ if( p_frame->i_pts == VLC_TICK_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return VLCDEC_SUCCESS;
}
- tt_node_t *p_rootnode = ParseTTML( p_dec, p_block->p_buffer, p_block->i_buffer );
+ tt_node_t *p_rootnode = ParseTTML( p_dec, p_frame->p_buffer, p_frame->i_buffer );
if( !p_rootnode )
return VLCDEC_SUCCESS;
@@ -1259,19 +1259,19 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
printf("%ld ", tt_time_Convert( &p_timings_array[i] ) );
printf("\n");
#endif
- vlc_tick_t i_block_start_time = p_block->i_dts - p_sys->pes.i_offset;
+ vlc_tick_t i_frame_start_time = p_frame->i_dts - p_sys->pes.i_offset;
- if(TTML_in_PES(p_dec) && i_block_start_time < p_sys->pes.i_prev_segment_start_time )
- i_block_start_time = p_sys->pes.i_prev_segment_start_time;
+ if(TTML_in_PES(p_dec) && i_frame_start_time < p_sys->pes.i_prev_segment_start_time )
+ i_frame_start_time = p_sys->pes.i_prev_segment_start_time;
for( size_t i=0; i+1 < i_timings_count; i++ )
{
/* We Only support absolute timings (2) */
- if( tt_time_Convert( &p_timings_array[i] ) + VLC_TICK_0 < i_block_start_time )
+ if( tt_time_Convert( &p_timings_array[i] ) + VLC_TICK_0 < i_frame_start_time )
continue;
if( !TTML_in_PES(p_dec) &&
- tt_time_Convert( &p_timings_array[i] ) + VLC_TICK_0 > i_block_start_time + p_block->i_length )
+ tt_time_Convert( &p_timings_array[i] ) + VLC_TICK_0 > i_frame_start_time + p_frame->i_length )
break;
if( TTML_in_PES(p_dec) && p_sys->pes.i_prev_segment_start_time < tt_time_Convert( &p_timings_array[i] ) )
@@ -1329,29 +1329,29 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- int ret = ParseBlock( p_dec, p_block );
+ int ret = ParseFrame( p_dec, p_frame );
#ifdef TTML_DEBUG
- if( p_block->i_buffer )
+ if( p_frame->i_buffer )
{
- p_block->p_buffer[p_block->i_buffer - 1] = 0;
- msg_Dbg(p_dec,"time %ld %s", p_block->i_dts, p_block->p_buffer);
+ p_frame->p_buffer[p_frame->i_buffer - 1] = 0;
+ msg_Dbg(p_dec,"time %ld %s", p_frame->i_dts, p_frame->p_buffer);
}
#endif
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return ret;
}
-static int DecodePESBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodePESFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return ParsePESEncap( p_dec, &p_sys->pes, DecodeBlock, p_block );
+ return ParsePESEncap( p_dec, &p_sys->pes, DecodeFrame, p_frame );
}
/*****************************************************************************
@@ -1381,9 +1381,9 @@ int tt_OpenDecoder( vlc_object_t *p_this )
return VLC_ENOMEM;
if( !TTML_in_PES( p_dec ) )
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
else
- p_dec->pf_decode = DecodePESBlock;
+ p_dec->pf_decode = DecodePESFrame;
p_dec->pf_flush = Flush;
p_sys->i_align = var_InheritInteger( p_dec, "ttml-align" );
ttml_in_pes_Init( &p_sys->pes );
diff --git a/modules/codec/ttml/ttmlpes.h b/modules/codec/ttml/ttmlpes.h
index 9593148328..e26fdbcd93 100644
--- a/modules/codec/ttml/ttmlpes.h
+++ b/modules/codec/ttml/ttmlpes.h
@@ -19,7 +19,7 @@
*****************************************************************************/
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_stream.h>
enum
@@ -31,14 +31,14 @@ enum
struct ttml_in_pes_ctx
{
vlc_tick_t i_offset; /* relative segment offset to apply */
- vlc_tick_t i_prev_block_time; /* because blocks are duplicated */
+ vlc_tick_t i_prev_frame_time; /* because frames are duplicated */
vlc_tick_t i_prev_segment_start_time; /* because content can overlap */
};
static void ttml_in_pes_Init(struct ttml_in_pes_ctx *p)
{
p->i_offset = 0;
- p->i_prev_block_time = -1;
+ p->i_prev_frame_time = -1;
p->i_prev_segment_start_time = -1;
}
@@ -47,10 +47,10 @@ static inline bool TTML_in_PES(decoder_t *p_dec)
return p_dec->fmt_in.i_codec == VLC_CODEC_TTML_TS;
}
-static block_t * DecompressTTML( decoder_t *p_dec, const uint8_t *p_data, size_t i_data )
+static vlc_frame_t * DecompressTTML( decoder_t *p_dec, const uint8_t *p_data, size_t i_data )
{
- block_t *p_decomp = NULL;
- block_t **pp_append = &p_decomp;
+ vlc_frame_t *p_decomp = NULL;
+ vlc_frame_t **pp_append = &p_decomp;
stream_t *s = vlc_stream_MemoryNew( p_dec, (uint8_t *) p_data, i_data, true );
if( !s )
@@ -60,7 +60,7 @@ static block_t * DecompressTTML( decoder_t *p_dec, const uint8_t *p_data, size_t
{
for( ;; )
{
- *pp_append = vlc_stream_Block( p_inflate, 64 * 1024 );
+ *pp_append = vlc_stream_Frame( p_inflate, 64 * 1024 );
if( *pp_append == NULL ||
(*pp_append)->i_buffer < 64*1024 )
break;
@@ -69,36 +69,36 @@ static block_t * DecompressTTML( decoder_t *p_dec, const uint8_t *p_data, size_t
s = p_inflate;
}
vlc_stream_Delete( s );
- return p_decomp ? block_ChainGather( p_decomp ) : NULL;
+ return p_decomp ? vlc_frame_ChainGather( p_decomp ) : NULL;
}
static int ParsePESEncap( decoder_t *p_dec,
struct ttml_in_pes_ctx *p_ctx,
- int(*pf_decode)(decoder_t *, block_t *),
- block_t *p_block )
+ int(*pf_decode)(decoder_t *, vlc_frame_t *),
+ vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_buffer < 7 )
+ if( p_frame->i_buffer < 7 )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLC_EGENERIC;
}
- if( p_block->i_dts == p_ctx->i_prev_block_time )
+ if( p_frame->i_dts == p_ctx->i_prev_frame_time )
{
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLC_SUCCESS;
}
- int64_t i_segment_base = GetDWBE(p_block->p_buffer);
- i_segment_base = (i_segment_base << 16) | GetWBE(&p_block->p_buffer[4]);
+ int64_t i_segment_base = GetDWBE(p_frame->p_buffer);
+ i_segment_base = (i_segment_base << 16) | GetWBE(&p_frame->p_buffer[4]);
i_segment_base *= 100;
- uint8_t i_num_segments = p_block->p_buffer[6];
- size_t i_data = p_block->i_buffer - 7;
- const uint8_t *p_data = &p_block->p_buffer[7];
- p_ctx->i_offset = (p_block->i_dts - VLC_TICK_0) - i_segment_base;
+ uint8_t i_num_segments = p_frame->p_buffer[6];
+ size_t i_data = p_frame->i_buffer - 7;
+ const uint8_t *p_data = &p_frame->p_buffer[7];
+ p_ctx->i_offset = (p_frame->i_dts - VLC_TICK_0) - i_segment_base;
for( uint8_t i=0; i<i_num_segments; i++ )
{
if( i_data < 3 )
@@ -107,10 +107,10 @@ static int ParsePESEncap( decoder_t *p_dec,
uint16_t i_size = GetWBE(&p_data[1]);
if( i_size > i_data - 3 )
break;
- block_t *p_segment = NULL;
+ vlc_frame_t *p_segment = NULL;
if( i_type == TTML_UNCOMPRESSED_DOCUMENT )
{
- p_segment = block_Alloc( i_size );
+ p_segment = vlc_frame_Alloc( i_size );
if( p_segment )
memcpy( p_segment->p_buffer, &p_data[3], i_size );
}
@@ -121,7 +121,7 @@ static int ParsePESEncap( decoder_t *p_dec,
if( p_segment )
{
- block_CopyProperties( p_segment, p_block );
+ vlc_frame_CopyProperties( p_segment, p_frame );
pf_decode( p_dec, p_segment );
}
@@ -129,7 +129,7 @@ static int ParsePESEncap( decoder_t *p_dec,
i_data -= 3 + i_size;
}
- p_ctx->i_prev_block_time = p_block->i_dts;
- block_Release( p_block );
+ p_ctx->i_prev_frame_time = p_frame->i_dts;
+ vlc_frame_Release( p_frame );
return VLC_SUCCESS;
}
diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 4208ab100e..d8e7b28105 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -43,7 +43,7 @@
****************************************************************************/
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
-static block_t *Encode ( encoder_t *, block_t * );
+static vlc_frame_t *Encode ( encoder_t *, vlc_frame_t * );
/*****************************************************************************
* Module descriptor
@@ -270,30 +270,30 @@ static void Bufferize( encoder_t *p_enc, int16_t *p_in, int i_nb_samples )
memcpy( p_sys->p_buffer + i_offset, p_in, i_copy * sizeof(int16_t) );
}
-static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *Encode( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- block_t *p_chain = NULL;
+ vlc_frame_t *p_chain = NULL;
if( unlikely( !p_aout_buf ) ) {
int i_used = 0;
- block_t *p_block;
+ vlc_frame_t *p_frame;
i_used = twolame_encode_flush( p_sys->p_twolame,
p_sys->p_out_buffer, MAX_CODED_FRAME_SIZE );
if( i_used <= 0 )
return NULL;
- p_block = block_Alloc( i_used );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( i_used );
+ if( !p_frame )
return NULL;
- memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
- p_block->i_length = vlc_tick_from_samples( MPEG_FRAME_SIZE,
+ memcpy( p_frame->p_buffer, p_sys->p_out_buffer, i_used );
+ p_frame->i_length = vlc_tick_from_samples( MPEG_FRAME_SIZE,
p_enc->fmt_out.audio.i_rate );
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
- p_sys->i_pts += p_block->i_length;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
+ p_sys->i_pts += p_frame->i_length;
- return p_block;
+ return p_frame;
}
int16_t *p_buffer = (int16_t *)p_aout_buf->p_buffer;
@@ -306,7 +306,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
while ( p_sys->i_nb_samples + i_nb_samples >= MPEG_FRAME_SIZE )
{
int i_used;
- block_t *p_block;
+ vlc_frame_t *p_frame;
Bufferize( p_enc, p_buffer, MPEG_FRAME_SIZE - p_sys->i_nb_samples );
i_nb_samples -= MPEG_FRAME_SIZE - p_sys->i_nb_samples;
@@ -323,19 +323,19 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
}
p_sys->i_nb_samples = 0;
- p_block = block_Alloc( i_used );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( i_used );
+ if( !p_frame )
{
if( p_chain )
- block_ChainRelease( p_chain );
+ vlc_frame_ChainRelease( p_chain );
return NULL;
}
- memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
- p_block->i_length = vlc_tick_from_samples( MPEG_FRAME_SIZE,
+ memcpy( p_frame->p_buffer, p_sys->p_out_buffer, i_used );
+ p_frame->i_length = vlc_tick_from_samples( MPEG_FRAME_SIZE,
p_enc->fmt_out.audio.i_rate );
- p_block->i_dts = p_block->i_pts = p_sys->i_pts;
- p_sys->i_pts += p_block->i_length;
- block_ChainAppend( &p_chain, p_block );
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_pts;
+ p_sys->i_pts += p_frame->i_length;
+ vlc_frame_ChainAppend( &p_chain, p_frame );
}
if ( i_nb_samples )
diff --git a/modules/codec/uleaddvaudio.c b/modules/codec/uleaddvaudio.c
index 4d80908703..31fe9e624e 100644
--- a/modules/codec/uleaddvaudio.c
+++ b/modules/codec/uleaddvaudio.c
@@ -60,45 +60,45 @@ static void Flush(decoder_t *dec)
date_Set(&sys->end_date, VLC_TICK_INVALID);
}
-static block_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
+static vlc_frame_t *DecodeFrame(decoder_t *dec, vlc_frame_t **frame_ptr)
{
decoder_sys_t *sys = dec->p_sys;
- if (!*block_ptr)
+ if (!*frame_ptr)
return NULL;
- block_t *block = *block_ptr;
- if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
+ vlc_frame_t *frame = *frame_ptr;
+ if (frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED)) {
Flush(dec);
- if (block->i_flags & BLOCK_FLAG_CORRUPTED) {
- block_Release(block);
- *block_ptr = NULL;
+ if (frame->i_flags & FRAME_FLAG_CORRUPTED) {
+ vlc_frame_Release(frame);
+ *frame_ptr = NULL;
return NULL;
}
}
- if (block->i_pts != VLC_TICK_INVALID &&
- block->i_pts != date_Get(&sys->end_date))
- date_Set(&sys->end_date, block->i_pts);
- block->i_pts = VLC_TICK_INVALID;
+ if (frame->i_pts != VLC_TICK_INVALID &&
+ frame->i_pts != date_Get(&sys->end_date))
+ date_Set(&sys->end_date, frame->i_pts);
+ frame->i_pts = VLC_TICK_INVALID;
if (date_Get(&sys->end_date) == VLC_TICK_INVALID) {
/* We've just started the stream, wait for the first PTS. */
- block_Release(block);
+ vlc_frame_Release(frame);
return NULL;
}
- const unsigned int block_size = sys->is_pal ? 8640 : 7200;
- if (block->i_buffer >= block_size) {
- uint8_t *src = block->p_buffer;
+ const unsigned int frame_size = sys->is_pal ? 8640 : 7200;
+ if (frame->i_buffer >= frame_size) {
+ uint8_t *src = frame->p_buffer;
- block->i_buffer -= block_size;
- block->p_buffer += block_size;
+ frame->i_buffer -= frame_size;
+ frame->p_buffer += frame_size;
int sample_count = dv_get_audio_sample_count(&src[244], sys->is_pal);
if( decoder_UpdateAudioFormat(dec))
return NULL;
- block_t *output = decoder_NewAudioBuffer(dec, sample_count);
+ vlc_frame_t *output = decoder_NewAudioBuffer(dec, sample_count);
if (!output)
return NULL;
output->i_pts = date_Get(&sys->end_date);
@@ -117,17 +117,17 @@ static block_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
}
return output;
}
- block_Release(block);
+ vlc_frame_Release(frame);
return NULL;
}
-static int DecodeAudio(decoder_t *dec, block_t *block)
+static int DecodeAudio(decoder_t *dec, vlc_frame_t *frame)
{
- if (block == NULL) /* No Drain */
+ if (frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- block_t **block_ptr = &block, *out;
- while ((out = DecodeBlock(dec, block_ptr)) != NULL)
+ vlc_frame_t **frame_ptr = &frame, *out;
+ while ((out = DecodeFrame(dec, frame_ptr)) != NULL)
decoder_QueueAudio(dec,out);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index b01b5d4511..c1cf7c5665 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -106,7 +106,7 @@ static CFMutableDictionaryRef ESDSExtradataInfoCreate(decoder_t *, uint8_t *, ui
static CFMutableDictionaryRef ExtradataInfoCreate(CFStringRef, void *, size_t);
static CFMutableDictionaryRef CreateSessionDescriptionFormat(decoder_t *, unsigned, unsigned);
static int HandleVTStatus(decoder_t *, OSStatus, enum vtsession_status *);
-static int DecodeBlock(decoder_t *, block_t *);
+static int DecodeFrame(decoder_t *, vlc_frame_t *);
static void RequestFlush(decoder_t *);
static void Drain(decoder_t *p_dec, bool flush);
static void DecoderCallback(void *, void *, OSStatus, VTDecodeInfoFlags,
@@ -148,13 +148,13 @@ typedef struct decoder_sys_t
void (*pf_codec_clean)(decoder_t *);
bool (*pf_codec_supported)(decoder_t *);
bool (*pf_late_start)(decoder_t *);
- block_t* (*pf_process_block)(decoder_t *,
- block_t *, bool *);
+ vlc_frame_t* (*pf_process_frame)(decoder_t *,
+ vlc_frame_t *, bool *);
bool (*pf_need_restart)(decoder_t *,
VTDecompressionSessionRef);
bool (*pf_configure_vout)(decoder_t *);
CFMutableDictionaryRef (*pf_get_extradata)(decoder_t *);
- bool (*pf_fill_reorder_info)(decoder_t *, const block_t *,
+ bool (*pf_fill_reorder_info)(decoder_t *, const vlc_frame_t *,
frame_info_t *);
/* !Codec specific callbacks */
@@ -181,7 +181,7 @@ typedef struct decoder_sys_t
h264_poc_context_t h264_pocctx;
hevc_poc_ctx_t hevc_pocctx;
- bool b_drop_blocks;
+ bool b_drop_frames;
date_t pts;
struct pic_holder *pic_holder;
@@ -268,12 +268,12 @@ static bool ParseH264SEI(const hxxx_sei_data_t *p_sei_data, void *priv)
return true;
}
-static bool FillReorderInfoH264(decoder_t *p_dec, const block_t *p_block,
+static bool FillReorderInfoH264(decoder_t *p_dec, const vlc_frame_t *p_frame,
frame_info_t *p_info)
{
decoder_sys_t *p_sys = p_dec->p_sys;
hxxx_iterator_ctx_t itctx;
- hxxx_iterator_init(&itctx, p_block->p_buffer, p_block->i_buffer,
+ hxxx_iterator_init(&itctx, p_frame->p_buffer, p_frame->i_buffer,
p_sys->hh.i_nal_length_size);
const uint8_t *p_nal; size_t i_nal;
@@ -365,10 +365,10 @@ static bool FillReorderInfoH264(decoder_t *p_dec, const block_t *p_block,
}
-static block_t *ProcessBlockH264(decoder_t *p_dec, block_t *p_block, bool *pb_config_changed)
+static vlc_frame_t *ProcessFrameH264(decoder_t *p_dec, vlc_frame_t *p_frame, bool *pb_config_changed)
{
decoder_sys_t *p_sys = p_dec->p_sys;
- return p_sys->hh.pf_process_block(&p_sys->hh, p_block, pb_config_changed);
+ return p_sys->hh.pf_process_frame(&p_sys->hh, p_frame, pb_config_changed);
}
@@ -403,13 +403,13 @@ static CFMutableDictionaryRef GetDecoderExtradataH264(decoder_t *p_dec)
else if (p_sys->hh.h264.i_pps_count && p_sys->hh.h264.i_sps_count)
{
/* build DecoderConfiguration from gathered */
- block_t *p_avcC = h264_helper_get_avcc_config(&p_sys->hh);
+ vlc_frame_t *p_avcC = h264_helper_get_avcc_config(&p_sys->hh);
if (p_avcC)
{
extradata = ExtradataInfoCreate(CFSTR("avcC"),
p_avcC->p_buffer,
p_avcC->i_buffer);
- block_Release(p_avcC);
+ vlc_frame_Release(p_avcC);
}
}
return extradata;
@@ -619,12 +619,12 @@ static bool ParseHEVCSEI(const hxxx_sei_data_t *p_sei_data, void *priv)
return true;
}
-static bool FillReorderInfoHEVC(decoder_t *p_dec, const block_t *p_block,
+static bool FillReorderInfoHEVC(decoder_t *p_dec, const vlc_frame_t *p_frame,
frame_info_t *p_info)
{
decoder_sys_t *p_sys = p_dec->p_sys;
hxxx_iterator_ctx_t itctx;
- hxxx_iterator_init(&itctx, p_block->p_buffer, p_block->i_buffer,
+ hxxx_iterator_init(&itctx, p_frame->p_buffer, p_frame->i_buffer,
p_sys->hh.i_nal_length_size);
const uint8_t *p_nal; size_t i_nal;
@@ -655,8 +655,8 @@ static bool FillReorderInfoHEVC(decoder_t *p_dec, const block_t *p_block,
* is likely failing to handle this case. */
if (!p_sys->b_vt_feed && (i_nal_type != HEVC_NAL_IDR_W_RADL &&
i_nal_type != HEVC_NAL_IDR_N_LP))
- p_sys->b_drop_blocks = true;
- else if (p_sys->b_drop_blocks)
+ p_sys->b_drop_frames = true;
+ else if (p_sys->b_drop_frames)
{
if (i_nal_type == HEVC_NAL_RASL_N || i_nal_type == HEVC_NAL_RASL_R)
{
@@ -664,7 +664,7 @@ static bool FillReorderInfoHEVC(decoder_t *p_dec, const block_t *p_block,
return false;
}
else
- p_sys->b_drop_blocks = false;
+ p_sys->b_drop_frames = false;
}
p_info->b_keyframe = i_nal_type >= HEVC_NAL_BLA_W_LP;
@@ -755,13 +755,13 @@ static CFMutableDictionaryRef GetDecoderExtradataHEVC(decoder_t *p_dec)
p_sys->hh.hevc.i_vps_count)
{
/* build DecoderConfiguration from gathered */
- block_t *p_hvcC = hevc_helper_get_hvcc_config(&p_sys->hh);
+ vlc_frame_t *p_hvcC = hevc_helper_get_hvcc_config(&p_sys->hh);
if (p_hvcC)
{
extradata = ExtradataInfoCreate(CFSTR("hvcC"),
p_hvcC->p_buffer,
p_hvcC->i_buffer);
- block_Release(p_hvcC);
+ vlc_frame_Release(p_hvcC);
}
}
return extradata;
@@ -784,7 +784,7 @@ static bool CodecSupportedHEVC(decoder_t *p_dec)
}
#define ConfigureVoutHEVC ConfigureVoutH264
-#define ProcessBlockHEVC ProcessBlockH264
+#define ProcessFrameHEVC ProcessFrameH264
#define VideoToolboxNeedsToRestartHEVC VideoToolboxNeedsToRestartH264
static CFMutableDictionaryRef GetDecoderExtradataMPEG4(decoder_t *p_dec)
@@ -904,7 +904,7 @@ static void DrainDPBLocked(decoder_t *p_dec, bool flush)
}
}
-static frame_info_t * CreateReorderInfo(decoder_t *p_dec, const block_t *p_block)
+static frame_info_t * CreateReorderInfo(decoder_t *p_dec, const vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
frame_info_t *p_info = calloc(1, sizeof(*p_info));
@@ -913,7 +913,7 @@ static frame_info_t * CreateReorderInfo(decoder_t *p_dec, const block_t *p_block
if (p_sys->pf_fill_reorder_info)
{
- if(!p_sys->pf_fill_reorder_info(p_dec, p_block, p_info))
+ if(!p_sys->pf_fill_reorder_info(p_dec, p_frame, p_info))
{
free(p_info);
return NULL;
@@ -927,13 +927,13 @@ static frame_info_t * CreateReorderInfo(decoder_t *p_dec, const block_t *p_block
p_info->b_keyframe = true;
}
- p_info->i_length = p_block->i_length;
+ p_info->i_length = p_frame->i_length;
/* required for still pictures/menus */
- p_info->b_eos = (p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE);
+ p_info->b_eos = (p_frame->i_flags & FRAME_FLAG_END_OF_SEQUENCE);
if (date_Get(&p_sys->pts) == VLC_TICK_INVALID)
- date_Set(&p_sys->pts, p_block->i_dts);
+ date_Set(&p_sys->pts, p_frame->i_dts);
return p_info;
}
@@ -1312,7 +1312,7 @@ static void StopVideoToolbox(decoder_t *p_dec)
p_sys->videoFormatDescription = nil;
}
p_sys->b_vt_feed = false;
- p_sys->b_drop_blocks = false;
+ p_sys->b_drop_frames = false;
}
#pragma mark - module open and close
@@ -1389,7 +1389,7 @@ static int OpenDecoder(vlc_object_t *p_this)
vlc_mutex_init(&p_sys->lock);
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = RequestFlush;
switch(codec)
@@ -1399,7 +1399,7 @@ static int OpenDecoder(vlc_object_t *p_this)
p_sys->pf_codec_clean = CleanH264;
p_sys->pf_codec_supported = CodecSupportedH264;
p_sys->pf_late_start = LateStartH264;
- p_sys->pf_process_block = ProcessBlockH264;
+ p_sys->pf_process_frame = ProcessFrameH264;
p_sys->pf_need_restart = VideoToolboxNeedsToRestartH264;
p_sys->pf_configure_vout = ConfigureVoutH264;
p_sys->pf_get_extradata = GetDecoderExtradataH264;
@@ -1413,7 +1413,7 @@ static int OpenDecoder(vlc_object_t *p_this)
p_sys->pf_codec_clean = CleanHEVC;
p_sys->pf_codec_supported = CodecSupportedHEVC;
p_sys->pf_late_start = LateStartHEVC;
- p_sys->pf_process_block = ProcessBlockHEVC;
+ p_sys->pf_process_frame = ProcessFrameHEVC;
p_sys->pf_need_restart = VideoToolboxNeedsToRestartHEVC;
p_sys->pf_configure_vout = ConfigureVoutHEVC;
p_sys->pf_get_extradata = GetDecoderExtradataHEVC;
@@ -1644,31 +1644,31 @@ static CFMutableDictionaryRef ExtradataInfoCreate(CFStringRef name,
static CMSampleBufferRef VTSampleBufferCreate(decoder_t *p_dec,
CMFormatDescriptionRef fmt_desc,
- block_t *p_block)
+ vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
OSStatus status;
CMBlockBufferRef block_buf = NULL;
CMSampleBufferRef sample_buf = NULL;
CMTime pts;
- if(!p_sys->b_poc_based_reorder && p_block->i_pts == VLC_TICK_INVALID)
- pts = CMTimeMake(p_block->i_dts, CLOCK_FREQ);
+ if(!p_sys->b_poc_based_reorder && p_frame->i_pts == VLC_TICK_INVALID)
+ pts = CMTimeMake(p_frame->i_dts, CLOCK_FREQ);
else
- pts = CMTimeMake(p_block->i_pts, CLOCK_FREQ);
+ pts = CMTimeMake(p_frame->i_pts, CLOCK_FREQ);
CMSampleTimingInfo timeInfoArray[1] = { {
- .duration = CMTimeMake(p_block->i_length, 1),
+ .duration = CMTimeMake(p_frame->i_length, 1),
.presentationTimeStamp = pts,
- .decodeTimeStamp = CMTimeMake(p_block->i_dts, CLOCK_FREQ),
+ .decodeTimeStamp = CMTimeMake(p_frame->i_dts, CLOCK_FREQ),
} };
status = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault,// structureAllocator
- p_block->p_buffer, // memoryBlock
- p_block->i_buffer, // blockLength
+ p_frame->p_buffer, // memoryBlock
+ p_frame->i_buffer, // blockLength
kCFAllocatorNull, // blockAllocator
NULL, // customBlockSource
0, // offsetToData
- p_block->i_buffer, // dataLength
+ p_frame->i_buffer, // dataLength
false, // flags
&block_buf);
@@ -1799,11 +1799,11 @@ static void Drain(decoder_t *p_dec, bool flush)
assert(RemoveOneFrameFromDPB(p_sys) == NULL);
p_sys->b_vt_flush = false;
p_sys->b_vt_feed = false;
- p_sys->b_drop_blocks = false;
+ p_sys->b_drop_frames = false;
vlc_mutex_unlock(&p_sys->lock);
}
-static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
+static int DecodeFrame(decoder_t *p_dec, vlc_frame_t *p_frame)
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -1813,7 +1813,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
PtsInit(p_dec);
}
- if (p_block == NULL)
+ if (p_frame == NULL)
{
Drain(p_dec, false);
return VLCDEC_SUCCESS;
@@ -1821,7 +1821,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
vlc_mutex_lock(&p_sys->lock);
- if (p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK)
+ if (p_frame->i_flags & FRAME_FLAG_INTERLACED_MASK)
{
#if TARGET_OS_IPHONE
msg_Warn(p_dec, "VT decoder doesn't handle deinterlacing on iOS, "
@@ -1903,7 +1903,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
}
vlc_mutex_unlock(&p_sys->lock);
- if (unlikely(p_block->i_flags&(BLOCK_FLAG_CORRUPTED)))
+ if (unlikely(p_frame->i_flags&(FRAME_FLAG_CORRUPTED)))
{
if (p_sys->b_vt_feed)
{
@@ -1914,14 +1914,14 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
}
bool b_config_changed = false;
- if(p_sys->pf_process_block)
+ if(p_sys->pf_process_frame)
{
- p_block = p_sys->pf_process_block(p_dec, p_block, &b_config_changed);
- if (!p_block)
+ p_frame = p_sys->pf_process_frame(p_dec, p_frame, &b_config_changed);
+ if (!p_frame)
return VLCDEC_SUCCESS;
}
- frame_info_t *p_info = CreateReorderInfo(p_dec, p_block);
+ frame_info_t *p_info = CreateReorderInfo(p_dec, p_frame);
if(unlikely(!p_info))
goto skip;
@@ -1964,7 +1964,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
}
CMSampleBufferRef sampleBuffer =
- VTSampleBufferCreate(p_dec, p_sys->videoFormatDescription, p_block);
+ VTSampleBufferCreate(p_dec, p_sys->videoFormatDescription, p_frame);
if (unlikely(!sampleBuffer))
{
free(p_info);
@@ -1982,7 +1982,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
if (HandleVTStatus(p_dec, status, &vtsession_status) == VLC_SUCCESS)
{
p_sys->b_vt_feed = true;
- if( p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE )
+ if( p_frame->i_flags & FRAME_FLAG_END_OF_SEQUENCE )
Drain( p_dec, false );
}
else
@@ -1992,13 +1992,13 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
p_sys->i_restart_count++;
p_sys->vtsession_status = vtsession_status;
/* In case of abort, the decoder module will be reloaded next time
- * since we already modified the input block */
+ * since we already modified the input frame */
vlc_mutex_unlock(&p_sys->lock);
}
CFRelease(sampleBuffer);
skip:
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index a3bebd6a8d..6beb330982 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -146,15 +146,15 @@ static const uint32_t pi_3channels_in[] =
static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static int DecodeAudio ( decoder_t *, block_t * );
-static block_t *Packetize ( decoder_t *, block_t ** );
+static int DecodeAudio ( decoder_t *, vlc_frame_t * );
+static vlc_frame_t *Packetize ( decoder_t *, vlc_frame_t ** );
static void Flush( decoder_t * );
static int ProcessHeaders( decoder_t * );
-static block_t *ProcessPacket ( decoder_t *, ogg_packet *, block_t ** );
+static vlc_frame_t *ProcessPacket ( decoder_t *, ogg_packet *, vlc_frame_t ** );
-static block_t *DecodePacket( decoder_t *, ogg_packet * );
-static block_t *SendPacket( decoder_t *, ogg_packet *, block_t * );
+static vlc_frame_t *DecodePacket( decoder_t *, ogg_packet * );
+static vlc_frame_t *SendPacket( decoder_t *, ogg_packet *, vlc_frame_t * );
static void ParseVorbisComments( decoder_t * );
@@ -163,7 +163,7 @@ static void ConfigureChannelOrder(uint8_t *, int, uint32_t );
#ifdef HAVE_VORBIS_ENCODER
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
-static block_t *Encode ( encoder_t *, block_t * );
+static vlc_frame_t *Encode ( encoder_t *, vlc_frame_t * );
#endif
/*****************************************************************************
@@ -280,20 +280,20 @@ static int OpenPacketizer( vlc_object_t *p_this )
}
/****************************************************************************
- * DecodeBlock: the whole thing
+ * DecodeFrame: the whole thing
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-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;
ogg_packet oggpacket;
- if( *pp_block )
+ if( *pp_frame )
{
/* Block to Ogg packet */
- oggpacket.packet = (*pp_block)->p_buffer;
- oggpacket.bytes = (*pp_block)->i_buffer;
+ oggpacket.packet = (*pp_frame)->p_buffer;
+ oggpacket.bytes = (*pp_frame)->i_buffer;
}
else
{
@@ -314,32 +314,32 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
if( ProcessHeaders( p_dec ) )
{
- if( *pp_block )
- block_Release( *pp_block );
+ if( *pp_frame )
+ vlc_frame_Release( *pp_frame );
return NULL;
}
p_sys->b_has_headers = true;
}
- return ProcessPacket( p_dec, &oggpacket, pp_block );
+ return ProcessPacket( p_dec, &oggpacket, pp_frame );
}
-static int DecodeAudio( decoder_t *p_dec, block_t *p_block )
+static int DecodeAudio( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- block_t **pp_block = &p_block, *p_out;
- while( ( p_out = DecodeBlock( p_dec, pp_block ) ) != NULL )
+ vlc_frame_t **pp_frame = &p_frame, *p_out;
+ while( ( p_out = DecodeFrame( p_dec, pp_frame ) ) != NULL )
decoder_QueueAudio( p_dec, p_out );
return VLCDEC_SUCCESS;
}
-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 )
{
- if( pp_block == NULL ) /* No Drain */
+ if( pp_frame == NULL ) /* No Drain */
return NULL;
- return DecodeBlock( p_dec, pp_block );
+ return DecodeFrame( p_dec, pp_frame );
}
/*****************************************************************************
@@ -456,50 +456,50 @@ static void Flush( decoder_t *p_dec )
/*****************************************************************************
* ProcessPacket: processes a Vorbis packet.
*****************************************************************************/
-static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
- block_t **pp_block )
+static vlc_frame_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
+ vlc_frame_t **pp_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- block_t *p_block = *pp_block;
+ vlc_frame_t *p_frame = *pp_frame;
- *pp_block = NULL; /* To avoid being fed the same packet again */
- if( !p_block )
+ *pp_frame = NULL; /* To avoid being fed the same packet again */
+ if( !p_frame )
return NULL;
- if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+ if( p_frame->i_flags & (FRAME_FLAG_DISCONTINUITY|FRAME_FLAG_CORRUPTED) )
{
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;
}
}
/* Date management */
- 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 ) )
{
- date_Set( &p_sys->end_date, p_block->i_pts );
+ date_Set( &p_sys->end_date, p_frame->i_pts );
}
if( date_Get( &p_sys->end_date ) == VLC_TICK_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
- if( p_block ) block_Release( p_block );
+ if( p_frame ) vlc_frame_Release( p_frame );
return NULL;
}
if( p_sys->b_packetizer )
{
- return SendPacket( p_dec, p_oggpacket, p_block );
+ return SendPacket( p_dec, p_oggpacket, p_frame );
}
else
{
- block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket );
- if( p_block )
- block_Release( p_block );
+ vlc_frame_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket );
+ if( p_frame )
+ vlc_frame_Release( p_frame );
return p_aout_buffer;
}
}
@@ -527,7 +527,7 @@ static void Interleave( INTERLEAVE_TYPE *p_out, const INTERLEAVE_TYPE **pp_in,
/*****************************************************************************
* DecodePacket: decodes a Vorbis packet.
*****************************************************************************/
-static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
+static vlc_frame_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
{
decoder_sys_t *p_sys = p_dec->p_sys;
int i_samples;
@@ -546,7 +546,7 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
if( ( i_samples = vorbis_synthesis_pcmout( &p_sys->vd, &pp_pcm ) ) > 0 )
{
- block_t *p_aout_buffer;
+ vlc_frame_t *p_aout_buffer;
if( decoder_UpdateAudioFormat( p_dec ) ) return NULL;
p_aout_buffer =
@@ -577,8 +577,8 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket )
/*****************************************************************************
* SendPacket: send an ogg dated packet to the stream output.
*****************************************************************************/
-static block_t *SendPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
- block_t *p_block )
+static vlc_frame_t *SendPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
+ vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
int i_block_size, i_samples;
@@ -589,11 +589,11 @@ static block_t *SendPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
p_sys->i_last_block_size = i_block_size;
/* Date management */
- p_block->i_dts = p_block->i_pts = date_Get( &p_sys->end_date );
+ p_frame->i_dts = p_frame->i_pts = date_Get( &p_sys->end_date );
- p_block->i_length = date_Increment( &p_sys->end_date, i_samples ) - p_block->i_pts;
+ p_frame->i_length = date_Increment( &p_sys->end_date, i_samples ) - p_frame->i_pts;
- return p_block;
+ return p_frame;
}
/*****************************************************************************
@@ -890,11 +890,11 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************
* This function spits out ogg packets.
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
+static vlc_frame_t *Encode( encoder_t *p_enc, vlc_frame_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
ogg_packet oggpacket;
- block_t *p_block, *p_chain = NULL;
+ vlc_frame_t *p_frame, *p_chain = NULL;
float **buffer;
/* Packets are already flushed, see bellow. */
@@ -931,8 +931,8 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
while( vorbis_bitrate_flushpacket( &p_sys->vd, &oggpacket ) )
{
int i_block_size;
- p_block = block_Alloc( oggpacket.bytes );
- memcpy( p_block->p_buffer, oggpacket.packet, oggpacket.bytes );
+ p_frame = vlc_frame_Alloc( oggpacket.bytes );
+ memcpy( p_frame->p_buffer, oggpacket.packet, oggpacket.bytes );
i_block_size = vorbis_packet_blocksize( &p_sys->vi, &oggpacket );
@@ -940,16 +940,16 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
i_samples = ( p_sys->i_last_block_size + i_block_size ) >> 2;
p_sys->i_last_block_size = i_block_size;
- p_block->i_length = vlc_tick_from_samples(i_samples,
+ p_frame->i_length = vlc_tick_from_samples(i_samples,
p_enc->fmt_in.audio.i_rate);
- p_block->i_dts = p_block->i_pts = i_pts;
+ p_frame->i_dts = p_frame->i_pts = i_pts;
p_sys->i_samples_delay -= i_samples;
/* Update pts */
- i_pts += p_block->i_length;
- block_ChainAppend( &p_chain, p_block );
+ i_pts += p_frame->i_length;
+ vlc_frame_ChainAppend( &p_chain, p_frame );
}
}
diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index cb29f4428d..b2569d9f43 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -49,7 +49,7 @@ static void CloseDecoder(vlc_object_t *);
static const char *const ppsz_sout_options[] = { "quality-mode", NULL };
static int OpenEncoder(vlc_object_t *);
static void CloseEncoder(vlc_object_t *);
-static block_t *Encode(encoder_t *p_enc, picture_t *p_pict);
+static vlc_frame_t *Encode(encoder_t *p_enc, picture_t *p_pict);
#define QUALITY_MODE_TEXT N_("Quality mode")
#define QUALITY_MODE_LONGTEXT N_("Quality setting which will determine max encoding time\n" \
@@ -183,32 +183,32 @@ static vlc_fourcc_t FindVlcChroma( struct vpx_image *img )
/****************************************************************************
* Decode: the whole thing
****************************************************************************/
-static int Decode(decoder_t *dec, block_t *block)
+static int Decode(decoder_t *dec, vlc_frame_t *frame)
{
decoder_sys_t *p_sys = dec->p_sys;
struct vpx_codec_ctx *ctx = &p_sys->ctx;
- if (block == NULL) /* No Drain */
+ if (frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- if (block->i_flags & (BLOCK_FLAG_CORRUPTED)) {
- block_Release(block);
+ if (frame->i_flags & (FRAME_FLAG_CORRUPTED)) {
+ vlc_frame_Release(frame);
return VLCDEC_SUCCESS;
}
/* Associate packet PTS with decoded frame */
vlc_tick_t *pkt_pts = malloc(sizeof(*pkt_pts));
if (!pkt_pts) {
- block_Release(block);
+ vlc_frame_Release(frame);
return VLCDEC_SUCCESS;
}
- *pkt_pts = (block->i_pts != VLC_TICK_INVALID) ? block->i_pts : block->i_dts;
+ *pkt_pts = (frame->i_pts != VLC_TICK_INVALID) ? frame->i_pts : frame->i_dts;
vpx_codec_err_t err;
- err = vpx_codec_decode(ctx, block->p_buffer, block->i_buffer, pkt_pts, 0);
+ err = vpx_codec_decode(ctx, frame->p_buffer, frame->i_buffer, pkt_pts, 0);
- block_Release(block);
+ vlc_frame_Release(frame);
if (err != VPX_CODEC_OK) {
free(pkt_pts);
@@ -458,7 +458,7 @@ static int OpenEncoder(vlc_object_t *p_this)
/****************************************************************************
* Encode: the whole thing
****************************************************************************/
-static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
+static vlc_frame_t *Encode(encoder_t *p_enc, picture_t *p_pict)
{
encoder_sys_t *p_sys = p_enc->p_sys;
struct vpx_codec_ctx *ctx = &p_sys->ctx;
@@ -493,25 +493,25 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
const vpx_codec_cx_pkt_t *pkt = NULL;
vpx_codec_iter_t iter = NULL;
- block_t *p_out = NULL;
+ vlc_frame_t *p_out = NULL;
while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL)
{
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT)
{
int keyframe = pkt->data.frame.flags & VPX_FRAME_IS_KEY;
- block_t *p_block = block_Alloc(pkt->data.frame.sz);
- if (unlikely(p_block == NULL))
+ vlc_frame_t *p_frame = vlc_frame_Alloc(pkt->data.frame.sz);
+ if (unlikely(p_frame == NULL))
{
- block_ChainRelease(p_out);
+ vlc_frame_ChainRelease(p_out);
p_out = NULL;
break;
}
- memcpy(p_block->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);
- p_block->i_dts = p_block->i_pts = pkt->data.frame.pts;
+ memcpy(p_frame->p_buffer, pkt->data.frame.buf, pkt->data.frame.sz);
+ p_frame->i_dts = p_frame->i_pts = pkt->data.frame.pts;
if (keyframe)
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
- block_ChainAppend(&p_out, p_block);
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
+ vlc_frame_ChainAppend(&p_out, p_frame);
}
}
vpx_img_free(&img);
diff --git a/modules/codec/webvtt/encvtt.c b/modules/codec/webvtt/encvtt.c
index 056be393a7..2c99593c07 100644
--- a/modules/codec/webvtt/encvtt.c
+++ b/modules/codec/webvtt/encvtt.c
@@ -29,7 +29,7 @@
#include <vlc_charset.h>
#include "webvtt.h"
-static block_t *Encode ( encoder_t *, subpicture_t * );
+static vlc_frame_t *Encode ( encoder_t *, subpicture_t * );
int webvtt_OpenEncoder( vlc_object_t *p_this )
{
@@ -77,7 +77,7 @@ static void WriteText( const char *psz, bo_t *box, char *c_last )
}
}
-static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
+static vlc_frame_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
{
VLC_UNUSED( p_enc );
@@ -205,16 +205,16 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
bo_add_fourcc( &box, "vtte" );
}
- block_t *p_block = box.b;
+ vlc_frame_t *p_frame = box.b;
box.b = NULL;
bo_deinit( &box );
- if( p_block )
+ if( p_frame )
{
- p_block->i_pts = p_block->i_dts = p_spu->i_start;
+ p_frame->i_pts = p_frame->i_dts = p_spu->i_start;
if( p_spu->i_stop > p_spu->i_start )
- p_block->i_length = p_spu->i_stop - p_spu->i_start;
+ p_frame->i_length = p_spu->i_stop - p_spu->i_start;
}
- return p_block;
+ return p_frame;
}
diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c
index 27ff9fd72e..71bd4e8cac 100644
--- a/modules/codec/webvtt/subsvtt.c
+++ b/modules/codec/webvtt/subsvtt.c
@@ -2061,29 +2061,29 @@ static void Flush( decoder_t *p_dec )
}
/****************************************************************************
- * DecodeBlock: decoder data entry point
+ * DecodeFrame: decoder data entry point
****************************************************************************/
-static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
+static int DecodeFrame( decoder_t *p_dec, vlc_frame_t *p_frame )
{
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
decoder_sys_t *p_sys = p_dec->p_sys;
- vlc_tick_t i_start = p_block->i_pts - VLC_TICK_0;
- vlc_tick_t i_stop = i_start + p_block->i_length;
+ vlc_tick_t i_start = p_frame->i_pts - VLC_TICK_0;
+ vlc_tick_t i_stop = i_start + p_frame->i_length;
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( p_frame->i_flags & FRAME_FLAG_DISCONTINUITY )
Flush( p_dec );
else
ClearCuesByTime( &p_sys->p_root->p_child, i_start );
- ProcessISOBMFF( p_dec, p_block->p_buffer, p_block->i_buffer,
+ ProcessISOBMFF( p_dec, p_frame->p_buffer, p_frame->i_buffer,
i_start, i_stop );
Render( p_dec, i_start, i_stop );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
@@ -2128,7 +2128,7 @@ int webvtt_OpenDecoder( vlc_object_t *p_this )
}
p_sys->p_root->psz_tag = strdup( "video" );
- p_dec->pf_decode = DecodeBlock;
+ p_dec->pf_decode = DecodeFrame;
p_dec->pf_flush = Flush;
if( p_dec->fmt_in.i_extra )
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 3390c35640..57bd42cad7 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -754,7 +754,7 @@ static const char *const ppsz_sout_options[] = {
NULL
};
-static block_t *Encode( encoder_t *, picture_t * );
+static vlc_frame_t *Encode( encoder_t *, picture_t * );
typedef struct
{
@@ -1478,12 +1478,12 @@ static void x264_log( void *data, int i_level, const char *psz, va_list args)
/****************************************************************************
* Encode:
****************************************************************************/
-static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
+static vlc_frame_t *Encode( encoder_t *p_enc, picture_t *p_pict )
{
encoder_sys_t *p_sys = p_enc->p_sys;
x264_picture_t pic;
x264_nal_t *nal;
- block_t *p_block;
+ vlc_frame_t *p_frame;
int i_nal=0, i_out=0, i=0;
/* init pic */
@@ -1508,49 +1508,49 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
if( !i_nal ) return NULL;
- /* Get size of block we need */
+ /* Get size of frame we need */
for( i = 0; i < i_nal; i++ )
i_out += nal[i].i_payload;
- p_block = block_Alloc( i_out + p_sys->i_sei_size );
- if( !p_block ) return NULL;
+ p_frame = vlc_frame_Alloc( i_out + p_sys->i_sei_size );
+ if( !p_frame ) return NULL;
unsigned int i_offset = 0;
if( unlikely( p_sys->i_sei_size ) )
{
/* insert x264 headers SEI nal into the first picture block at the start */
- memcpy( p_block->p_buffer, p_sys->p_sei, p_sys->i_sei_size );
+ memcpy( p_frame->p_buffer, p_sys->p_sei, p_sys->i_sei_size );
i_offset = p_sys->i_sei_size;
p_sys->i_sei_size = 0;
free( p_sys->p_sei );
p_sys->p_sei = NULL;
}
- /* copy encoded data directly to block */
- memcpy( p_block->p_buffer + i_offset, nal[0].p_payload, i_out );
+ /* copy encoded data directly to frame */
+ memcpy( p_frame->p_buffer + i_offset, nal[0].p_payload, i_out );
if( pic.b_keyframe )
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
else if( pic.i_type == X264_TYPE_P || pic.i_type == X264_TYPE_I )
- p_block->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_P;
else if( IS_X264_TYPE_B( pic.i_type ) )
- p_block->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_B;
else
- p_block->i_flags |= BLOCK_FLAG_TYPE_PB;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_PB;
/* If we happen to have vfr stream, don't set length at all */
if( !p_sys->param.b_vfr_input )
{
/* This isn't really valid for streams with B-frames */
- p_block->i_length = vlc_tick_from_samples(
+ p_frame->i_length = vlc_tick_from_samples(
p_enc->fmt_in.video.i_frame_rate_base,
p_enc->fmt_in.video.i_frame_rate );
}
/* scale pts-values back*/
- p_block->i_pts = pic.i_pts;
- p_block->i_dts = pic.i_dts;
+ p_frame->i_pts = pic.i_pts;
+ p_frame->i_dts = pic.i_dts;
- return p_block;
+ return p_frame;
}
/*****************************************************************************
diff --git a/modules/codec/x265.c b/modules/codec/x265.c
index 0fb8c0be8b..b65e60ff74 100644
--- a/modules/codec/x265.c
+++ b/modules/codec/x265.c
@@ -62,7 +62,7 @@ typedef struct
#endif
} encoder_sys_t;
-static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
+static vlc_frame_t *Encode(encoder_t *p_enc, picture_t *p_pict)
{
encoder_sys_t *p_sys = p_enc->p_sys;
x265_picture pic;
@@ -96,42 +96,42 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
for (uint32_t i = 0; i < i_nal; i++)
i_out += nal[i].sizeBytes;
- block_t *p_block = block_Alloc(i_out);
- if (!p_block)
+ vlc_frame_t *p_frame = vlc_frame_Alloc(i_out);
+ if (!p_frame)
return NULL;
/* all payloads are sequentially laid out in memory */
- memcpy(p_block->p_buffer, nal[0].payload, i_out);
+ memcpy(p_frame->p_buffer, nal[0].payload, i_out);
/* This isn't really valid for streams with B-frames */
- p_block->i_length = vlc_tick_from_samples(
+ p_frame->i_length = vlc_tick_from_samples(
p_enc->fmt_in.video.i_frame_rate_base,
p_enc->fmt_in.video.i_frame_rate );
- p_block->i_pts = p_sys->initial_date + pic.poc * p_block->i_length;
- p_block->i_dts = p_sys->initial_date + p_sys->frame_count++ * p_block->i_length;
+ p_frame->i_pts = p_sys->initial_date + pic.poc * p_frame->i_length;
+ p_frame->i_dts = p_sys->initial_date + p_sys->frame_count++ * p_frame->i_length;
switch (pic.sliceType)
{
case X265_TYPE_I:
case X265_TYPE_IDR:
- p_block->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_I;
break;
case X265_TYPE_P:
- p_block->i_flags |= BLOCK_FLAG_TYPE_P;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_P;
break;
case X265_TYPE_B:
case X265_TYPE_BREF:
- p_block->i_flags |= BLOCK_FLAG_TYPE_B;
+ p_frame->i_flags |= FRAME_FLAG_TYPE_B;
break;
}
#ifndef NDEBUG
- msg_Dbg(p_enc, "%zu bytes (frame %u, %.2ffps)", p_block->i_buffer,
+ msg_Dbg(p_enc, "%zu bytes (frame %u, %.2ffps)", p_frame->i_buffer,
p_sys->frame_count, (float)p_sys->frame_count * CLOCK_FREQ / (vlc_tick_now() - p_sys->start));
#endif
- return p_block;
+ return p_frame;
}
static int Open (vlc_object_t *p_this)
diff --git a/modules/codec/xwd.c b/modules/codec/xwd.c
index ba54bf7343..1627529774 100644
--- a/modules/codec/xwd.c
+++ b/modules/codec/xwd.c
@@ -42,7 +42,7 @@ vlc_module_begin()
set_callbacks(Open, NULL)
vlc_module_end()
-static int Decode(decoder_t *, block_t *);
+static int Decode(decoder_t *, vlc_frame_t *);
static int Open(vlc_object_t *obj)
{
@@ -57,20 +57,20 @@ static int Open(vlc_object_t *obj)
return VLC_SUCCESS;
}
-static int Decode (decoder_t *dec, block_t *block)
+static int Decode (decoder_t *dec, vlc_frame_t *frame)
{
picture_t *pic = NULL;
- if (block == NULL) /* No Drain */
+ if (frame == NULL) /* No Drain */
return VLCDEC_SUCCESS;
- if (block->i_pts == VLC_TICK_INVALID)
- goto drop; /* undated block, should never happen */
- if (block->i_buffer < sz_XWDheader)
+ if (frame->i_pts == VLC_TICK_INVALID)
+ goto drop; /* undated frame, should never happen */
+ if (frame->i_buffer < sz_XWDheader)
goto drop;
/* Skip XWD header */
- const XWDFileHeader *hdr = (const void *)block->p_buffer;
+ const XWDFileHeader *hdr = (const void *)frame->p_buffer;
uint32_t hdrlen = ntohl(hdr->header_size);
if (hdrlen < sz_XWDheader
|| ntohl(hdr->file_version) < XWD_FILE_VERSION
@@ -78,10 +78,10 @@ static int Decode (decoder_t *dec, block_t *block)
goto drop;
hdrlen += ntohl(hdr->ncolors) * sz_XWDColor;
- if (hdrlen > block->i_buffer)
+ if (hdrlen > frame->i_buffer)
goto drop;
- block->p_buffer += hdrlen;
- block->i_buffer -= hdrlen;
+ frame->p_buffer += hdrlen;
+ frame->i_buffer -= hdrlen;
/* Parse XWD header */
vlc_fourcc_t chroma = 0;
@@ -127,7 +127,7 @@ static int Decode (decoder_t *dec, block_t *block)
/* Build picture */
if (pitch < copy
- || (block->i_buffer / pitch) < dec->fmt_out.video.i_height)
+ || (frame->i_buffer / pitch) < dec->fmt_out.video.i_height)
goto drop;
if (decoder_UpdateVideoFormat(dec))
@@ -136,7 +136,7 @@ static int Decode (decoder_t *dec, block_t *block)
if (pic == NULL)
goto drop;
- const uint8_t *in = block->p_buffer;
+ const uint8_t *in = frame->p_buffer;
uint8_t *out = pic->p->p_pixels;
for (unsigned i = 0; i < dec->fmt_out.video.i_height; i++)
{
@@ -144,11 +144,11 @@ static int Decode (decoder_t *dec, block_t *block)
in += pitch;
out += pic->p->i_pitch;
}
- pic->date = block->i_pts;
+ pic->date = frame->i_pts;
pic->b_progressive = true;
drop:
- block_Release(block);
+ vlc_frame_Release(frame);
decoder_QueueVideo(dec, pic);
return VLCDEC_SUCCESS;
}
diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 1b3cf8bd38..8af784824e 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -172,7 +172,7 @@ typedef struct
int i_key[3];
} decoder_sys_t;
-static int Decode( decoder_t *, block_t * );
+static int Decode( decoder_t *, vlc_frame_t * );
static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
bool b_text,
@@ -303,7 +303,7 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Decode:
*****************************************************************************/
-static int Decode( decoder_t *p_dec, block_t *p_block )
+static int Decode( decoder_t *p_dec, vlc_frame_t *p_frame )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
@@ -311,32 +311,32 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
bool b_cached = false;
vbi_page p_page;
- if( p_block == NULL ) /* No Drain */
+ if( p_frame == NULL ) /* No Drain */
return VLCDEC_SUCCESS;
- if( p_block->i_buffer > 0 &&
- ( ( p_block->p_buffer[0] >= 0x10 && p_block->p_buffer[0] <= 0x1f ) ||
- ( p_block->p_buffer[0] >= 0x99 && p_block->p_buffer[0] <= 0x9b ) ) )
+ if( p_frame->i_buffer > 0 &&
+ ( ( p_frame->p_buffer[0] >= 0x10 && p_frame->p_buffer[0] <= 0x1f ) ||
+ ( p_frame->p_buffer[0] >= 0x99 && p_frame->p_buffer[0] <= 0x9b ) ) )
{
vbi_sliced *p_sliced = p_sys->p_vbi_sliced;
unsigned int i_lines = 0;
- p_block->i_buffer--;
- p_block->p_buffer++;
- while( p_block->i_buffer >= 2 )
+ p_frame->i_buffer--;
+ p_frame->p_buffer++;
+ while( p_frame->i_buffer >= 2 )
{
- int i_id = p_block->p_buffer[0];
- unsigned i_size = p_block->p_buffer[1];
+ int i_id = p_frame->p_buffer[0];
+ unsigned i_size = p_frame->p_buffer[1];
- if( 2 + i_size > p_block->i_buffer )
+ if( 2 + i_size > p_frame->i_buffer )
break;
if( ( i_id == 0x02 || i_id == 0x03 ) && i_size >= 44 && i_lines < MAX_SLICES )
{
- if(p_block->p_buffer[3] == 0xE4 ) /* framing_code */
+ if(p_frame->p_buffer[3] == 0xE4 ) /* framing_code */
{
- unsigned line_offset = p_block->p_buffer[2] & 0x1f;
- unsigned field_parity = p_block->p_buffer[2] & 0x20;
+ unsigned line_offset = p_frame->p_buffer[2] & 0x1f;
+ unsigned field_parity = p_frame->p_buffer[2] & 0x20;
p_sliced[i_lines].id = VBI_SLICED_TELETEXT_B;
if( line_offset > 0 )
@@ -344,13 +344,13 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
else
p_sliced[i_lines].line = 0;
for( int i = 0; i < 42; i++ )
- p_sliced[i_lines].data[i] = vbi_rev8( p_block->p_buffer[4 + i] );
+ p_sliced[i_lines].data[i] = vbi_rev8( p_frame->p_buffer[4 + i] );
i_lines++;
}
}
- p_block->i_buffer -= 2 + i_size;
- p_block->p_buffer += 2 + i_size;
+ p_frame->i_buffer -= 2 + i_size;
+ p_frame->p_buffer += 2 + i_size;
}
if( i_lines > 0 )
@@ -362,7 +362,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
if( p_sys->i_wanted_page == 0 )
{
vlc_mutex_unlock( &p_sys->lock );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
const int i_align = p_sys->i_align;
@@ -389,7 +389,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
/* We need to reset the subtitle */
p_spu = Subpicture( p_dec, &fmt, true,
p_page.columns, p_page.rows,
- i_align, p_block->i_pts );
+ i_align, p_frame->i_pts );
if( !p_spu )
goto error;
subtext_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
@@ -427,7 +427,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
/* Create the subpicture unit */
p_spu = Subpicture( p_dec, &fmt, p_sys->b_text,
p_page.columns, i_num_rows,
- i_align, p_block->i_pts );
+ i_align, p_frame->i_pts );
if( !p_spu )
goto error;
@@ -495,14 +495,14 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
exit:
vbi_unref_page( &p_page );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
if( p_spu )
decoder_QueueSub( p_dec, p_spu );
return VLCDEC_SUCCESS;
error:
vbi_unref_page( &p_page );
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return VLCDEC_SUCCESS;
}
diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index aac0600a89..07d6604f18 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -89,7 +89,7 @@ static int send_output_buffer(decoder_t *dec);
static void fill_output_port(decoder_t *dec);
/* VLC decoder callback */
-static int decode(decoder_t *dec, block_t *block);
+static int decode(decoder_t *dec, vlc_frame_t *frame);
static void flush_decoder(decoder_t *dec);
/* MMAL callbacks */
@@ -435,7 +435,7 @@ static int send_output_buffer(decoder_t *dec)
mmal_buffer_header_reset(buffer);
buffer->alloc_size = sys->output->buffer_size;
if (buffer_size < sys->output->buffer_size) {
- msg_Err(dec, "Retrieved picture with too small data block (%d < %d)",
+ msg_Err(dec, "Retrieved picture with too small data frame (%d < %d)",
buffer_size, sys->output->buffer_size);
ret = VLC_EGENERIC;
goto err;
@@ -525,7 +525,7 @@ static void flush_decoder(decoder_t *dec)
vlc_sem_wait(&sys->sem);
}
-static int decode(decoder_t *dec, block_t *block)
+static int decode(decoder_t *dec, vlc_frame_t *frame)
{
decoder_sys_t *sys = dec->p_sys;
MMAL_BUFFER_HEADER_T *buffer;
@@ -542,15 +542,15 @@ static int decode(decoder_t *dec, block_t *block)
msg_Err(dec, "Failed to change output port format");
}
- if (!block)
+ if (!frame)
goto out;
/*
* Check whether full flush is required
*/
- if (block && block->i_flags & BLOCK_FLAG_DISCONTINUITY) {
+ if (frame && frame->i_flags & FRAME_FLAG_DISCONTINUITY) {
flush_decoder(dec);
- block_Release(block);
+ vlc_frame_Release(frame);
return VLCDEC_SUCCESS;
}
@@ -561,10 +561,10 @@ static int decode(decoder_t *dec, block_t *block)
* Process input
*/
- if (block->i_flags & BLOCK_FLAG_CORRUPTED)
+ if (frame->i_flags & FRAME_FLAG_CORRUPTED)
flags |= MMAL_BUFFER_HEADER_FLAG_CORRUPTED;
- while (block && block->i_buffer > 0) {
+ while (frame && frame->i_buffer > 0) {
buffer = mmal_queue_timedwait(sys->input_pool->queue, 100);
if (!buffer) {
msg_Err(dec, "Failed to retrieve buffer header for input data");
@@ -573,21 +573,21 @@ static int decode(decoder_t *dec, block_t *block)
}
mmal_buffer_header_reset(buffer);
buffer->cmd = 0;
- buffer->pts = block->i_pts != 0 ? block->i_pts : block->i_dts;
- buffer->dts = block->i_dts;
+ buffer->pts = frame->i_pts != 0 ? frame->i_pts : frame->i_dts;
+ buffer->dts = frame->i_dts;
buffer->alloc_size = sys->input->buffer_size;
- len = block->i_buffer;
+ len = frame->i_buffer;
if (len > buffer->alloc_size)
len = buffer->alloc_size;
- buffer->data = block->p_buffer;
- block->p_buffer += len;
- block->i_buffer -= len;
+ buffer->data = frame->p_buffer;
+ frame->p_buffer += len;
+ frame->i_buffer -= len;
buffer->length = len;
- if (block->i_buffer == 0) {
- buffer->user_data = block;
- block = NULL;
+ if (frame->i_buffer == 0) {
+ buffer->user_data = frame;
+ frame = NULL;
}
buffer->flags = flags;
@@ -623,14 +623,14 @@ static void control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
static void input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
{
- block_t *block = (block_t *)buffer->user_data;
+ vlc_frame_t *frame = (vlc_frame_t *)buffer->user_data;
decoder_t *dec = (decoder_t *)port->userdata;
decoder_sys_t *sys = dec->p_sys;
buffer->user_data = NULL;
mmal_buffer_header_release(buffer);
- if (block)
- block_Release(block);
+ if (frame)
+ vlc_frame_Release(frame);
atomic_fetch_sub(&sys->input_in_transit, 1);
vlc_sem_post(&sys->sem);
}
--
2.20.1
More information about the vlc-devel
mailing list