[vlc-devel] [PATCH 16/17] Access: Use vlc_frame_t for access demuxers and vlc_data_t for stream accesses
Denis Charmet
typx at dinauz.org
Mon Apr 22 19:10:45 CEST 2019
---
modules/access/alsa.c | 20 ++--
modules/access/avaudiocapture.m | 2 +-
modules/access/avcapture.m | 22 ++--
modules/access/avio.c | 10 +-
modules/access/bluray.c | 58 +++++-----
modules/access/cdda.c | 16 +--
modules/access/concat.c | 2 +-
modules/access/dc1394.c | 32 +++---
modules/access/dcp/dcp.cpp | 12 +--
modules/access/decklink.cpp | 16 +--
modules/access/dshow/dshow.cpp | 22 ++--
modules/access/dtv/access.c | 8 +-
modules/access/dtv/bdagraph.cpp | 14 +--
modules/access/dtv/bdagraph.hpp | 6 +-
modules/access/dv.c | 24 ++---
modules/access/dvb/access.c | 6 +-
modules/access/dvb/scan.c | 18 ++--
modules/access/dvb/scan.h | 2 +-
modules/access/dvdnav.c | 22 ++--
modules/access/dvdread.c | 10 +-
modules/access/ftp.c | 8 +-
modules/access/http/access.c | 8 +-
modules/access/http/chunked.c | 10 +-
modules/access/http/chunked_test.c | 14 +--
modules/access/http/file.c | 6 +-
modules/access/http/file.h | 4 +-
modules/access/http/file_test.c | 2 +-
modules/access/http/h1conn.c | 8 +-
modules/access/http/h1conn_test.c | 14 +--
modules/access/http/h2conn.c | 6 +-
modules/access/http/h2conn_test.c | 8 +-
modules/access/http/live.c | 4 +-
modules/access/http/live.h | 4 +-
modules/access/http/message.c | 2 +-
modules/access/http/message.h | 10 +-
modules/access/http/resource.c | 2 +-
modules/access/http/resource.h | 2 +-
modules/access/imem.c | 10 +-
modules/access/jack.c | 42 ++++----
modules/access/linsys/linsys_hdsdi.c | 4 +-
modules/access/linsys/linsys_sdi.c | 16 +--
modules/access/live555.cpp | 153 ++++++++++++++-------------
modules/access/mms/mmsh.c | 8 +-
modules/access/mms/mmstu.c | 8 +-
modules/access/oss.c | 54 +++++-----
modules/access/pulse.c | 16 +--
modules/access/rdp.c | 34 +++---
modules/access/rist.c | 64 +++++------
modules/access/rist.h | 7 +-
modules/access/rtp/input.c | 47 ++++----
modules/access/rtp/rtp.c | 80 +++++++++-----
modules/access/rtp/rtp.h | 14 +--
modules/access/rtp/session.c | 134 +++++++++++------------
modules/access/rtp/xiph.c | 88 +++++++--------
modules/access/satip.c | 37 ++++---
modules/access/screen/mac.c | 24 ++---
modules/access/screen/screen.c | 12 +--
modules/access/screen/screen.h | 2 +-
modules/access/screen/wayland.c | 22 ++--
modules/access/screen/win32.c | 48 ++++-----
modules/access/screen/xcb.c | 26 ++---
modules/access/sdi.c | 4 +-
modules/access/sdi.h | 4 +-
modules/access/shm.c | 26 ++---
modules/access/srt.c | 6 +-
modules/access/timecode.c | 12 +--
modules/access/udp.c | 22 ++--
modules/access/v4l2/access.c | 59 ++++++++---
modules/access/v4l2/demux.c | 76 ++++++-------
modules/access/v4l2/v4l2.h | 2 +-
modules/access/v4l2/vbi.c | 14 +--
modules/access/v4l2/video.c | 16 +--
modules/access/vcd/vcd.c | 10 +-
modules/access/vnc.c | 32 +++---
modules/access/wasapi.c | 12 +--
75 files changed, 875 insertions(+), 804 deletions(-)
diff --git a/modules/access/alsa.c b/modules/access/alsa.c
index a92cf3e2c0..4fb3db7d9a 100644
--- a/modules/access/alsa.c
+++ b/modules/access/alsa.c
@@ -170,8 +170,8 @@ static void *Thread (void *data)
for (;;)
{
- block_t *block = block_Alloc (bytes);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc (bytes);
+ if (unlikely(frame == NULL))
break;
/* Wait for data */
@@ -181,11 +181,11 @@ static void *Thread (void *data)
snd_pcm_sframes_t frames, delay;
vlc_tick_t pts;
- frames = snd_pcm_readi (pcm, block->p_buffer, sys->period_size);
+ frames = snd_pcm_readi (pcm, frame->p_buffer, sys->period_size);
pts = vlc_tick_now ();
if (frames < 0)
{
- block_Release (block);
+ vlc_frame_Release (frame);
if (frames == -EAGAIN)
continue;
@@ -224,13 +224,13 @@ static void *Thread (void *data)
delay += frames;
pts -= vlc_tick_from_samples(delay, sys->rate);
- block->i_buffer = snd_pcm_frames_to_bytes (pcm, frames);
- block->i_nb_samples = frames;
- block->i_pts = pts;
- block->i_length = vlc_tick_from_samples(frames, sys->rate);
+ frame->i_buffer = snd_pcm_frames_to_bytes (pcm, frames);
+ frame->i_nb_samples = frames;
+ frame->i_pts = pts;
+ frame->i_length = vlc_tick_from_samples(frames, sys->rate);
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
return NULL;
}
diff --git a/modules/access/avaudiocapture.m b/modules/access/avaudiocapture.m
index 3274c62b42..0027ec6aed 100644
--- a/modules/access/avaudiocapture.m
+++ b/modules/access/avaudiocapture.m
@@ -121,7 +121,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
}
int64_t totalDataSize = audioBufferList->mBuffers[0].mDataByteSize;
- block_t *outBlock = block_Alloc(totalDataSize);
+ vlc_frame_t *outBlock = vlc_frame_Alloc(totalDataSize);
if (!outBlock)
return;
diff --git a/modules/access/avcapture.m b/modules/access/avcapture.m
index cbc5afb198..9fd0314441 100644
--- a/modules/access/avcapture.m
+++ b/modules/access/avcapture.m
@@ -416,25 +416,25 @@ static void Close(vlc_object_t *p_this)
static int Demux(demux_t *p_demux)
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
@autoreleasepool {
@synchronized ( p_sys->output )
{
- p_block = block_Alloc([(__bridge VLCAVDecompressedVideoOutput *)p_sys->output width] * [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output bytesPerRow]);
+ p_frame = vlc_frame_Alloc([(__bridge VLCAVDecompressedVideoOutput *)p_sys->output width] * [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output bytesPerRow]);
- if ( !p_block )
+ if ( !p_frame )
{
- msg_Err(p_demux, "cannot get block");
+ msg_Err(p_demux, "cannot get frame");
return 0;
}
- p_block->i_pts = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output copyCurrentFrameToBuffer: p_block->p_buffer];
+ p_frame->i_pts = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output copyCurrentFrameToBuffer: p_frame->p_buffer];
- if ( !p_block->i_pts )
+ if ( !p_frame->i_pts )
{
/* Nothing to display yet, just forget */
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
vlc_tick_sleep(VLC_HARD_MIN_SLEEP);
return 1;
}
@@ -449,10 +449,10 @@ static int Demux(demux_t *p_demux)
p_sys->b_es_setup = YES;
}
}
-
- es_out_SetPCR(p_demux->out, p_block->i_pts);
- es_out_Send(p_demux->out, p_sys->p_es_video, p_block);
-
+
+ es_out_SetPCR(p_demux->out, p_frame->i_pts);
+ es_out_Send(p_demux->out, p_sys->p_es_video, p_frame);
+
}
return 1;
}
diff --git a/modules/access/avio.c b/modules/access/avio.c
index 8302ca7de9..d300036904 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -50,7 +50,7 @@ vlc_module_end()
static ssize_t Read (stream_t *, void *, size_t);
static int Seek (stream_t *, uint64_t);
static int Control(stream_t *, int, va_list);
-static ssize_t Write(sout_access_out_t *, block_t *);
+static ssize_t Write(sout_access_out_t *, vlc_frame_t *);
static int OutControl(sout_access_out_t *, int, va_list);
static int OutSeek (sout_access_out_t *, off_t);
@@ -226,14 +226,14 @@ static ssize_t Read(stream_t *access, void *data, size_t size)
/*****************************************************************************
* Write:
*****************************************************************************/
-static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
+static ssize_t Write(sout_access_out_t *p_access, vlc_frame_t *p_buffer)
{
sout_access_out_sys_t *p_sys = (sout_access_out_sys_t*)p_access->p_sys;
size_t i_write = 0;
int val;
while (p_buffer != NULL) {
- block_t *p_next = p_buffer->p_next;
+ vlc_frame_t *p_next = p_buffer->p_next;
avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
avio_flush(p_sys->context);
@@ -243,7 +243,7 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
}
i_write += p_buffer->i_buffer;
- block_Release(p_buffer);
+ vlc_frame_Release(p_buffer);
p_buffer = p_next;
}
@@ -253,7 +253,7 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
error:
msg_Err(p_access, "Wrote only %zu bytes: %s", i_write,
vlc_strerror_c(AVUNERROR(val)));
- block_ChainRelease( p_buffer );
+ vlc_frame_ChainRelease( p_buffer );
return i_write;
}
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index c452327aeb..5e0b2274a8 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -358,7 +358,7 @@ typedef struct
bool b_pl_playing; /* true when playing playlist */
/* stream input */
- vlc_mutex_t read_block_lock;
+ vlc_mutex_t read_frame_lock;
/* Used to store bluray disc path */
char *psz_bd_path;
@@ -371,7 +371,7 @@ typedef struct
{
es_format_t fmt;
es_out_id_t *p_es;
- int i_next_block_flags;
+ int i_next_frame_flags;
bool b_recyling;
bool b_restart_decoders_on_reuse;
} es_pair_t;
@@ -383,7 +383,7 @@ static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
if (likely(p_pair != NULL))
{
p_pair->p_es = p_es;
- p_pair->i_next_block_flags = 0;
+ p_pair->i_next_frame_flags = 0;
p_pair->b_recyling = false;
p_pair->b_restart_decoders_on_reuse = true;
if(vlc_array_append(p_array, p_pair) != VLC_SUCCESS)
@@ -603,26 +603,26 @@ static void bluraySendBackgroundImage(vlc_object_t *p_obj,
{
msg_Info(p_obj, "Start background");
- block_t *p_block = block_Alloc(p_fmt->video.i_width * p_fmt->video.i_height *
+ vlc_frame_t *p_frame = vlc_frame_Alloc(p_fmt->video.i_width * p_fmt->video.i_height *
p_fmt->video.i_bits_per_pixel / 8);
- if (!p_block) {
- msg_Err(p_obj, "Error allocating block for background video");
+ if (!p_frame) {
+ msg_Err(p_obj, "Error allocating frame for background video");
return;
}
// XXX TODO: what would be correct timestamp ???
- p_block->i_dts = p_block->i_pts = vlc_tick_now() + VLC_TICK_FROM_MS(40);
+ p_frame->i_dts = p_frame->i_pts = vlc_tick_now() + VLC_TICK_FROM_MS(40);
- uint8_t *p = p_block->p_buffer;
+ uint8_t *p = p_frame->p_buffer;
memset(p, 0, p_fmt->video.i_width * p_fmt->video.i_height);
p += p_fmt->video.i_width * p_fmt->video.i_height;
memset(p, 0x80, p_fmt->video.i_width * p_fmt->video.i_height / 2);
- es_out_SetPCR(p_dst_out, p_block->i_dts - VLC_TICK_FROM_MS(40));
+ es_out_SetPCR(p_dst_out, p_frame->i_dts - VLC_TICK_FROM_MS(40));
es_out_Control(p_dst_out, ES_OUT_SET_ES, p_es);
- es_out_Send(p_dst_out, p_es, p_block);
+ es_out_Send(p_dst_out, p_es, p_frame);
es_out_Control( p_dst_out, ES_OUT_VOUT_SET_MOUSE_EVENT, p_es, onMouseEvent, p_obj );
- es_out_SetPCR(p_dst_out, p_block->i_dts);
+ es_out_SetPCR(p_dst_out, p_frame->i_dts);
}
/*****************************************************************************
@@ -708,7 +708,7 @@ static int probeStream(demux_t *p_demux)
}
#ifdef BLURAY_DEMUX
-static int blurayReadBlock(void *object, void *buf, int lba, int num_blocks)
+static int blurayReadBlock(void *object, void *buf, int lba, int num_frames)
{
demux_t *p_demux = (demux_t*)object;
demux_sys_t *p_sys = p_demux->p_sys;
@@ -716,10 +716,10 @@ static int blurayReadBlock(void *object, void *buf, int lba, int num_blocks)
assert(p_demux->s != NULL);
- vlc_mutex_lock(&p_sys->read_block_lock);
+ vlc_mutex_lock(&p_sys->read_frame_lock);
if (vlc_stream_Seek( p_demux->s, lba * INT64_C(2048) ) == VLC_SUCCESS) {
- size_t req = (size_t)2048 * num_blocks;
+ size_t req = (size_t)2048 * num_frames;
ssize_t got;
got = vlc_stream_Read( p_demux->s, buf, req);
@@ -732,7 +732,7 @@ static int blurayReadBlock(void *object, void *buf, int lba, int num_blocks)
msg_Err(p_demux, "seek to lba %d failed", lba);
}
- vlc_mutex_unlock(&p_sys->read_block_lock);
+ vlc_mutex_unlock(&p_sys->read_frame_lock);
return result;
}
@@ -866,7 +866,7 @@ static int blurayOpen(vlc_object_t *object)
vlc_mutex_init(&p_sys->pl_info_lock);
vlc_mutex_init(&p_sys->bdj.lock);
- vlc_mutex_init(&p_sys->read_block_lock); /* used during bd_open_stream() */
+ vlc_mutex_init(&p_sys->read_frame_lock); /* used during bd_open_stream() */
/* request sub demuxers to skip continuity check as some split
file concatenation are just resetting counters... */
@@ -908,7 +908,7 @@ static int blurayOpen(vlc_object_t *object)
p_sys->psz_bd_path = strdup(p_demux->psz_filepath);
}
- /* If we're passed a block device, try to convert it to the mount point. */
+ /* If we're passed a frame device, try to convert it to the mount point. */
FindMountPoint(&p_sys->psz_bd_path);
p_sys->bluray = bd_open(p_sys->psz_bd_path, NULL);
@@ -1130,7 +1130,7 @@ static void blurayClose(vlc_object_t *object)
vlc_mutex_destroy(&p_sys->pl_info_lock);
vlc_mutex_destroy(&p_sys->bdj.lock);
- vlc_mutex_destroy(&p_sys->read_block_lock);
+ vlc_mutex_destroy(&p_sys->read_frame_lock);
free(p_sys->psz_bd_path);
}
@@ -1368,7 +1368,7 @@ static void bluray_esOutDeleteNonReusedESUnlocked(es_out_t *p_out)
}
}
-static int bluray_esOutSend(es_out_t *p_out, es_out_id_t *p_es, block_t *p_block)
+static int bluray_esOutSend(es_out_t *p_out, es_out_id_t *p_es, vlc_frame_t *p_frame)
{
bluray_esout_priv_t *esout_priv = container_of(p_out, bluray_esout_priv_t, es_out);
vlc_mutex_lock(&esout_priv->lock);
@@ -1379,18 +1379,18 @@ static int bluray_esOutSend(es_out_t *p_out, es_out_id_t *p_es, block_t *p_block
esout_priv->b_discontinuity = false;
es_pair_t *p_pair = getEsPairByES(&esout_priv->es, p_es);
- if(p_pair && p_pair->i_next_block_flags)
+ if(p_pair && p_pair->i_next_frame_flags)
{
- p_block->i_flags |= p_pair->i_next_block_flags;
- p_pair->i_next_block_flags = 0;
+ p_frame->i_flags |= p_pair->i_next_frame_flags;
+ p_pair->i_next_frame_flags = 0;
}
if(esout_priv->b_disable_output)
{
- block_Release(p_block);
- p_block = NULL;
+ vlc_frame_Release(p_frame);
+ p_frame = NULL;
}
vlc_mutex_unlock(&esout_priv->lock);
- return (p_block) ? es_out_Send(esout_priv->p_dst_out, p_es, p_block) : VLC_SUCCESS;
+ return (p_frame) ? es_out_Send(esout_priv->p_dst_out, p_es, p_frame) : VLC_SUCCESS;
}
static void bluray_esOutDel(es_out_t *p_out, es_out_id_t *p_es)
@@ -2659,7 +2659,7 @@ static void notifyStreamsDiscontinuity( vlc_demux_chained_t *p_parser,
{
const uint16_t i_pid = p_sinfo[i].pid;
- block_t *p_block = block_Alloc(192);
+ vlc_data_t *p_block = vlc_data_Alloc(192);
if (!p_block)
return;
@@ -2702,7 +2702,7 @@ static void streamFlush( demux_sys_t *p_sys )
if (p_sys->b_flushed)
return;
- block_t *p_block = block_Alloc(192);
+ vlc_data_t *p_block = vlc_data_Alloc(192);
if (!p_block)
return;
@@ -3061,7 +3061,7 @@ static int blurayDemux(demux_t *p_demux)
}
}
- block_t *p_block = block_Alloc(BD_READ_SIZE);
+ vlc_data_t *p_block = vlc_data_Alloc(BD_READ_SIZE);
if (!p_block)
return VLC_DEMUXER_EGENERIC;
@@ -3087,7 +3087,7 @@ static int blurayDemux(demux_t *p_demux)
blurayHandleOverlays(p_demux);
if (nread <= 0) {
- block_Release(p_block);
+ vlc_data_Release(p_block);
if (p_sys->b_fatal_error || nread < 0) {
msg_Err(p_demux, "bluray: stopping playback after fatal error\n");
return VLC_DEMUXER_EGENERIC;
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index d7974e2524..af36647afa 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -136,16 +136,16 @@ static int Demux(demux_t *demux)
if (sys->position + count >= sys->length)
count = sys->length - sys->position;
- block_t *block = block_Alloc(count * CDDA_DATA_SIZE);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc(count * CDDA_DATA_SIZE);
+ if (unlikely(frame == NULL))
return VLC_DEMUXER_EOF;
if (ioctl_ReadSectors(VLC_OBJECT(demux), sys->vcddev,
sys->start + sys->position,
- block->p_buffer, count, CDDA_TYPE) < 0)
+ frame->p_buffer, count, CDDA_TYPE) < 0)
{
msg_Err(demux, "cannot read sector %u", sys->position);
- block_Release(block);
+ vlc_frame_Release(frame);
/* Skip potentially bad sector */
sys->position++;
@@ -154,11 +154,11 @@ static int Demux(demux_t *demux)
sys->position += count;
- block->i_nb_samples = block->i_buffer / 4;
- block->i_dts = block->i_pts = date_Get(&sys->pts);
- date_Increment(&sys->pts, block->i_nb_samples);
+ frame->i_nb_samples = frame->i_buffer / 4;
+ frame->i_dts = frame->i_pts = date_Get(&sys->pts);
+ date_Increment(&sys->pts, frame->i_nb_samples);
- es_out_Send(demux->out, sys->es, block);
+ es_out_Send(demux->out, sys->es, frame);
es_out_SetPCR(demux->out, date_Get(&sys->pts));
return VLC_DEMUXER_SUCCESS;
}
diff --git a/modules/access/concat.c b/modules/access/concat.c
index f8b5c13b02..d194a22abb 100644
--- a/modules/access/concat.c
+++ b/modules/access/concat.c
@@ -89,7 +89,7 @@ static ssize_t Read(stream_t *access, void *buf, size_t len)
return vlc_stream_ReadPartial(a, buf, len);
}
-static block_t *Block(stream_t *access, bool *restrict eof)
+static vlc_data_t *Block(stream_t *access, bool *restrict eof)
{
stream_t *a = GetAccess(access);
if (a == NULL)
diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c
index d994d37f2d..3176eadecf 100644
--- a/modules/access/dc1394.c
+++ b/modules/access/dc1394.c
@@ -84,7 +84,7 @@ typedef struct
*****************************************************************************/
static int Demux( demux_t *p_demux );
static int Control( demux_t *, int, va_list );
-static block_t *GrabVideo( demux_t *p_demux );
+static vlc_frame_t *GrabVideo( demux_t *p_demux );
static int process_options( demux_t *p_demux);
/*****************************************************************************
@@ -422,10 +422,10 @@ static void MovePixelUYVY( void *src, int spos, void *dst, int dpos )
/*****************************************************************************
* Demux:
*****************************************************************************/
-static block_t *GrabVideo( demux_t *p_demux )
+static vlc_frame_t *GrabVideo( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
if( dc1394_capture_dequeue( p_sys->camera,
DC1394_CAPTURE_POLICY_WAIT,
@@ -435,37 +435,37 @@ static block_t *GrabVideo( demux_t *p_demux )
return NULL;
}
- p_block = block_Alloc( p_sys->frame->size[0] * p_sys->frame->size[1] * 2 );
- if( !p_block )
+ p_frame = vlc_frame_Alloc( p_sys->frame->size[0] * p_sys->frame->size[1] * 2 );
+ if( !p_frame )
{
- msg_Err( p_demux, "Can not get block" );
+ msg_Err( p_demux, "Can not get frame" );
return NULL;
}
if( !p_sys->frame->image )
{
msg_Err (p_demux, "Capture buffer empty");
- block_Release( p_block );
+ vlc_frame_Release( p_frame );
return NULL;
}
- memcpy( p_block->p_buffer, (const char *)p_sys->frame->image,
+ memcpy( p_frame->p_buffer, (const char *)p_sys->frame->image,
p_sys->width * p_sys->height * 2 );
- p_block->i_pts = p_block->i_dts = vlc_tick_now();
+ p_frame->i_pts = p_frame->i_dts = vlc_tick_now();
dc1394_capture_enqueue( p_sys->camera, p_sys->frame );
- return p_block;
+ return p_frame;
}
static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_blockv = NULL;
+ vlc_frame_t *p_framev = NULL;
/* Try grabbing video frame */
- p_blockv = GrabVideo( p_demux );
+ p_framev = GrabVideo( p_demux );
- if( !p_blockv )
+ if( !p_framev )
{
/* Sleep so we do not consume all the cpu, 10ms seems
* like a good value (100fps)
@@ -474,10 +474,10 @@ static int Demux( demux_t *p_demux )
return 1;
}
- if( p_blockv )
+ if( p_framev )
{
- es_out_SetPCR( p_demux->out, p_blockv->i_pts );
- es_out_Send( p_demux->out, p_sys->p_es_video, p_blockv );
+ es_out_SetPCR( p_demux->out, p_framev->i_pts );
+ es_out_Send( p_demux->out, p_sys->p_es_video, p_framev );
}
return 1;
}
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index ae8b08b34a..ccba9d69e6 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -608,7 +608,7 @@ static inline void Close( vlc_object_t *obj )
static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
- block_t *p_video_frame = NULL, *p_audio_frame = NULL;
+ vlc_frame_t *p_video_frame = NULL, *p_audio_frame = NULL;
PCM::FrameBuffer AudioFrameBuff( p_sys->i_audio_buffer);
AESDecContext video_aes_ctx, audio_aes_ctx;
@@ -658,7 +658,7 @@ static int Demux( demux_t *p_demux )
case ESS_JPEG_2000_S:{
JP2K::FrameBuffer PicFrameBuff(FRAME_BUFFER_SIZE);
int nextFrame = p_sys->frame_no + p_sys->p_dcp->video_reels[p_sys->i_video_reel].i_correction;
- if ( ( p_video_frame = block_Alloc( FRAME_BUFFER_SIZE )) == NULL )
+ if ( ( p_video_frame = vlc_frame_Alloc( FRAME_BUFFER_SIZE )) == NULL )
goto error;
if ( ! ASDCP_SUCCESS(
@@ -682,7 +682,7 @@ static int Demux( demux_t *p_demux )
}
case ESS_MPEG2_VES: {
MPEG2::FrameBuffer VideoFrameBuff(FRAME_BUFFER_SIZE);
- if ( ( p_video_frame = block_Alloc( FRAME_BUFFER_SIZE )) == NULL )
+ if ( ( p_video_frame = vlc_frame_Alloc( FRAME_BUFFER_SIZE )) == NULL )
goto error;
if ( ! ASDCP_SUCCESS(
@@ -709,7 +709,7 @@ static int Demux( demux_t *p_demux )
if( !p_sys->p_dcp->audio_reels.empty() )
{
/* audio frame */
- if ( ( p_audio_frame = block_Alloc( p_sys->i_audio_buffer )) == NULL ) {
+ if ( ( p_audio_frame = vlc_frame_Alloc( p_sys->i_audio_buffer )) == NULL ) {
goto error;
}
@@ -764,9 +764,9 @@ error_asdcp:
msg_Err( p_demux, "Couldn't read frame with ASDCP");
error:
if (p_video_frame)
- block_Release(p_video_frame);
+ vlc_frame_Release(p_video_frame);
if (p_audio_frame)
- block_Release(p_audio_frame);
+ vlc_frame_Release(p_audio_frame);
return -1;
}
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index 00faca5c9f..8da22fe9fc 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -170,10 +170,10 @@ static const char *GetFieldDominance(BMDFieldDominance dom, uint32_t *flags)
case bmdProgressiveSegmentedFrame:
return ", segmented";
case bmdLowerFieldFirst:
- *flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ *flags = FRAME_FLAG_BOTTOM_FIELD_FIRST;
return ", interlaced [BFF]";
case bmdUpperFieldFirst:
- *flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+ *flags = FRAME_FLAG_TOP_FIELD_FIRST;
return ", interlaced [TFF]";
case bmdUnknownFieldDominance:
default:
@@ -335,7 +335,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
bpp = 2;
break;
};
- block_t *video_frame = block_Alloc(width * height * bpp);
+ vlc_frame_t *video_frame = vlc_frame_Alloc(width * height * bpp);
if (!video_frame)
return S_OK;
@@ -344,7 +344,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
BMDTimeValue stream_time, frame_duration;
videoFrame->GetStreamTime(&stream_time, &frame_duration, CLOCK_FREQ);
- video_frame->i_flags = BLOCK_FLAG_TYPE_I | sys->dominance_flags;
+ video_frame->i_flags = FRAME_FLAG_TYPE_I | sys->dominance_flags;
video_frame->i_pts = video_frame->i_dts = VLC_TICK_0 + stream_time;
if (sys->video_fmt.i_codec == VLC_CODEC_I422_10L) {
@@ -357,7 +357,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
break;
uint16_t dec[width * 2];
v210_convert(&dec[0], buf, width, 1);
- block_t *cc = vanc_to_cc(demux_, dec, width * 2);
+ vlc_frame_t *cc = vanc_to_cc(demux_, dec, width * 2);
if (!cc)
continue;
cc->i_pts = cc->i_dts = VLC_TICK_0 + stream_time;
@@ -375,7 +375,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
if (sys->cc_es)
es_out_Send(demux_->out, sys->cc_es, cc);
else
- block_Release(cc);
+ vlc_frame_Release(cc);
break; // we found the line with Closed Caption data
}
vanc->Release();
@@ -413,7 +413,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
for(int i=0; i<sys->audio_streams; i++)
{
size_t i_samples = bytes / (sys->audio_streams * 4);
- block_t *p_frame = block_Alloc(i_samples * 4);
+ vlc_frame_t *p_frame = vlc_frame_Alloc(i_samples * 4);
if (!p_frame)
continue;
@@ -430,7 +430,7 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
}
else
{
- block_t *audio_frame = block_Alloc(bytes);
+ vlc_frame_t *audio_frame = vlc_frame_Alloc(bytes);
if (!audio_frame)
return S_OK;
memcpy(audio_frame->p_buffer, frame_bytes, bytes);
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 1e65eb36e4..7709afedec 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -56,7 +56,7 @@ namespace dshow {
/*****************************************************************************
* Access: local prototypes
*****************************************************************************/
-static block_t *ReadCompressed( stream_t *, bool * );
+static vlc_data_t *ReadCompressed( stream_t *, bool * );
static int AccessControl ( stream_t *, int, va_list );
static int Demux ( demux_t * );
@@ -1752,7 +1752,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
/*****************************************************************************
* ReadCompressed: reads compressed (MPEG/DV) data from the device.
*****************************************************************************/
-static block_t *ReadCompressed( stream_t *p_access, bool *eof )
+static vlc_data_t *ReadCompressed( stream_t *p_access, bool *eof )
{
ComContext ctx( COINIT_MULTITHREADED );
@@ -1778,13 +1778,13 @@ static block_t *ReadCompressed( stream_t *p_access, bool *eof )
/*
* We got our sample
*/
- block_t *p_block = NULL;
+ vlc_data_t *p_block = NULL;
uint8_t *p_data;
int i_data_size = sample.p_sample->GetActualDataLength();
if( i_data_size == 0 )
goto out;
- p_block = block_Alloc( i_data_size );
+ p_block = vlc_data_Alloc( i_data_size );
if( unlikely(p_block == NULL) )
goto out;
@@ -1850,7 +1850,7 @@ static int Demux( demux_t *p_demux )
{
int i_data_size;
uint8_t *p_data;
- block_t *p_block;
+ vlc_frame_t *p_frame;
VLCMediaSample sample;
sample = p_stream->samples_queue.front();
@@ -1881,14 +1881,14 @@ static int Demux( demux_t *p_demux )
i_stream, i_data_size, VLC_TICK_FROM_MSFTIME(i_pts) );
#endif
- p_block = block_Alloc( i_data_size );
- memcpy( p_block->p_buffer, p_data, i_data_size );
- p_block->i_pts = p_block->i_dts = i_pts == LONG_MIN ?
+ p_frame = vlc_frame_Alloc( i_data_size );
+ memcpy( p_frame->p_buffer, p_data, i_data_size );
+ p_frame->i_pts = p_frame->i_dts = i_pts == LONG_MIN ?
VLC_TICK_INVALID : (VLC_TICK_FROM_MSFTIME(i_pts) + VLC_TICK_0);
- if( p_block->i_pts != VLC_TICK_INVALID )
- es_out_SetPCR( p_demux->out, p_block->i_pts );
- es_out_Send( p_demux->out, p_stream->p_es, p_block );
+ if( p_frame->i_pts != VLC_TICK_INVALID )
+ es_out_SetPCR( p_demux->out, p_frame->i_pts );
+ es_out_Send( p_demux->out, p_stream->p_es, p_frame );
i_samples--;
}
diff --git a/modules/access/dtv/access.c b/modules/access/dtv/access.c
index 5c341420ae..fcb709b691 100644
--- a/modules/access/dtv/access.c
+++ b/modules/access/dtv/access.c
@@ -433,7 +433,7 @@ typedef struct
tuner_setup_t pf_setup;
} access_sys_t;
-static block_t *Read (stream_t *, bool *);
+static vlc_data_t *Read (stream_t *, bool *);
static int Control (stream_t *, int, va_list);
static dtv_delivery_t GuessSystem (const char *, dvb_device_t *);
static dtv_delivery_t GetDeliveryByScheme(const char *psz_scheme);
@@ -501,10 +501,10 @@ static void Close (vlc_object_t *obj)
free (sys);
}
-static block_t *Read (stream_t *access, bool *restrict eof)
+static vlc_data_t *Read (stream_t *access, bool *restrict eof)
{
#define BUFSIZE (20*188)
- block_t *block = block_Alloc (BUFSIZE);
+ vlc_data_t *block = vlc_data_Alloc (BUFSIZE);
if (unlikely(block == NULL))
return NULL;
@@ -515,7 +515,7 @@ static block_t *Read (stream_t *access, bool *restrict eof)
{
if (val == 0)
*eof = true;
- block_Release (block);
+ vlc_data_Release (block);
return NULL;
}
diff --git a/modules/access/dtv/bdagraph.cpp b/modules/access/dtv/bdagraph.cpp
index 907e050294..37c02f1fcc 100644
--- a/modules/access/dtv/bdagraph.cpp
+++ b/modules/access/dtv/bdagraph.cpp
@@ -32,7 +32,7 @@
#include <assert.h>
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include "dtv/bdagraph.hpp"
#include "dtv/dtv.h"
#undef DEBUG_MONIKER_NAME
@@ -325,11 +325,11 @@ BDAOutput::~BDAOutput()
vlc_cond_destroy( &wait );
}
-void BDAOutput::Push( block_t *p_block )
+void BDAOutput::Push( vlc_data_t *p_block )
{
vlc_mutex_locker l( &lock );
- block_ChainLastAppend( &pp_next, p_block );
+ vlc_data_ChainLastAppend( &pp_next, p_block );
vlc_cond_signal( &wait );
}
@@ -360,8 +360,8 @@ ssize_t BDAOutput::Pop(void *buf, size_t len, int ms)
if( p_first->i_buffer <= 0 )
{
- block_t *p_next = p_first->p_next;
- block_Release( p_first );
+ vlc_data_t *p_next = p_first->p_next;
+ vlc_data_Release( p_first );
p_first = p_next;
if( !p_first )
@@ -379,7 +379,7 @@ void BDAOutput::Empty()
vlc_mutex_locker l( &lock );
if( p_first )
- block_ChainRelease( p_first );
+ vlc_data_ChainRelease( p_first );
p_first = NULL;
pp_next = &p_first;
}
@@ -3062,7 +3062,7 @@ STDMETHODIMP BDAGraph::SampleCB( double /*date*/, IMediaSample *p_sample )
if( i_sample_size > 0 && p_sample_data )
{
- block_t *p_block = block_Alloc( i_sample_size );
+ vlc_data_t *p_block = vlc_data_Alloc( i_sample_size );
if( p_block )
{
diff --git a/modules/access/dtv/bdagraph.hpp b/modules/access/dtv/bdagraph.hpp
index df34bdfdc8..653d2a61b5 100644
--- a/modules/access/dtv/bdagraph.hpp
+++ b/modules/access/dtv/bdagraph.hpp
@@ -82,7 +82,7 @@ public:
BDAOutput( vlc_object_t * );
~BDAOutput();
- void Push( block_t * );
+ void Push( vlc_data_t * );
ssize_t Pop(void *, size_t, int);
void Empty();
@@ -90,8 +90,8 @@ private:
vlc_object_t *p_access;
vlc_mutex_t lock;
vlc_cond_t wait;
- block_t *p_first;
- block_t **pp_next;
+ vlc_data_t *p_first;
+ vlc_data_t **pp_next;
};
/* The main class for building the filter graph */
diff --git a/modules/access/dv.c b/modules/access/dv.c
index 14d538f3c1..7b096c685b 100644
--- a/modules/access/dv.c
+++ b/modules/access/dv.c
@@ -49,7 +49,7 @@
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-static block_t *Block( stream_t *, bool * );
+static vlc_data_t *Block( stream_t *, bool * );
static int Control( stream_t *, int, va_list );
vlc_module_begin ()
@@ -67,8 +67,8 @@ typedef struct
vlc_thread_t thread;
stream_t *p_access;
vlc_mutex_t lock;
- block_t *p_frame;
- block_t **pp_last;
+ vlc_data_t *p_frame;
+ vlc_data_t **pp_last;
} event_thread_t;
@@ -106,7 +106,7 @@ typedef struct
/* event */
event_thread_t *p_ev;
vlc_mutex_t lock;
- block_t *p_frame;
+ vlc_data_t *p_frame;
} access_sys_t;
#define ISOCHRONOUS_QUEUE_LENGTH 1000
@@ -243,7 +243,7 @@ static void Close( vlc_object_t *p_this )
/* Cleanup frame data */
if( p_sys->p_ev->p_frame )
{
- block_ChainRelease( p_sys->p_ev->p_frame );
+ vlc_data_ChainRelease( p_sys->p_ev->p_frame );
p_sys->p_ev->p_frame = NULL;
p_sys->p_ev->pp_last = &p_sys->p_frame;
}
@@ -251,7 +251,7 @@ static void Close( vlc_object_t *p_this )
}
if( p_sys->p_frame )
- block_ChainRelease( p_sys->p_frame );
+ vlc_data_ChainRelease( p_sys->p_frame );
if( p_sys->p_raw1394 )
raw1394_destroy_handle( p_sys->p_raw1394 );
@@ -297,10 +297,10 @@ static int Control( stream_t *p_access, int i_query, va_list args )
return VLC_SUCCESS;
}
-static block_t *Block( stream_t *p_access, bool *restrict eof )
+static vlc_data_t *Block( stream_t *p_access, bool *restrict eof )
{
access_sys_t *p_sys = p_access->p_sys;
- block_t *p_block = NULL;
+ vlc_data_t *p_block = NULL;
vlc_mutex_lock( &p_sys->lock );
p_block = p_sys->p_frame;
@@ -361,7 +361,7 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data,
{
stream_t *p_access = NULL;
access_sys_t *p_sys = NULL;
- block_t *p_block = NULL;
+ vlc_data_t *p_block = NULL;
VLC_UNUSED(channel); VLC_UNUSED(tag);
VLC_UNUSED(sy); VLC_UNUSED(cycle); VLC_UNUSED(dropped);
@@ -389,10 +389,10 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data,
{
/* Push current frame to p_access thread. */
//p_sys->p_ev->p_frame->i_pts = vlc_tick_now();
- block_ChainAppend( &p_sys->p_frame, p_sys->p_ev->p_frame );
+ vlc_data_ChainAppend( &p_sys->p_frame, p_sys->p_ev->p_frame );
}
/* reset list */
- p_sys->p_ev->p_frame = block_Alloc( 144000 );
+ p_sys->p_ev->p_frame = vlc_data_Alloc( 144000 );
p_sys->p_ev->pp_last = &p_sys->p_frame;
vlc_mutex_unlock( &p_sys->lock );
}
@@ -424,7 +424,7 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data,
break;
default: /* we can´t handle any other data */
- block_Release( p_block );
+ vlc_data_Release( p_block );
p_block = NULL;
break;
}
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index bce6f7b1ba..f185e014d9 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -105,7 +105,7 @@ vlc_module_end ()
*****************************************************************************/
static int Control( stream_t *, int, va_list );
-static block_t *BlockScan( stream_t *, bool * );
+static vlc_data_t *BlockScan( stream_t *, bool * );
#define DVB_SCAN_MAX_LOCK_TIME VLC_TICK_FROM_SEC(2)
@@ -361,11 +361,11 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
/*****************************************************************************
* BlockScan:
*****************************************************************************/
-static block_t *BlockScan( stream_t *p_access, bool *restrict eof )
+static vlc_data_t *BlockScan( stream_t *p_access, bool *restrict eof )
{
access_sys_t *p_sys = p_access->p_sys;
scan_t *p_scan = p_sys->scan;
- block_t *p_block = NULL;
+ vlc_data_t *p_block = NULL;
if( scan_Run( p_scan ) != VLC_SUCCESS )
{
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index aa4eea573e..c3b3af85e4 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -30,7 +30,7 @@
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_dialog.h>
#include <vlc_charset.h>
@@ -1636,9 +1636,9 @@ static int ScanServiceCmp( const void *a, const void *b )
return 0;
}
-static block_t *BlockString( const char *psz )
+static vlc_data_t *BlockString( const char *psz )
{
- block_t *p = block_Alloc( strlen(psz) );
+ vlc_data_t *p = vlc_data_Alloc( strlen(psz) );
if( p )
memcpy( p->p_buffer, psz, p->i_buffer );
return p;
@@ -1703,10 +1703,10 @@ char * scan_service_GetUri( const scan_service_t *s )
return (i_ret >=0) ? psz_mrl : NULL;
}
-block_t *scan_GetM3U( scan_t *p_scan )
+vlc_data_t *scan_GetM3U( scan_t *p_scan )
{
vlc_object_t *p_obj = p_scan->p_obj;
- block_t *p_playlist = BlockString( "#EXTM3U\n\n" );
+ vlc_data_t *p_playlist = BlockString( "#EXTM3U\n\n" );
if( !p_playlist )
return NULL;
@@ -1715,7 +1715,7 @@ block_t *scan_GetM3U( scan_t *p_scan )
const scan_service_t **pp_filtered_list = vlc_alloc( i_total_services, sizeof(scan_service_t *) );
if( !pp_filtered_list )
{
- block_Release( p_playlist );
+ vlc_data_Release( p_playlist );
return NULL;
}
@@ -1774,16 +1774,16 @@ block_t *scan_GetM3U( scan_t *p_scan )
free( psz_mrl );
if( i_ret != -1 )
{
- block_t *p_block = BlockString( psz );
+ vlc_data_t *p_block = BlockString( psz );
if( p_block )
- block_ChainAppend( &p_playlist, p_block );
+ vlc_data_ChainAppend( &p_playlist, p_block );
free( psz );
}
}
free( pp_filtered_list );
- return p_playlist ? block_ChainGather( p_playlist ) : NULL;
+ return p_playlist ? vlc_data_ChainGather( p_playlist ) : NULL;
}
#define dvbpsi_packet_push(a,b) dvbpsi_packet_push(a, (uint8_t *)b)
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 1782c90a1b..717e830fc0 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -179,7 +179,7 @@ void scan_Destroy( scan_t *p_scan );
int scan_Run( scan_t *p_scan );
-block_t *scan_GetM3U( scan_t *p_scan );
+vlc_data_t *scan_GetM3U( scan_t *p_scan );
bool scan_IsCancelled( scan_t *p_scan );
const char *scan_value_modulation(scan_modulation_t);
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 9a38df3151..6d959ffc4d 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -109,7 +109,7 @@ vlc_module_end ()
#define DVD_READ_CACHE 1
#endif
-#define BLOCK_FLAG_CELL_DISCONTINUITY (BLOCK_FLAG_PRIVATE_SHIFT << 1)
+#define FRAME_FLAG_CELL_DISCONTINUITY (FRAME_FLAG_PRIVATE_SHIFT << 1)
/*****************************************************************************
* Local prototypes
@@ -995,7 +995,7 @@ static int Demux( demux_t *p_demux )
p_sys->i_vobu_flush = 0;
for( int i=0; i<PS_TK_COUNT; i++ )
- p_sys->tk[i].i_next_block_flags |= BLOCK_FLAG_CELL_DISCONTINUITY;
+ p_sys->tk[i].i_next_block_flags |= FRAME_FLAG_CELL_DISCONTINUITY;
/* FIXME is it correct or there is better way to know chapter change */
if( dvdnav_current_title_info( p_sys->dvdnav, &i_title,
@@ -1356,7 +1356,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
}
/* Create a block */
- block_t *p_pkt = block_Alloc( i_size );
+ vlc_frame_t *p_pkt = vlc_frame_Alloc( i_size );
memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */
@@ -1375,7 +1375,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
msg_Warn( p_demux, "received a SYSTEM packet" );
}
#endif
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
break;
case 0x1ba:
@@ -1387,7 +1387,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
es_out_SetPCR( p_demux->out, i_scr );
if( i_mux_rate > 0 ) p_sys->i_mux_rate = i_mux_rate;
}
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
break;
}
default:
@@ -1407,14 +1407,14 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
{
int i_next_block_flags = tk->i_next_block_flags;
tk->i_next_block_flags = 0;
- if( i_next_block_flags & BLOCK_FLAG_CELL_DISCONTINUITY )
+ if( i_next_block_flags & FRAME_FLAG_CELL_DISCONTINUITY )
{
if( p_pkt->i_dts != VLC_TICK_INVALID )
{
- i_next_block_flags &= ~BLOCK_FLAG_CELL_DISCONTINUITY;
- i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ i_next_block_flags &= ~FRAME_FLAG_CELL_DISCONTINUITY;
+ i_next_block_flags |= FRAME_FLAG_DISCONTINUITY;
}
- else tk->i_next_block_flags = BLOCK_FLAG_CELL_DISCONTINUITY;
+ else tk->i_next_block_flags = FRAME_FLAG_CELL_DISCONTINUITY;
}
p_pkt->i_flags |= i_next_block_flags;
es_out_Send( p_demux->out, tk->es, p_pkt );
@@ -1422,12 +1422,12 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
else
{
tk->i_next_block_flags = 0;
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
}
}
else
{
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
}
break;
}
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index 0aea9ff4bf..fff44e0f23 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -572,7 +572,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
}
/* Create a block */
- block_t *p_pkt = block_Alloc( i_size );
+ vlc_frame_t *p_pkt = vlc_frame_Alloc( i_size );
memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */
@@ -592,7 +592,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
msg_Warn( p_demux, "received a SYSTEM packet" );
}
#endif
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
break;
case 0x1ba:
@@ -604,7 +604,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
es_out_SetPCR( p_demux->out, i_scr );
if( i_mux_rate > 0 ) p_sys->i_mux_rate = i_mux_rate;
}
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
break;
}
default:
@@ -625,12 +625,12 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
}
else
{
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
}
}
else
{
- block_Release( p_pkt );
+ vlc_frame_Release( p_pkt );
}
break;
}
diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 17cfee398d..872fbbf4c9 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -115,7 +115,7 @@ static int Control( stream_t *, int, va_list );
static int DirRead( stream_t *, input_item_node_t * );
#ifdef ENABLE_SOUT
static int OutSeek( sout_access_out_t *, off_t );
-static ssize_t Write( sout_access_out_t *, block_t * );
+static ssize_t Write( sout_access_out_t *, vlc_frame_t * );
#endif
static int LoginUserPwd( vlc_object_t *, access_sys_t *,
@@ -982,7 +982,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_current_node)
* Write:
*****************************************************************************/
#ifdef ENABLE_SOUT
-static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
+static ssize_t Write( sout_access_out_t *p_access, vlc_frame_t *p_buffer )
{
access_sys_t *p_sys = GET_OUT_SYS(p_access);
size_t i_write = 0;
@@ -991,11 +991,11 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
while( p_buffer != NULL )
{
- block_t *p_next = p_buffer->p_next;
+ vlc_frame_t *p_next = p_buffer->p_next;
i_write += vlc_tls_Write( p_sys->data,
p_buffer->p_buffer, p_buffer->i_buffer );
- block_Release( p_buffer );
+ vlc_frame_Release( p_buffer );
p_buffer = p_next;
}
diff --git a/modules/access/http/access.c b/modules/access/http/access.c
index 97f0e7f1f1..f659f992fa 100644
--- a/modules/access/http/access.c
+++ b/modules/access/http/access.c
@@ -47,11 +47,11 @@ typedef struct
struct vlc_http_resource *resource;
} access_sys_t;
-static block_t *FileRead(stream_t *access, bool *restrict eof)
+static vlc_data_t *FileRead(stream_t *access, bool *restrict eof)
{
access_sys_t *sys = access->p_sys;
- block_t *b = vlc_http_file_read(sys->resource);
+ vlc_data_t *b = vlc_http_file_read(sys->resource);
if (b == NULL)
*eof = true;
return b;
@@ -113,11 +113,11 @@ static int FileControl(stream_t *access, int query, va_list args)
return VLC_SUCCESS;
}
-static block_t *LiveRead(stream_t *access, bool *restrict eof)
+static vlc_data_t *LiveRead(stream_t *access, bool *restrict eof)
{
access_sys_t *sys = access->p_sys;
- block_t *b = vlc_http_live_read(sys->resource);
+ vlc_data_t *b = vlc_http_live_read(sys->resource);
if (b == NULL) /* TODO: loop instead of EOF, see vlc_http_live_read() */
*eof = true;
return b;
diff --git a/modules/access/http/chunked.c b/modules/access/http/chunked.c
index 549f590ebd..0032a65739 100644
--- a/modules/access/http/chunked.c
+++ b/modules/access/http/chunked.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_tls.h> /* TODO: remove this */
#include "message.h"
@@ -60,11 +60,11 @@ static struct vlc_http_msg *vlc_chunked_wait(struct vlc_http_stream *stream)
return NULL;
}
-static block_t *vlc_chunked_read(struct vlc_http_stream *stream)
+static vlc_data_t *vlc_chunked_read(struct vlc_http_stream *stream)
{
struct vlc_chunked_stream *s =
container_of(stream, struct vlc_chunked_stream, stream);
- block_t *block = NULL;
+ vlc_data_t *block = NULL;
if (s->eof)
return NULL;
@@ -103,14 +103,14 @@ static block_t *vlc_chunked_read(struct vlc_http_stream *stream)
if (size > s->chunk_length)
size = s->chunk_length;
- block = block_Alloc(size);
+ block = vlc_data_Alloc(size);
if (unlikely(block == NULL))
return NULL;
ssize_t val = vlc_tls_Read(s->tls, block->p_buffer, size, false);
if (val <= 0)
{ /* Connection error (-) or unexpected end of connection (0) */
- block_Release(block);
+ vlc_data_Release(block);
return vlc_chunked_fatal(s);
}
diff --git a/modules/access/http/chunked_test.c b/modules/access/http/chunked_test.c
index d6d5c374d0..d696d06a98 100644
--- a/modules/access/http/chunked_test.c
+++ b/modules/access/http/chunked_test.c
@@ -30,7 +30,7 @@
#include <vlc_common.h>
#include <vlc_tls.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include "conn.h"
#include "message.h"
@@ -110,7 +110,7 @@ static struct vlc_http_stream chunked_stream =
static void test_good(void)
{
struct vlc_http_stream *s;
- block_t *b;
+ vlc_data_t *b;
/* Simple good payload */
stream_content =
@@ -128,13 +128,13 @@ static void test_good(void)
assert(b != NULL);
assert(b->i_buffer == 10);
assert(!memcmp(b->p_buffer, "1234567890", 10));
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_stream_read(s);
assert(b != NULL);
assert(b->i_buffer == 26);
assert(!memcmp(b->p_buffer, "abcdefghijklmnopqrstuvwxyz", 26));
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_stream_read(s);
assert(b == NULL);
@@ -147,7 +147,7 @@ static void test_good(void)
static void test_empty(void)
{
struct vlc_http_stream *s;
- block_t *b;
+ vlc_data_t *b;
stream_content = "0\r\n";
stream_length = 3;
@@ -166,7 +166,7 @@ static void test_empty(void)
static void test_bad(const char *payload)
{
struct vlc_http_stream *s;
- block_t *b;
+ vlc_data_t *b;
stream_content = payload;
stream_length = strlen(payload);
@@ -178,7 +178,7 @@ static void test_bad(const char *payload)
while ((b = vlc_http_stream_read(s)) != vlc_http_error)
{
assert(b != NULL);
- block_Release(b);
+ vlc_data_Release(b);
}
vlc_http_stream_close(s, false);
diff --git a/modules/access/http/file.c b/modules/access/http/file.c
index 322c0b2fbe..ec104f6e01 100644
--- a/modules/access/http/file.c
+++ b/modules/access/http/file.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_strings.h>
#include "message.h"
#include "resource.h"
@@ -229,10 +229,10 @@ int vlc_http_file_seek(struct vlc_http_resource *res, uintmax_t offset)
return 0;
}
-block_t *vlc_http_file_read(struct vlc_http_resource *res)
+vlc_data_t *vlc_http_file_read(struct vlc_http_resource *res)
{
struct vlc_http_file *file = (struct vlc_http_file *)res;
- block_t *block = vlc_http_res_read(res);
+ vlc_data_t *block = vlc_http_res_read(res);
if (block == vlc_http_error)
{ /* Automatically reconnect on error if server supports seek */
diff --git a/modules/access/http/file.h b/modules/access/http/file.h
index 802cf8f93a..2a7f837e00 100644
--- a/modules/access/http/file.h
+++ b/modules/access/http/file.h
@@ -29,7 +29,7 @@
struct vlc_http_mgr;
struct vlc_http_resource;
-struct block_t;
+struct vlc_data_t;
/**
* Creates an HTTP file.
@@ -77,7 +77,7 @@ int vlc_http_file_seek(struct vlc_http_resource *, uintmax_t offset);
*
* Reads data from a file and update the file offset.
*/
-struct block_t *vlc_http_file_read(struct vlc_http_resource *);
+struct vlc_data_t *vlc_http_file_read(struct vlc_http_resource *);
#define vlc_http_file_get_status vlc_http_res_get_status
#define vlc_http_file_get_redirect vlc_http_res_get_redirect
diff --git a/modules/access/http/file_test.c b/modules/access/http/file_test.c
index 64fab0711b..7a76db25a6 100644
--- a/modules/access/http/file_test.c
+++ b/modules/access/http/file_test.c
@@ -310,7 +310,7 @@ static struct vlc_http_msg *stream_read_headers(struct vlc_http_stream *s)
return m;
}
-static struct block_t *stream_read(struct vlc_http_stream *s)
+static struct vlc_data_t *stream_read(struct vlc_http_stream *s)
{
assert(s == &stream);
return NULL;
diff --git a/modules/access/http/h1conn.c b/modules/access/http/h1conn.c
index 2fdd26614e..29ce33edc3 100644
--- a/modules/access/http/h1conn.c
+++ b/modules/access/http/h1conn.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <vlc_common.h>
#include <vlc_tls.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include "conn.h"
#include "message.h"
@@ -228,7 +228,7 @@ static struct vlc_http_msg *vlc_h1_stream_wait(struct vlc_http_stream *stream)
return resp;
}
-static block_t *vlc_h1_stream_read(struct vlc_http_stream *stream)
+static vlc_data_t *vlc_h1_stream_read(struct vlc_http_stream *stream)
{
struct vlc_h1_conn *conn = vlc_h1_stream_conn(stream);
size_t size = 2048;
@@ -243,14 +243,14 @@ static block_t *vlc_h1_stream_read(struct vlc_http_stream *stream)
if (size == 0)
return NULL;
- block_t *block = block_Alloc(size);
+ vlc_data_t *block = vlc_data_Alloc(size);
if (unlikely(block == NULL))
return vlc_http_error;
ssize_t val = vlc_tls_Read(conn->conn.tls, block->p_buffer, size, false);
if (val <= 0)
{
- block_Release(block);
+ vlc_data_Release(block);
if (val < 0)
return vlc_http_error;
if (conn->content_length != UINTMAX_MAX)
diff --git a/modules/access/http/h1conn_test.c b/modules/access/http/h1conn_test.c
index 0e792274c1..db65bac49e 100644
--- a/modules/access/http/h1conn_test.c
+++ b/modules/access/http/h1conn_test.c
@@ -34,7 +34,7 @@
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_tls.h>
#include "conn.h"
#include "message.h"
@@ -93,7 +93,7 @@ int main(void)
{
struct vlc_http_stream *s;
struct vlc_http_msg *m;
- struct block_t *b;
+ struct vlc_data_t *b;
/* Dummy */
conn_create();
@@ -157,7 +157,7 @@ int main(void)
assert(b != NULL);
assert(b->i_buffer == 12);
assert(!memcmp(b->p_buffer, "Hello world!", 12));
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_msg_read(m);
assert(b == NULL);
vlc_http_msg_destroy(m);
@@ -177,7 +177,7 @@ int main(void)
assert(b != NULL);
assert(b->i_buffer == 12);
assert(!memcmp(b->p_buffer, "Hello again!", 12));
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_msg_read(m);
assert(b == NULL);
vlc_http_msg_destroy(m);
@@ -197,7 +197,7 @@ int main(void)
assert(b != NULL);
assert(b->i_buffer == 12);
assert(!memcmp(b->p_buffer, "Hello there!", 12));
- block_Release(b);
+ vlc_data_Release(b);
conn_destroy(); /* test connection release before closing stream */
b = vlc_http_msg_read(m);
assert(b == NULL);
@@ -216,7 +216,7 @@ int main(void)
assert(b != NULL);
assert(b->i_buffer == 8);
assert(!memcmp(b->p_buffer, "Bye bye!", 8));
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_msg_read(m);
assert(b == NULL);
vlc_http_msg_destroy(m);
@@ -235,7 +235,7 @@ int main(void)
assert(b != NULL);
assert(b->i_buffer == 6);
assert(!memcmp(b->p_buffer, "Hello ", 6));
- block_Release(b);
+ vlc_data_Release(b);
conn_shutdown(SHUT_RDWR);
b = vlc_http_msg_read(m);
assert(b == vlc_http_error);
diff --git a/modules/access/http/h2conn.c b/modules/access/http/h2conn.c
index f6110c768d..f8c30d47f8 100644
--- a/modules/access/http/h2conn.c
+++ b/modules/access/http/h2conn.c
@@ -33,7 +33,7 @@
# include <sys/uio.h>
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_interrupt.h>
#include <vlc_tls.h>
@@ -267,7 +267,7 @@ static struct vlc_http_msg *vlc_h2_stream_wait(struct vlc_http_stream *stream)
* \return a VLC data block, NULL on end of stream,
* or vlc_http_error on stream error
*/
-static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
+static vlc_data_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
{
struct vlc_h2_stream *s =
container_of(stream, struct vlc_h2_stream, stream);
@@ -311,7 +311,7 @@ static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
vlc_h2_stream_unlock(s);
/* This, err, unconventional code to avoid copying data. */
- block_t *block = block_heap_Alloc(f, sizeof (*f) + vlc_h2_frame_size(f));
+ vlc_data_t *block = vlc_data_heap_Alloc(f, sizeof (*f) + vlc_h2_frame_size(f));
if (unlikely(block == NULL))
{
vlc_h2_stream_error(conn, s->id, VLC_H2_INTERNAL_ERROR);
diff --git a/modules/access/http/h2conn_test.c b/modules/access/http/h2conn_test.c
index 1fb9a15d61..0fc0ec68c3 100644
--- a/modules/access/http/h2conn_test.c
+++ b/modules/access/http/h2conn_test.c
@@ -34,7 +34,7 @@
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_tls.h>
#include "h2frame.h"
#include "conn.h"
@@ -156,7 +156,7 @@ int main(void)
{
struct vlc_http_stream *s, *s2;
struct vlc_http_msg *m;
- struct block_t *b;
+ struct vlc_data_t *b;
uint_fast32_t sid = -1; /* Second guessed stream IDs :-/ */
conn_create();
@@ -212,10 +212,10 @@ int main(void)
stream_data(sid, "Stray message", false); /* data after EOS */
b = vlc_http_msg_read(m);
assert(b != NULL);
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_msg_read(m);
assert(b != NULL);
- block_Release(b);
+ vlc_data_Release(b);
b = vlc_http_msg_read(m);
assert(b == NULL);
vlc_http_msg_destroy(m);
diff --git a/modules/access/http/live.c b/modules/access/http/live.c
index 6daf967a68..b2233fae62 100644
--- a/modules/access/http/live.c
+++ b/modules/access/http/live.c
@@ -72,9 +72,9 @@ struct vlc_http_resource *vlc_http_live_create(struct vlc_http_mgr *mgr,
return res;
}
-block_t *vlc_http_live_read(struct vlc_http_resource *res)
+vlc_data_t *vlc_http_live_read(struct vlc_http_resource *res)
{
- struct block_t *block = vlc_http_res_read(res);
+ struct vlc_data_t *block = vlc_http_res_read(res);
if (block != NULL && block != vlc_http_error)
return block;
diff --git a/modules/access/http/live.h b/modules/access/http/live.h
index 552df6c097..50d1f7805e 100644
--- a/modules/access/http/live.h
+++ b/modules/access/http/live.h
@@ -26,12 +26,12 @@
*/
struct vlc_http_resource;
-struct block_t;
+struct vlc_data_t;
struct vlc_http_resource *vlc_http_live_create(struct vlc_http_mgr *mgr,
const char *uri, const char *ua,
const char *ref);
-struct block_t *vlc_http_live_read(struct vlc_http_resource *);
+struct vlc_data_t *vlc_http_live_read(struct vlc_http_resource *);
#define vlc_http_live_get_status vlc_http_res_get_status
#define vlc_http_live_get_redirect vlc_http_res_get_redirect
diff --git a/modules/access/http/message.c b/modules/access/http/message.c
index 9ea1566196..d589b9a59c 100644
--- a/modules/access/http/message.c
+++ b/modules/access/http/message.c
@@ -285,7 +285,7 @@ struct vlc_http_msg *vlc_http_msg_get_final(struct vlc_http_msg *m)
return m;
}
-block_t *vlc_http_msg_read(struct vlc_http_msg *m)
+vlc_data_t *vlc_http_msg_read(struct vlc_http_msg *m)
{
if (m->payload == NULL)
return NULL;
diff --git a/modules/access/http/message.h b/modules/access/http/message.h
index 83835f265d..4bafea6164 100644
--- a/modules/access/http/message.h
+++ b/modules/access/http/message.h
@@ -29,7 +29,7 @@
*/
struct vlc_http_msg;
-struct block_t;
+struct vlc_data_t;
struct vlc_http_cookie_jar_t;
/**
@@ -286,7 +286,7 @@ struct vlc_http_msg *vlc_http_msg_get_final(struct vlc_http_msg *) VLC_USED;
* @retval NULL on end-of-stream
* @retval vlc_http_error on fatal error
*/
-struct block_t *vlc_http_msg_read(struct vlc_http_msg *) VLC_USED;
+struct vlc_data_t *vlc_http_msg_read(struct vlc_http_msg *) VLC_USED;
/** @} */
@@ -333,7 +333,7 @@ VLC_USED;
struct vlc_http_stream_cbs
{
struct vlc_http_msg *(*read_headers)(struct vlc_http_stream *);
- struct block_t *(*read)(struct vlc_http_stream *);
+ struct vlc_data_t *(*read)(struct vlc_http_stream *);
void (*close)(struct vlc_http_stream *, bool abort);
};
@@ -365,11 +365,11 @@ struct vlc_http_msg *vlc_http_stream_read_headers(struct vlc_http_stream *s)
*
* Reads the next block of data from the message payload of an HTTP stream.
*
- * @return a block of data (use block_Release() to free it)
+ * @return a block of data (use vlc_data_Release() to free it)
* @retval NULL The end of the stream was reached.
* @retval vlc_http_error The stream encountered a fatal error.
*/
-static inline struct block_t *vlc_http_stream_read(struct vlc_http_stream *s)
+static inline struct vlc_data_t *vlc_http_stream_read(struct vlc_http_stream *s)
{
return s->cbs->read(s);
}
diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index 9a28bb50f3..a02f66b5d1 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -319,7 +319,7 @@ char *vlc_http_res_get_type(struct vlc_http_resource *res)
return (type != NULL) ? strdup(type) : NULL;
}
-struct block_t *vlc_http_res_read(struct vlc_http_resource *res)
+struct vlc_data_t *vlc_http_res_read(struct vlc_http_resource *res)
{
int status = vlc_http_res_get_status(res);
if (status < 200 || status >= 300)
diff --git a/modules/access/http/resource.h b/modules/access/http/resource.h
index 22b5abac64..a4dff4d80e 100644
--- a/modules/access/http/resource.h
+++ b/modules/access/http/resource.h
@@ -94,7 +94,7 @@ char *vlc_http_res_get_type(struct vlc_http_resource *);
/**
* Reads data.
*/
-struct block_t *vlc_http_res_read(struct vlc_http_resource *);
+struct vlc_data_t *vlc_http_res_read(struct vlc_http_resource *);
int vlc_http_res_set_login(struct vlc_http_resource *res,
const char *username, const char *password);
diff --git a/modules/access/imem.c b/modules/access/imem.c
index 7710d91125..009b9c87d1 100644
--- a/modules/access/imem.c
+++ b/modules/access/imem.c
@@ -199,7 +199,7 @@ typedef void (*imem_release_t)(void *data, const char *cookie, size_t, void *);
*****************************************************************************/
/* */
-static block_t *Block(stream_t *, bool *);
+static vlc_data_t *Block(stream_t *, bool *);
static int ControlAccess(stream_t *, int, va_list);
static int Demux(demux_t *);
@@ -361,7 +361,7 @@ static int ControlAccess(stream_t *access, int i_query, va_list args)
* It retreives data using the get() callback, copies them,
* and then release them using the release() callback.
*/
-static block_t *Block(stream_t *access, bool *restrict eof)
+static vlc_data_t *Block(stream_t *access, bool *restrict eof)
{
imem_sys_t *sys = (imem_sys_t*)access->p_sys;
@@ -375,9 +375,9 @@ static block_t *Block(stream_t *access, bool *restrict eof)
return NULL;
}
- block_t *block = NULL;
+ vlc_data_t *block = NULL;
if (buffer_size > 0) {
- block = block_Alloc(buffer_size);
+ block = vlc_data_Alloc(buffer_size);
if (block)
memcpy(block->p_buffer, buffer, buffer_size);
}
@@ -587,7 +587,7 @@ static int Demux(demux_t *demux)
dts = pts;
if (buffer_size > 0) {
- block_t *block = block_Alloc(buffer_size);
+ vlc_frame_t *block = vlc_frame_Alloc(buffer_size);
if (block) {
block->i_dts = dts >= 0 ? (1 + dts) : VLC_TICK_INVALID;
block->i_pts = pts >= 0 ? (1 + pts) : VLC_TICK_INVALID;
diff --git a/modules/access/jack.c b/modules/access/jack.c
index b6f6d66d19..64ddbdde53 100644
--- a/modules/access/jack.c
+++ b/modules/access/jack.c
@@ -91,7 +91,7 @@ typedef struct
int i_sample_rate;
int i_audio_max_frame_size;
int i_frequency;
- block_t *p_block_audio;
+ vlc_frame_t *p_frame_audio;
es_out_id_t *p_es_audio;
date_t pts;
@@ -115,7 +115,7 @@ static void Parse ( demux_t * );
static void Port_finder( demux_t * );
static int Process( jack_nframes_t i_frames, void *p_arg );
-static block_t *GrabJack( demux_t * );
+static vlc_frame_t *GrabJack( demux_t * );
/*****************************************************************************
* Open: Connect to the JACK server
@@ -305,7 +305,7 @@ static void Close( vlc_object_t *p_this )
demux_sys_t *p_sys = p_demux->p_sys;
msg_Dbg( p_demux,"Module unloaded" );
- if( p_sys->p_block_audio ) block_Release( p_sys->p_block_audio );
+ if( p_sys->p_frame_audio ) vlc_frame_Release( p_sys->p_frame_audio );
if( p_sys->p_jack_client ) jack_client_close( p_sys->p_jack_client );
if( p_sys->p_jack_ringbuffer ) jack_ringbuffer_free( p_sys->p_jack_ringbuffer );
free( p_sys->pp_jack_port_input );
@@ -363,16 +363,16 @@ static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys;
es_out_id_t *p_es;
- block_t *p_block;
+ vlc_frame_t *p_frame;
p_sys = p_demux->p_sys;
p_es = p_sys->p_es_audio;
- p_block = GrabJack( p_demux );
+ p_frame = GrabJack( p_demux );
- if( p_block )
+ if( p_frame )
{
- es_out_SetPCR( p_demux->out, p_block->i_pts );
- es_out_Send( p_demux->out, p_es, p_block );
+ es_out_SetPCR( p_demux->out, p_frame->i_pts );
+ es_out_Send( p_demux->out, p_es, p_frame );
}
return 1;
@@ -420,10 +420,10 @@ int Process( jack_nframes_t i_frames, void *p_arg )
/*****************************************************************************
* GrabJack: grab audio data in the Jack buffer
*****************************************************************************/
-static block_t *GrabJack( demux_t *p_demux )
+static vlc_frame_t *GrabJack( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
/* read signal from ring buffer */
size_t i_read = jack_ringbuffer_read_space( p_sys->p_jack_ringbuffer );
@@ -436,17 +436,17 @@ static block_t *GrabJack( demux_t *p_demux )
return NULL;
}
- if( p_sys->p_block_audio )
+ if( p_sys->p_frame_audio )
{
- p_block = p_sys->p_block_audio;
+ p_frame = p_sys->p_frame_audio;
}
else
{
- p_block = block_Alloc( i_read );
+ p_frame = vlc_frame_Alloc( i_read );
}
- if( !p_block )
+ if( !p_frame )
{
- msg_Warn( p_demux, "cannot get block" );
+ msg_Warn( p_demux, "cannot get frame" );
return 0;
}
@@ -460,16 +460,16 @@ static block_t *GrabJack( demux_t *p_demux )
i_read |= i_read >> 16;
i_read++;
- i_read = jack_ringbuffer_read( p_sys->p_jack_ringbuffer, ( char * ) p_block->p_buffer, i_read );
+ i_read = jack_ringbuffer_read( p_sys->p_jack_ringbuffer, ( char * ) p_frame->p_buffer, i_read );
- p_block->i_dts = p_block->i_pts = date_Increment( &p_sys->pts,
+ p_frame->i_dts = p_frame->i_pts = date_Increment( &p_sys->pts,
i_read/(p_sys->i_channels * p_sys->jack_sample_size) );
- p_sys->p_block_audio = p_block;
- p_block->i_buffer = i_read;
- p_sys->p_block_audio = 0;
+ p_sys->p_frame_audio = p_frame;
+ p_frame->i_buffer = i_read;
+ p_sys->p_frame_audio = 0;
- return p_block;
+ return p_frame;
}
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index 4952427ade..445a48ec39 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -551,7 +551,7 @@ static int InitAudio( demux_t *p_demux )
static int HandleVideo( demux_t *p_demux, const uint8_t *p_buffer )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_current_picture = block_Alloc( p_sys->i_vblock_size );
+ vlc_frame_t *p_current_picture = vlc_frame_Alloc( p_sys->i_vblock_size );
if( unlikely( !p_current_picture ) )
return VLC_ENOMEM;
uint8_t *p_y = p_current_picture->p_buffer;
@@ -621,7 +621,7 @@ static int HandleAudio( demux_t *p_demux, const uint8_t *p_buffer )
hdsdi_audio_t *p_audio = &p_sys->p_audios[i];
if ( p_audio->i_channel != -1 && p_audio->p_es != NULL )
{
- block_t *p_block = block_Alloc( p_sys->i_ablock_size );
+ vlc_frame_t *p_block = vlc_frame_Alloc( p_sys->i_ablock_size );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
SparseCopy( (int16_t *)p_block->p_buffer, (const int16_t *)p_buffer,
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 8ce44d46d0..6ee39cd5ac 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -165,7 +165,7 @@ typedef struct
unsigned int i_line_buffer;
unsigned int i_current_line;
uint8_t *p_line_buffer;
- block_t *p_current_picture;
+ vlc_frame_t *p_current_picture;
uint8_t *p_y, *p_u, *p_v;
uint8_t *p_wss_buffer;
uint8_t *p_telx_buffer;
@@ -336,14 +336,14 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static int DemuxDemux( demux_t *p_demux )
{
- block_t *p_block = vlc_stream_Block( p_demux->s, DEMUX_BUFFER_SIZE );
+ vlc_frame_t *p_block = vlc_stream_Frame( p_demux->s, DEMUX_BUFFER_SIZE );
int i_ret;
if ( p_block == NULL )
return 0;
i_ret = HandleSDBuffer( p_demux, p_block->p_buffer, p_block->i_buffer );
- block_Release( p_block );
+ vlc_frame_Release( p_block );
return ( i_ret == VLC_SUCCESS );
}
@@ -404,7 +404,7 @@ static int NewFrame( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
- p_sys->p_current_picture = block_Alloc( p_sys->i_block_size );
+ p_sys->p_current_picture = vlc_frame_Alloc( p_sys->i_block_size );
if( unlikely( !p_sys->p_current_picture ) )
return VLC_ENOMEM;
p_sys->p_y = p_sys->p_current_picture->p_buffer;
@@ -547,7 +547,7 @@ static void StopDecode( demux_t *p_demux )
free( p_sys->p_line_buffer );
- block_Release( p_sys->p_current_picture );
+ vlc_frame_Release( p_sys->p_current_picture );
p_sys->p_current_picture = NULL;
es_out_Del( p_demux->out, p_sys->p_es_video );
@@ -789,7 +789,7 @@ static int DecodeTelx( demux_t *p_demux )
int i_nb_slices_rounded = 3 + (i_nb_slices / 4) * 4;
int i;
uint8_t *p;
- block_t *p_block = block_Alloc( 1 + i_nb_slices_rounded * 46 );
+ vlc_frame_t *p_block = vlc_frame_Alloc( 1 + i_nb_slices_rounded * 46 );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
p_block->p_buffer[0] = 0x10; /* FIXME ? data_identifier */
@@ -891,7 +891,7 @@ static void ResampleAudio( int16_t *p_out, int16_t *p_in,
static int DecodeAudio( demux_t *p_demux, sdi_audio_t *p_audio )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_block;
int16_t *p_output;
if ( p_audio->p_buffer == NULL )
@@ -925,7 +925,7 @@ static int DecodeAudio( demux_t *p_demux, sdi_audio_t *p_audio )
return VLC_EGENERIC;
}
- p_block = block_Alloc( p_audio->i_nb_samples * sizeof(int16_t) * 2 );
+ p_block = vlc_frame_Alloc( p_audio->i_nb_samples * sizeof(int16_t) * 2 );
if( unlikely( !p_block ) )
return VLC_ENOMEM;
p_block->i_dts = p_block->i_pts = p_sys->i_next_date
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 9d6e01ae32..8578628790 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -165,7 +165,7 @@ typedef struct
ASF_STREAM
} format;
- block_t *p_asf_block;
+ vlc_data_t *p_asf_block;
bool b_discard_trunc;
vlc_demux_chained_t *p_out_muxed; /* for muxed stream */
@@ -174,7 +174,7 @@ typedef struct
bool b_rtcp_sync;
bool b_flushing_discontinuity;
- int i_next_block_flags;
+ int i_next_frame_flags;
char waiting;
vlc_tick_t i_prevpts;
vlc_tick_t i_pcr;
@@ -869,7 +869,7 @@ static int SessionsSetup( demux_t *p_demux )
tk->waiting = 0;
tk->b_rtcp_sync = false;
tk->b_flushing_discontinuity = false;
- tk->i_next_block_flags = 0;
+ tk->i_next_frame_flags = 0;
tk->i_prevpts = VLC_TICK_INVALID;
tk->i_pcr = VLC_TICK_INVALID;
tk->f_npt = 0.;
@@ -1459,7 +1459,7 @@ static int Demux( demux_t *p_demux )
tk->i_pcr = VLC_TICK_INVALID;
tk->f_npt = 0.;
tk->b_flushing_discontinuity = false;
- tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ tk->i_next_frame_flags |= FRAME_FLAG_DISCONTINUITY;
}
if( p_sys->i_pcr != VLC_TICK_INVALID )
es_out_SetPCR( p_demux->out, VLC_TICK_0 +
@@ -1730,7 +1730,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
live_track_t *tk = p_sys->track[i];
tk->b_rtcp_sync = false;
tk->b_flushing_discontinuity = false;
- tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ tk->i_next_frame_flags |= FRAME_FLAG_DISCONTINUITY;
tk->i_prevpts = VLC_TICK_INVALID;
tk->i_pcr = VLC_TICK_INVALID;
}
@@ -1791,7 +1791,7 @@ static int RollOverTcp( demux_t *p_demux )
if( tk->p_out_muxed ) vlc_demux_chained_Delete( tk->p_out_muxed );
if( tk->p_es ) es_out_Del( p_demux->out, tk->p_es );
- if( tk->p_asf_block ) block_Release( tk->p_asf_block );
+ if( tk->p_asf_block ) vlc_data_Release( tk->p_asf_block );
es_format_Clean( &tk->fmt );
free( tk->p_buffer );
free( tk );
@@ -1837,13 +1837,13 @@ error:
/*****************************************************************************
*
*****************************************************************************/
-static block_t *StreamParseAsf( demux_t *p_demux, live_track_t *tk,
+static vlc_data_t *StreamParseAsf( demux_t *p_demux, live_track_t *tk,
bool b_marker,
const uint8_t *p_data, unsigned i_size )
{
demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
const unsigned i_packet_size = p_sys->asfh.i_min_data_packet_size;
- block_t *p_list = NULL;
+ vlc_data_t *p_list = NULL;
while( i_size >= 4 )
{
@@ -1886,7 +1886,7 @@ static block_t *StreamParseAsf( demux_t *p_demux, live_track_t *tk,
if( !tk->p_asf_block )
{
- tk->p_asf_block = block_Alloc( i_packet_size );
+ tk->p_asf_block = vlc_data_Alloc( i_packet_size );
if( !tk->p_asf_block )
break;
tk->p_asf_block->i_buffer = 0;
@@ -1900,7 +1900,7 @@ static block_t *StreamParseAsf( demux_t *p_demux, live_track_t *tk,
{
/* We have a complete packet */
tk->p_asf_block->i_buffer = i_packet_size;
- block_ChainAppend( &p_list, tk->p_asf_block );
+ vlc_data_ChainAppend( &p_list, tk->p_asf_block );
tk->p_asf_block = NULL;
}
}
@@ -1931,7 +1931,8 @@ static void StreamRead( void *p_private, unsigned int i_size,
live_track_t *tk = (live_track_t*)p_private;
demux_t *p_demux = tk->p_demux;
demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
- block_t *p_block;
+ vlc_data_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
//msg_Dbg( p_demux, "pts: %d", pts.tv_sec );
@@ -2046,20 +2047,20 @@ static void StreamRead( void *p_private, unsigned int i_size,
{
AMRAudioSource *amrSource = (AMRAudioSource*)tk->sub->readSource();
- if( (p_block = block_Alloc( i_size + 1 )) )
+ if( (p_frame = vlc_frame_Alloc( i_size + 1 )) )
{
- p_block->p_buffer[0] = amrSource->lastFrameHeader();
- memcpy( p_block->p_buffer + 1, tk->p_buffer, i_size );
+ p_frame->p_buffer[0] = amrSource->lastFrameHeader();
+ memcpy( p_frame->p_buffer + 1, tk->p_buffer, i_size );
}
}
else if( tk->fmt.i_codec == VLC_CODEC_H261 )
{
H261VideoRTPSource *h261Source = (H261VideoRTPSource*)tk->sub->rtpSource();
uint32_t header = h261Source->lastSpecialHeader();
- if( (p_block = block_Alloc( i_size + 4 )) )
+ if( (p_frame = vlc_frame_Alloc( i_size + 4 )) )
{
- memcpy( p_block->p_buffer, &header, 4 );
- memcpy( p_block->p_buffer + 4, tk->p_buffer, i_size );
+ memcpy( p_frame->p_buffer, &header, 4 );
+ memcpy( p_frame->p_buffer + 4, tk->p_buffer, i_size );
}
}
else if( tk->fmt.i_codec == VLC_CODEC_H264 || tk->fmt.i_codec == VLC_CODEC_HEVC )
@@ -2070,15 +2071,15 @@ static void StreamRead( void *p_private, unsigned int i_size,
msg_Warn( p_demux, "unsupported NAL type for H265" );
/* Normal NAL type */
- if( (p_block = block_Alloc( i_size + 4 )) )
+ if( (p_frame = vlc_frame_Alloc( i_size + 4 )) )
{
- p_block->p_buffer[0] = 0x00;
- p_block->p_buffer[1] = 0x00;
- p_block->p_buffer[2] = 0x00;
- p_block->p_buffer[3] = 0x01;
- memcpy( &p_block->p_buffer[4], tk->p_buffer, i_size );
+ p_frame->p_buffer[0] = 0x00;
+ p_frame->p_buffer[1] = 0x00;
+ p_frame->p_buffer[2] = 0x00;
+ p_frame->p_buffer[3] = 0x01;
+ memcpy( &p_frame->p_buffer[4], tk->p_buffer, i_size );
if( tk->sub->rtpSource()->curPacketMarkerBit() )
- p_block->i_flags |= BLOCK_FLAG_AU_END;
+ p_frame->i_flags |= FRAME_FLAG_AU_END;
}
}
else if( tk->format == live_track_t::ASF_STREAM )
@@ -2087,11 +2088,16 @@ static void StreamRead( void *p_private, unsigned int i_size,
tk->sub->rtpSource()->curPacketMarkerBit(),
tk->p_buffer, i_size );
}
- else
+ else if( tk->format == live_track_t::MULTIPLEXED_STREAM )
{
- if( (p_block = block_Alloc( i_size )) )
+ if( (p_block = vlc_data_Alloc( i_size )) )
memcpy( p_block->p_buffer, tk->p_buffer, i_size );
}
+ else
+ {
+ if( (p_frame = vlc_frame_Alloc( i_size )) )
+ memcpy( p_frame->p_buffer, tk->p_buffer, i_size );
+ }
/* No data sent. Always in sync then */
if( !tk->b_rtcp_sync && tk->sub->rtpSource() &&
@@ -2101,7 +2107,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
p_sys->b_rtcp_sync = tk->b_rtcp_sync = true;
if( tk->i_pcr != VLC_TICK_INVALID )
{
- tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ tk->i_next_frame_flags |= FRAME_FLAG_DISCONTINUITY;
const vlc_tick_t i_max_diff = vlc_tick_from_sec(( tk->fmt.i_cat == SPU_ES ) ? 60 : 1);
tk->b_flushing_discontinuity = (llabs(i_pts - tk->i_pcr) > i_max_diff);
tk->i_pcr = i_pts;
@@ -2118,53 +2124,58 @@ static void StreamRead( void *p_private, unsigned int i_size,
{
switch( tk->format )
{
- case live_track_t::ASF_STREAM:
- vlc_demux_chained_Send( p_sys->p_out_asf, p_block );
- break;
- case live_track_t::MULTIPLEXED_STREAM:
- vlc_demux_chained_Send( tk->p_out_muxed, p_block );
- break;
- default:
- if( i_pts != tk->i_prevpts )
- {
- p_block->i_pts = VLC_TICK_0 + i_pts;
- tk->i_prevpts = i_pts;
+ case live_track_t::ASF_STREAM:
+ vlc_demux_chained_Send( p_sys->p_out_asf, p_block );
+ break;
+ case live_track_t::MULTIPLEXED_STREAM:
+ vlc_demux_chained_Send( tk->p_out_muxed, p_block );
+ break;
+ default:
+ msg_Err(p_demux,"Got block for not multiplex steam");
+ vlc_data_Release(p_block);
+ break;
+ }
+ }
+ else if( p_frame )
+ {
+ if( i_pts != tk->i_prevpts )
+ {
+ p_frame->i_pts = VLC_TICK_0 + i_pts;
+ tk->i_prevpts = i_pts;
- dtsgen_AddNextPTS( &tk->dtsgen, i_pts );
- }
+ dtsgen_AddNextPTS( &tk->dtsgen, i_pts );
+ }
- /*FIXME: for h264 you should check that packetization-mode=1 in sdp-file */
- switch( tk->fmt.i_codec )
- {
- case VLC_CODEC_MPGV:
- case VLC_CODEC_H264:
- case VLC_CODEC_HEVC:
- p_block->i_dts = dtsgen_GetDTS( &tk->dtsgen );
- dtsgen_Debug( VLC_OBJECT(p_demux), &tk->dtsgen, p_block->i_dts, p_block->i_pts );
- break;
- case VLC_CODEC_VP8:
- default:
- p_block->i_dts = VLC_TICK_0 + i_pts;
- break;
- }
+ /*FIXME: for h264 you should check that packetization-mode=1 in sdp-file */
+ switch( tk->fmt.i_codec )
+ {
+ case VLC_CODEC_MPGV:
+ case VLC_CODEC_H264:
+ case VLC_CODEC_HEVC:
+ p_frame->i_dts = dtsgen_GetDTS( &tk->dtsgen );
+ dtsgen_Debug( VLC_OBJECT(p_demux), &tk->dtsgen, p_frame->i_dts, p_frame->i_pts );
+ break;
+ case VLC_CODEC_VP8:
+ default:
+ p_frame->i_dts = VLC_TICK_0 + i_pts;
+ break;
+ }
- if( i_truncated_bytes )
- p_block->i_flags |= BLOCK_FLAG_CORRUPTED;
+ if( i_truncated_bytes )
+ p_frame->i_flags |= FRAME_FLAG_CORRUPTED;
- if( unlikely(tk->i_next_block_flags) )
- {
- p_block->i_flags |= tk->i_next_block_flags;
- tk->i_next_block_flags = 0;
- }
+ if( unlikely(tk->i_next_frame_flags) )
+ {
+ p_frame->i_flags |= tk->i_next_frame_flags;
+ tk->i_next_frame_flags = 0;
+ }
- vlc_tick_t i_pcr = p_block->i_dts > VLC_TICK_INVALID ? p_block->i_dts : p_block->i_pts;
- es_out_Send( p_demux->out, tk->p_es, p_block );
- if( i_pcr > VLC_TICK_INVALID )
- {
- if( tk->i_pcr < i_pcr )
- tk->i_pcr = i_pcr;
- }
- break;
+ vlc_tick_t i_pcr = p_frame->i_dts > VLC_TICK_INVALID ? p_frame->i_dts : p_frame->i_pts;
+ es_out_Send( p_demux->out, tk->p_es, p_frame );
+ if( i_pcr > VLC_TICK_INVALID )
+ {
+ if( tk->i_pcr < i_pcr )
+ tk->i_pcr = i_pcr;
}
}
@@ -2284,7 +2295,7 @@ static int ParseASF( demux_t *p_demux )
const char *psz_marker = "a=pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,";
char *psz_asf = strcasestr( p_sys->p_sdp, psz_marker );
char *psz_end;
- block_t *p_header;
+ vlc_data_t *p_header;
/* Parse the asf header */
if( psz_asf == NULL )
@@ -2304,7 +2315,7 @@ static int ParseASF( demux_t *p_demux )
}
/* Always smaller */
- p_header = block_Alloc( psz_end - psz_asf );
+ p_header = vlc_data_Alloc( psz_end - psz_asf );
p_header->i_buffer = vlc_b64_decode_binary_to_buffer( p_header->p_buffer,
p_header->i_buffer, psz_asf );
//msg_Dbg( p_demux, "Size=%d Hdrb64=%s", p_header->i_buffer, psz_asf );
diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index 1e458d6412..8e73280076 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -53,7 +53,7 @@
int MMSHOpen ( stream_t * );
void MMSHClose ( stream_t * );
-static block_t *Block( stream_t *p_access, bool * );
+static vlc_data_t *Block( stream_t *p_access, bool * );
static int Seek( stream_t *, uint64_t );
static int Control( stream_t *, int, va_list );
@@ -315,7 +315,7 @@ static int Seek( stream_t *p_access, uint64_t i_pos )
/*****************************************************************************
* Block:
*****************************************************************************/
-static block_t *Block( stream_t *p_access, bool *restrict eof )
+static vlc_data_t *Block( stream_t *p_access, bool *restrict eof )
{
access_sys_t *p_sys = p_access->p_sys;
const unsigned i_packet_min = p_sys->asfh.i_min_data_packet_size;
@@ -325,7 +325,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
const size_t i_offset = p_sys->i_position - p_sys->i_start;
const size_t i_copy = p_sys->i_header - i_offset;
- block_t *p_block = block_Alloc( i_copy );
+ vlc_data_t *p_block = vlc_data_Alloc( i_copy );
if( !p_block )
return NULL;
@@ -344,7 +344,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
if( __MAX( p_sys->i_packet_used, p_sys->i_packet_length ) < i_packet_min )
i_padding = i_packet_min - __MAX( p_sys->i_packet_used, p_sys->i_packet_length );
- block_t *p_block = block_Alloc( i_copy + i_padding );
+ vlc_data_t *p_block = vlc_data_Alloc( i_copy + i_padding );
if( !p_block )
return NULL;
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 0a6445c5aa..1dff54868e 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -66,7 +66,7 @@ int MMSTUOpen ( stream_t * );
void MMSTUClose ( stream_t * );
-static block_t *Block( stream_t *, bool * );
+static vlc_data_t *Block( stream_t *, bool * );
static int Seek( stream_t *, uint64_t );
static int Control( stream_t *, int, va_list );
@@ -422,7 +422,7 @@ static int Seek( stream_t * p_access, uint64_t i_pos )
/*****************************************************************************
* Block:
*****************************************************************************/
-static block_t *Block( stream_t *p_access, bool *restrict eof )
+static vlc_data_t *Block( stream_t *p_access, bool *restrict eof )
{
access_sys_t *p_sys = p_access->p_sys;
@@ -436,7 +436,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
{
const size_t i_copy = p_sys->i_header - p_sys->i_position;
- block_t *p_block = block_Alloc( i_copy );
+ vlc_data_t *p_block = vlc_data_Alloc( i_copy );
if( !p_block )
return NULL;
@@ -454,7 +454,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
if( __MAX( p_sys->i_media, p_sys->i_media_used ) < p_sys->i_packet_length )
i_padding = p_sys->i_packet_length - __MAX( p_sys->i_media, p_sys->i_media_used );
- block_t *p_block = block_Alloc( i_copy + i_padding );
+ vlc_data_t *p_block = vlc_data_Alloc( i_copy + i_padding );
if( !p_block )
return NULL;
diff --git a/modules/access/oss.c b/modules/access/oss.c
index 40327232e2..1c80e91b6a 100644
--- a/modules/access/oss.c
+++ b/modules/access/oss.c
@@ -95,7 +95,7 @@ static int DemuxControl( demux_t *, int, va_list );
static int Demux( demux_t * );
-static block_t* GrabAudio( demux_t *p_demux );
+static vlc_frame_t* GrabAudio( demux_t *p_demux );
static int OpenAudioDev( demux_t * );
static int OpenAudioDevOss( demux_t * );
@@ -117,7 +117,7 @@ typedef struct
unsigned int i_sample_rate;
bool b_stereo;
size_t i_max_frame_size;
- block_t *p_block;
+ vlc_frame_t *p_frame;
es_out_id_t *p_es;
vlc_tick_t i_next_demux_date; /* Used to handle oss:// as input-slave properly */
@@ -165,7 +165,7 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys->b_stereo = var_InheritBool( p_demux, CFG_PREFIX "stereo" );
p_sys->i_fd = -1;
p_sys->p_es = NULL;
- p_sys->p_block = NULL;
+ p_sys->p_frame = NULL;
p_sys->i_next_demux_date = -1;
if( p_demux->psz_location && *p_demux->psz_location )
@@ -193,7 +193,7 @@ static void DemuxClose( vlc_object_t *p_this )
if( p_sys->i_fd >= 0 )
vlc_close( p_sys->i_fd );
- if( p_sys->p_block ) block_Release( p_sys->p_block );
+ if( p_sys->p_frame ) vlc_frame_Release( p_sys->p_frame );
}
/*****************************************************************************
@@ -247,14 +247,14 @@ static int Demux( demux_t *p_demux )
fd.events = POLLIN|POLLPRI;
fd.revents = 0;
- block_t *p_block = NULL;
+ vlc_frame_t *p_frame = NULL;
do
{
- if( p_block )
+ if( p_frame )
{
- es_out_Send( p_demux->out, p_sys->p_es, p_block );
- p_block = NULL;
+ es_out_Send( p_demux->out, p_sys->p_es, p_frame );
+ p_frame = NULL;
}
/* Wait for data */
@@ -264,16 +264,16 @@ static int Demux( demux_t *p_demux )
continue;
if( fd.revents & (POLLIN|POLLPRI) )
{
- p_block = GrabAudio( p_demux );
- if( p_block )
- es_out_SetPCR( p_demux->out, p_block->i_pts );
+ p_frame = GrabAudio( p_demux );
+ if( p_frame )
+ es_out_SetPCR( p_demux->out, p_frame->i_pts );
}
}
- } while( p_block && p_sys->i_next_demux_date > 0 &&
- p_block->i_pts < p_sys->i_next_demux_date );
+ } while( p_frame && p_sys->i_next_demux_date > 0 &&
+ p_frame->i_pts < p_sys->i_next_demux_date );
- if( p_block )
- es_out_Send( p_demux->out, p_sys->p_es, p_block );
+ if( p_frame )
+ es_out_Send( p_demux->out, p_sys->p_es, p_frame );
return 1;
}
@@ -281,31 +281,31 @@ static int Demux( demux_t *p_demux )
/*****************************************************************************
* GrabAudio: Grab an audio frame
*****************************************************************************/
-static block_t* GrabAudio( demux_t *p_demux )
+static vlc_frame_t* GrabAudio( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
struct audio_buf_info buf_info;
int i_read = 0, i_correct;
- block_t *p_block;
+ vlc_frame_t *p_frame;
- if( p_sys->p_block ) p_block = p_sys->p_block;
- else p_block = block_Alloc( p_sys->i_max_frame_size );
+ if( p_sys->p_frame ) p_frame = p_sys->p_frame;
+ else p_frame = vlc_frame_Alloc( p_sys->i_max_frame_size );
- if( !p_block )
+ if( !p_frame )
{
- msg_Warn( p_demux, "cannot get block" );
+ msg_Warn( p_demux, "cannot get frame" );
return NULL;
}
- p_sys->p_block = p_block;
+ p_sys->p_frame = p_frame;
- i_read = read( p_sys->i_fd, p_block->p_buffer,
+ i_read = read( p_sys->i_fd, p_frame->p_buffer,
p_sys->i_max_frame_size );
if( i_read <= 0 ) return NULL;
- p_block->i_buffer = i_read;
- p_sys->p_block = NULL;
+ p_frame->i_buffer = i_read;
+ p_sys->p_frame = NULL;
/* Correct the date because of kernel buffering */
i_correct = i_read;
@@ -315,11 +315,11 @@ static block_t* GrabAudio( demux_t *p_demux )
}
/* Timestamp */
- p_block->i_pts = p_block->i_dts =
+ p_frame->i_pts = p_frame->i_dts =
vlc_tick_now() - vlc_tick_from_samples(i_correct,
2 * ( p_sys->b_stereo ? 2 : 1) * p_sys->i_sample_rate);
- return p_block;
+ return p_frame;
}
/*****************************************************************************
diff --git a/modules/access/pulse.c b/modules/access/pulse.c
index bcf3ae6b48..9d201267b4 100644
--- a/modules/access/pulse.c
+++ b/modules/access/pulse.c
@@ -57,7 +57,7 @@ typedef struct
pa_threaded_mainloop *mainloop; /**< PulseAudio thread */
es_out_id_t *es;
- bool discontinuity; /**< The next block will not follow the last one */
+ bool discontinuity; /**< The next frame will not follow the last one */
unsigned framesize; /**< Byte size of a sample */
vlc_tick_t caching; /**< Caching value */
} demux_sys_t;
@@ -178,17 +178,17 @@ static void stream_read_cb(pa_stream *s, size_t length, void *userdata)
if (unlikely(sys->es == NULL))
goto race;
- block_t *block = block_Alloc(length);
- if (likely(block != NULL)) {
- memcpy(block->p_buffer, ptr, length);
- block->i_nb_samples = samples;
- block->i_dts = block->i_pts = pts;
+ vlc_frame_t *frame = vlc_frame_Alloc(length);
+ if (likely(frame != NULL)) {
+ memcpy(frame->p_buffer, ptr, length);
+ frame->i_nb_samples = samples;
+ frame->i_dts = frame->i_pts = pts;
if (sys->discontinuity) {
- block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ frame->i_flags |= FRAME_FLAG_DISCONTINUITY;
sys->discontinuity = false;
}
- es_out_Send(demux->out, sys->es, block);
+ es_out_Send(demux->out, sys->es, frame);
} else
sys->discontinuity = true;
race:
diff --git a/modules/access/rdp.c b/modules/access/rdp.c
index 8a16a42038..56277d3806 100644
--- a/modules/access/rdp.c
+++ b/modules/access/rdp.c
@@ -107,7 +107,7 @@ typedef struct
{
vlc_thread_t thread;
freerdp *p_instance;
- block_t *p_block;
+ vlc_frame_t *p_frame;
int i_framebuffersize;
float f_fps;
@@ -178,10 +178,10 @@ static void desktopResizeHandler( rdpContext *p_context )
fmt.video.i_frame_rate = 1000 * p_sys->f_fps;
p_sys->i_framebuffersize = p_gdi->width * p_gdi->height * p_gdi->bytesPerPixel;
- if ( p_sys->p_block )
- p_sys->p_block = block_Realloc( p_sys->p_block, 0, p_sys->i_framebuffersize );
+ if ( p_sys->p_frame )
+ p_sys->p_frame = vlc_frame_Realloc( p_sys->p_frame, 0, p_sys->i_framebuffersize );
else
- p_sys->p_block = block_Alloc( p_sys->i_framebuffersize );
+ p_sys->p_frame = vlc_frame_Alloc( p_sys->i_framebuffersize );
p_sys->es = es_out_Add( p_vlccontext->p_demux->out, &fmt );
}
@@ -193,8 +193,8 @@ static void beginPaintHandler( rdpContext *p_context )
rdpGdi *p_gdi = p_context->gdi;
p_gdi->primary->hdc->hwnd->invalid->null = 1;
p_gdi->primary->hdc->hwnd->ninvalid = 0;
- if ( ! p_sys->p_block && p_sys->i_framebuffersize )
- p_sys->p_block = block_Alloc( p_sys->i_framebuffersize );
+ if ( ! p_sys->p_frame && p_sys->i_framebuffersize )
+ p_sys->p_frame = vlc_frame_Alloc( p_sys->i_framebuffersize );
}
static void endPaintHandler( rdpContext *p_context )
@@ -203,10 +203,10 @@ static void endPaintHandler( rdpContext *p_context )
demux_sys_t *p_sys = p_vlccontext->p_demux->p_sys;
rdpGdi *p_gdi = p_context->gdi;
- if ( p_sys->p_block )
+ if ( p_sys->p_frame )
{
- p_sys->p_block->i_buffer = p_sys->i_framebuffersize;
- memcpy( p_sys->p_block->p_buffer, p_gdi->primary_buffer, p_sys->p_block->i_buffer );
+ p_sys->p_frame->i_buffer = p_sys->i_framebuffersize;
+ memcpy( p_sys->p_frame->p_buffer, p_gdi->primary_buffer, p_sys->p_frame->i_buffer );
}
}
@@ -401,13 +401,13 @@ static void *DemuxThread( void *p_data )
p_sys->i_cancel_state = vlc_savecancel();
freerdp_check_fds( p_sys->p_instance );
vlc_restorecancel( p_sys->i_cancel_state );
- block_t *p_block = block_Duplicate( p_sys->p_block );
- if (likely( p_block && p_sys->p_block ))
+ vlc_frame_t *p_frame = vlc_frame_Duplicate( p_sys->p_frame );
+ if (likely( p_frame && p_sys->p_frame ))
{
- p_sys->p_block->i_dts = p_sys->p_block->i_pts = vlc_tick_now() - p_sys->i_starttime;
- es_out_SetPCR( p_demux->out, p_sys->p_block->i_pts );
- es_out_Send( p_demux->out, p_sys->es, p_sys->p_block );
- p_sys->p_block = p_block;
+ p_sys->p_frame->i_dts = p_sys->p_frame->i_pts = vlc_tick_now() - p_sys->i_starttime;
+ es_out_SetPCR( p_demux->out, p_sys->p_frame->i_pts );
+ es_out_Send( p_demux->out, p_sys->es, p_sys->p_frame );
+ p_sys->p_frame = p_frame;
}
}
}
@@ -512,8 +512,8 @@ static void Close( vlc_object_t *p_this )
freerdp_channels_global_uninit();
#endif
- 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->psz_hostname );
}
diff --git a/modules/access/rist.c b/modules/access/rist.c
index e06828c88a..a8cf2469bf 100644
--- a/modules/access/rist.c
+++ b/modules/access/rist.c
@@ -32,7 +32,7 @@
#include <vlc_access.h>
#include <vlc_threads.h>
#include <vlc_network.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_url.h>
#ifdef HAVE_POLL
#include <poll.h>
@@ -90,7 +90,7 @@ typedef struct
bool b_sendblindnacks;
bool b_disablenacks;
bool b_flag_discontinuity;
- block_fifo_t *p_fifo;
+ vlc_data_fifo_t *p_fifo;
vlc_mutex_t lock;
uint64_t last_message;
uint64_t last_reset;
@@ -266,7 +266,7 @@ static void send_rtcp_feedback(stream_t *p_access, struct rist_flow *flow)
buf = NULL;
}
-static void send_bbnack(stream_t *p_access, int fd_nack, block_t *pkt_nacks, uint16_t nack_count)
+static void send_bbnack(stream_t *p_access, int fd_nack, vlc_data_t *pkt_nacks, uint16_t nack_count)
{
stream_sys_t *p_sys = p_access->p_sys;
struct rist_flow *flow = p_sys->flow;
@@ -305,7 +305,7 @@ static void send_bbnack(stream_t *p_access, int fd_nack, block_t *pkt_nacks, uin
buf = NULL;
}
-static void send_rbnack(stream_t *p_access, int fd_nack, block_t *pkt_nacks, uint16_t nack_count)
+static void send_rbnack(stream_t *p_access, int fd_nack, vlc_data_t *pkt_nacks, uint16_t nack_count)
{
stream_sys_t *p_sys = p_access->p_sys;
struct rist_flow *flow = p_sys->flow;
@@ -359,7 +359,7 @@ static void send_nacks(stream_t *p_access, struct rist_flow *flow)
while(idx++ != flow->wi)
{
pkt = &(flow->buffer[idx]);
- if (pkt->buffer == NULL)
+ if (pkt->buffer.data == NULL)
{
if (nacks_len + 1 >= MAX_NACKS)
{
@@ -399,12 +399,12 @@ static void send_nacks(stream_t *p_access, struct rist_flow *flow)
if (nacks_len > 0)
{
p_sys->i_nack_packets += nacks_len;
- block_t *pkt_nacks = block_Alloc(nacks_len * 2);
+ vlc_data_t *pkt_nacks = vlc_data_Alloc(nacks_len * 2);
if (pkt_nacks)
{
memcpy(pkt_nacks->p_buffer, nacks, nacks_len * 2);
pkt_nacks->i_buffer = nacks_len * 2;
- block_FifoPut( p_sys->p_fifo, pkt_nacks );
+ vlc_data_FifoPut( p_sys->p_fifo, pkt_nacks );
}
}
}
@@ -660,17 +660,17 @@ static bool rist_input(stream_t *p_access, struct rist_flow *flow, uint8_t *buf,
/* Always replace the existing one with the new one */
struct rtp_pkt *pkt;
pkt = &(flow->buffer[idx]);
- if (pkt->buffer && pkt->buffer->i_buffer > 0)
+ if (pkt->buffer.data && pkt->buffer.data->i_buffer > 0)
{
- block_Release(pkt->buffer);
- pkt->buffer = NULL;
+ vlc_data_Release(pkt->buffer.data);
+ pkt->buffer.data = NULL;
}
- pkt->buffer = block_Alloc(len);
- if (!pkt->buffer)
+ pkt->buffer.data = vlc_data_Alloc(len);
+ if (!pkt->buffer.data)
return false;
- pkt->buffer->i_buffer = len;
- memcpy(pkt->buffer->p_buffer, buf, len);
+ pkt->buffer.data->i_buffer = len;
+ memcpy(pkt->buffer.data->p_buffer, buf, len);
pkt->rtp_ts = pkt_ts;
p_sys->last_data_rx = vlc_tick_now();
/* Reset the try counter regardless of wether it was a retransmit or not */
@@ -708,10 +708,10 @@ static bool rist_input(stream_t *p_access, struct rist_flow *flow, uint8_t *buf,
return success;
}
-static block_t *rist_dequeue(stream_t *p_access, struct rist_flow *flow)
+static vlc_data_t *rist_dequeue(stream_t *p_access, struct rist_flow *flow)
{
stream_sys_t *p_sys = p_access->p_sys;
- block_t *pktout = NULL;
+ vlc_data_t *pktout = NULL;
struct rtp_pkt *pkt;
uint16_t idx;
if (flow->ri == flow->wi || flow->reset > 0)
@@ -723,7 +723,7 @@ static block_t *rist_dequeue(stream_t *p_access, struct rist_flow *flow)
while(idx++ != flow->wi) {
pkt = &(flow->buffer[idx]);
- if (!pkt->buffer)
+ if (!pkt->buffer.data)
{
/*msg_Info(p_access, "Possible packet loss on index #%d", idx);*/
loss_amount++;
@@ -739,19 +739,19 @@ static block_t *rist_dequeue(stream_t *p_access, struct rist_flow *flow)
if (flow->hi_timestamp > (uint32_t)(pkt->rtp_ts + flow->rtp_latency))
{
/* Populate output packet now but remove rtp header from source */
- int newSize = pkt->buffer->i_buffer - RTP_HEADER_SIZE;
- pktout = block_Alloc(newSize);
+ int newSize = pkt->buffer.data->i_buffer - RTP_HEADER_SIZE;
+ pktout = vlc_data_Alloc(newSize);
if (pktout)
{
pktout->i_buffer = newSize;
- memcpy(pktout->p_buffer, pkt->buffer->p_buffer + RTP_HEADER_SIZE, newSize);
+ memcpy(pktout->p_buffer, pkt->buffer.data->p_buffer + RTP_HEADER_SIZE, newSize);
/* free the buffer and increase the read index */
flow->ri = idx;
/* TODO: calculate average duration using buffer average (bring from sender) */
found_data = true;
}
- block_Release(pkt->buffer);
- pkt->buffer = NULL;
+ vlc_data_Release(pkt->buffer.data);
+ pkt->buffer.data = NULL;
break;
}
@@ -777,7 +777,7 @@ static void *rist_thread(void *data)
/* Process nacks every 5ms */
/* We only ask for the relevant ones */
for (;;) {
- block_t *pkt_nacks = block_FifoGet(p_sys->p_fifo);
+ vlc_data_t *pkt_nacks = vlc_data_FifoGet(p_sys->p_fifo);
int canc = vlc_savecancel();
@@ -794,7 +794,7 @@ static void *rist_thread(void *data)
if (nack_count > 1)
msg_Dbg(p_access, "Sent %u NACKs !!!", nack_count);
- block_Release(pkt_nacks);
+ vlc_data_Release(pkt_nacks);
vlc_restorecancel (canc);
}
@@ -802,12 +802,12 @@ static void *rist_thread(void *data)
return NULL;
}
-static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
+static vlc_data_t *BlockRIST(stream_t *p_access, bool *restrict eof)
{
stream_sys_t *p_sys = p_access->p_sys;
uint64_t now;
*eof = false;
- block_t *pktout = NULL;
+ vlc_data_t *pktout = NULL;
struct pollfd pfd[3];
int ret;
ssize_t r;
@@ -1000,7 +1000,7 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
if (pktout)
{
if (p_sys->b_flag_discontinuity) {
- pktout->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ /* TODO insert discontinuity block */
p_sys->b_flag_discontinuity = false;
}
return pktout;
@@ -1014,7 +1014,7 @@ static void Clean( stream_t *p_access )
stream_sys_t *p_sys = p_access->p_sys;
if( likely(p_sys->p_fifo != NULL) )
- block_FifoRelease( p_sys->p_fifo );
+ vlc_data_FifoRelease( p_sys->p_fifo );
if (p_sys->flow)
{
@@ -1026,9 +1026,9 @@ static void Clean( stream_t *p_access )
net_Close (p_sys->flow->fd_rtcp_m);
for (int i=0; i<RIST_QUEUE_SIZE; i++) {
struct rtp_pkt *pkt = &(p_sys->flow->buffer[i]);
- if (pkt->buffer && pkt->buffer->i_buffer > 0) {
- block_Release(pkt->buffer);
- pkt->buffer = NULL;
+ if (pkt->buffer.data && pkt->buffer.data->i_buffer > 0) {
+ vlc_data_Release(pkt->buffer.data);
+ pkt->buffer.data = NULL;
}
}
free(p_sys->flow->buffer);
@@ -1105,7 +1105,7 @@ static int Open(vlc_object_t *p_this)
p_sys->flow->retry_interval = rtp_get_ts(VLC_TICK_FROM_MS(p_sys->flow->retry_interval));
p_sys->flow->reorder_buffer = rtp_get_ts(VLC_TICK_FROM_MS(p_sys->flow->reorder_buffer));
- p_sys->p_fifo = block_FifoNew();
+ p_sys->p_fifo = vlc_data_FifoNew();
if( unlikely(p_sys->p_fifo == NULL) )
goto failed;
diff --git a/modules/access/rist.h b/modules/access/rist.h
index ec0f6ae0f9..ae2987d556 100644
--- a/modules/access/rist.h
+++ b/modules/access/rist.h
@@ -65,7 +65,10 @@
struct rtp_pkt {
uint32_t rtp_ts;
- struct block_t *buffer;
+ union {
+ vlc_data_t * data;
+ vlc_frame_t * frame;
+ } buffer;
};
/* RIST NACK header format */
@@ -364,4 +367,4 @@ static bool is_multicast_address(char *psz_dst_server)
freeaddrinfo(res);
return ismulticast;
-}
\ No newline at end of file
+}
diff --git a/modules/access/rtp/input.c b/modules/access/rtp/input.c
index 4ab2cdcb2f..3bd61aa374 100644
--- a/modules/access/rtp/input.c
+++ b/modules/access/rtp/input.c
@@ -26,7 +26,6 @@
#include <vlc_common.h>
#include <vlc_demux.h>
-#include <vlc_block.h>
#include <vlc_network.h>
#include <limits.h>
@@ -49,40 +48,40 @@
/**
* Processes a packet received from the RTP socket.
*/
-static void rtp_process (demux_t *demux, block_t *block)
+static void rtp_process (demux_t *demux, vlc_frame_t *frame)
{
demux_sys_t *sys = demux->p_sys;
- if (block->i_buffer < 2)
+ if (frame->i_buffer < 2)
goto drop;
- const uint8_t ptype = rtp_ptype (block);
+ const uint8_t ptype = rtp_ptype (frame);
if (ptype >= 72 && ptype <= 76)
goto drop; /* Muxed RTCP, ignore for now FIXME */
#ifdef HAVE_SRTP
if (sys->srtp != NULL)
{
- size_t len = block->i_buffer;
- if (srtp_recv (sys->srtp, block->p_buffer, &len))
+ size_t len = frame->i_buffer;
+ if (srtp_recv (sys->srtp, frame->p_buffer, &len))
{
msg_Dbg (demux, "SRTP authentication/decryption failed");
goto drop;
}
- block->i_buffer = len;
+ frame->i_buffer = len;
}
#endif
/* TODO: use SDP and get rid of this hack */
if (unlikely(sys->autodetect))
{ /* Autodetect payload type, _before_ rtp_queue() */
- rtp_autodetect (demux, sys->session, block);
+ rtp_autodetect (demux, sys->session, frame);
sys->autodetect = false;
}
- rtp_queue (demux, sys->session, block);
+ rtp_queue (demux, sys->session, frame);
return;
drop:
- block_Release (block);
+ vlc_frame_Release (frame);
}
static int rtp_timeout (vlc_tick_t deadline)
@@ -145,8 +144,8 @@ void *rtp_dgram_thread (void *opaque)
if (unlikely(ufd[0].revents & POLLHUP))
break; /* RTP socket dead (DCCP only) */
- block_t *block = block_Alloc (iov.iov_len);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc (iov.iov_len);
+ if (unlikely(frame == NULL))
{
if (iov.iov_len == DEFAULT_MRU)
break; /* we are totallly screwed */
@@ -154,7 +153,7 @@ void *rtp_dgram_thread (void *opaque)
continue; /* retry with shrunk MRU */
}
- iov.iov_base = block->p_buffer;
+ iov.iov_base = frame->p_buffer;
msg.msg_flags = trunc_flag;
ssize_t len = recvmsg (rtp_fd, &msg, trunc_flag);
@@ -164,19 +163,19 @@ void *rtp_dgram_thread (void *opaque)
{
msg_Err(demux, "%zd bytes packet truncated (MRU was %zu)",
len, iov.iov_len);
- block->i_flags |= BLOCK_FLAG_CORRUPTED;
+ frame->i_flags |= FRAME_FLAG_CORRUPTED;
iov.iov_len = len;
}
else
- block->i_buffer = len;
+ frame->i_buffer = len;
- rtp_process (demux, block);
+ rtp_process (demux, frame);
}
else
{
msg_Warn (demux, "RTP network error: %s",
vlc_strerror_c(errno));
- block_Release (block);
+ vlc_frame_Release (frame);
}
}
@@ -207,22 +206,22 @@ void *rtp_stream_thread (void *opaque)
if (recv (fd, &frame_len, 2, MSG_WAITALL) != 2)
break;
- block_t *block = block_Alloc (ntohs (frame_len));
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc (ntohs (frame_len));
+ if (unlikely(frame == NULL))
break;
- block_cleanup_push (block);
- val = recv (fd, block->p_buffer, block->i_buffer, MSG_WAITALL);
+ vlc_frame_cleanup_push (frame);
+ val = recv (fd, frame->p_buffer, frame->i_buffer, MSG_WAITALL);
vlc_cleanup_pop ();
- if (val != (ssize_t)block->i_buffer)
+ if (val != (ssize_t)frame->i_buffer)
{
- block_Release (block);
+ vlc_frame_Release (frame);
break;
}
int canc = vlc_savecancel ();
- rtp_process (demux, block);
+ rtp_process (demux, frame);
rtp_dequeue_force (demux, sys->session);
vlc_restorecancel (canc);
}
diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index fc41e73df2..b85ac0f6d9 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <vlc_common.h>
+#include <vlc_data.h>
#include <vlc_demux.h>
#include <vlc_network.h>
#include <vlc_plugin.h>
@@ -439,16 +440,16 @@ void codec_destroy (demux_t *demux, void *data)
}
/* Send a packet to decoder */
-void codec_decode (demux_t *demux, void *data, block_t *block)
+void codec_decode (demux_t *demux, void *data, vlc_frame_t *frame)
{
if (data)
{
- block->i_dts = VLC_TICK_INVALID; /* RTP does not specify this */
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, (es_out_id_t *)data, block);
+ frame->i_dts = VLC_TICK_INVALID; /* RTP does not specify this */
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, (es_out_id_t *)data, frame);
}
else
- block_Release (block);
+ vlc_frame_Release (frame);
}
static void *stream_init (demux_t *demux, const char *name)
@@ -473,23 +474,52 @@ static void stream_destroy (demux_t *demux, void *data)
}
}
-static void stream_header (demux_t *demux, void *data, block_t *block)
+static void stream_header (demux_t *demux, void *data, vlc_frame_t *frame)
{
VLC_UNUSED(demux);
VLC_UNUSED(data);
- if(block->p_buffer[1] & 0x80) /* TS M-bit == discontinuity (RFC 2250, 2.1) */
+ if(frame->p_buffer[1] & 0x80) /* TS M-bit == discontinuity (RFC 2250, 2.1) */
{
- block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ frame->i_flags |= FRAME_FLAG_DISCONTINUITY;
}
}
+static void frame_to_data_Release(vlc_data_t * data)
+{
+ vlc_frame_t * frame = container_of(data->p_buffer, vlc_frame_t, p_buffer);
+ vlc_frame_Release(frame);
+ free(data);
+}
+
+static const struct vlc_data_callbacks frame_to_data_cbs =
+{
+ .free = frame_to_data_Release
+};
+
+static vlc_data_t * frame_to_data(vlc_frame_t * frame)
+{
+ vlc_data_t * data = malloc(sizeof(*data));
+ if (unlikely(data == NULL))
+ {
+ vlc_frame_Release(frame);
+ return NULL;
+ }
+ vlc_data_Init(data, &frame_to_data_cbs, frame->p_buffer, frame->i_buffer);
+ return data;
+}
+
/* Send a packet to a chained demuxer */
-static void stream_decode (demux_t *demux, void *data, block_t *block)
+static void stream_decode (demux_t *demux, void *data, vlc_frame_t *frame)
{
if (data)
+ {
+ vlc_data_t * block = frame_to_data(frame);
+ if (block == NULL)
+ return;
vlc_demux_chained_Send(data, block);
+ }
else
- block_Release (block);
+ vlc_frame_Release (frame);
(void)demux;
}
@@ -585,18 +615,18 @@ static void *mpa_init (demux_t *demux)
return codec_init (demux, &fmt);
}
-static void mpa_decode (demux_t *demux, void *data, block_t *block)
+static void mpa_decode (demux_t *demux, void *data, vlc_frame_t *frame)
{
- if (block->i_buffer < 4)
+ if (frame->i_buffer < 4)
{
- block_Release (block);
+ vlc_frame_Release (frame);
return;
}
- block->i_buffer -= 4; /* 32-bits RTP/MPA header */
- block->p_buffer += 4;
+ frame->i_buffer -= 4; /* 32-bits RTP/MPA header */
+ frame->p_buffer += 4;
- codec_decode (demux, data, block);
+ codec_decode (demux, data, frame);
}
@@ -612,24 +642,24 @@ static void *mpv_init (demux_t *demux)
return codec_init (demux, &fmt);
}
-static void mpv_decode (demux_t *demux, void *data, block_t *block)
+static void mpv_decode (demux_t *demux, void *data, vlc_frame_t *frame)
{
- if (block->i_buffer < 4)
+ if (frame->i_buffer < 4)
{
- block_Release (block);
+ vlc_frame_Release (frame);
return;
}
- block->i_buffer -= 4; /* 32-bits RTP/MPV header */
- block->p_buffer += 4;
+ frame->i_buffer -= 4; /* 32-bits RTP/MPV header */
+ frame->p_buffer += 4;
#if 0
- if (block->p_buffer[-3] & 0x4)
+ if (frame->p_buffer[-3] & 0x4)
{
/* MPEG2 Video extension header */
/* TODO: shouldn't we skip this too ? */
}
#endif
- codec_decode (demux, data, block);
+ codec_decode (demux, data, frame);
}
@@ -645,9 +675,9 @@ static void *ts_init (demux_t *demux)
/* Not using SDP, we need to guess the payload format used */
/* see http://www.iana.org/assignments/rtp-parameters */
void rtp_autodetect (demux_t *demux, rtp_session_t *session,
- const block_t *block)
+ const vlc_frame_t *frame)
{
- uint8_t ptype = rtp_ptype (block);
+ uint8_t ptype = rtp_ptype (frame);
rtp_pt_t pt = {
.init = NULL,
.destroy = codec_destroy,
diff --git a/modules/access/rtp/rtp.h b/modules/access/rtp/rtp.h
index fca75f58df..701c042b0b 100644
--- a/modules/access/rtp/rtp.h
+++ b/modules/access/rtp/rtp.h
@@ -30,30 +30,30 @@ struct rtp_pt_t
{
void *(*init) (demux_t *);
void (*destroy) (demux_t *, void *);
- void (*header) (demux_t *, void *, block_t *);
- void (*decode) (demux_t *, void *, block_t *);
+ void (*header) (demux_t *, void *, vlc_frame_t *);
+ void (*decode) (demux_t *, void *, vlc_frame_t *);
uint32_t frequency; /* RTP clock rate (Hz) */
uint8_t number;
};
-void rtp_autodetect (demux_t *, rtp_session_t *, const block_t *);
+void rtp_autodetect (demux_t *, rtp_session_t *, const vlc_frame_t *);
-static inline uint8_t rtp_ptype (const block_t *block)
+static inline uint8_t rtp_ptype (const vlc_frame_t *block)
{
return block->p_buffer[1] & 0x7F;
}
void *codec_init (demux_t *demux, es_format_t *fmt);
void codec_destroy (demux_t *demux, void *data);
-void codec_decode (demux_t *demux, void *data, block_t *block);
+void codec_decode (demux_t *demux, void *data, vlc_frame_t *block);
void *theora_init (demux_t *demux);
void xiph_destroy (demux_t *demux, void *data);
-void xiph_decode (demux_t *demux, void *data, block_t *block);
+void xiph_decode (demux_t *demux, void *data, vlc_frame_t *block);
/** @section RTP session */
rtp_session_t *rtp_session_create (demux_t *);
void rtp_session_destroy (demux_t *, rtp_session_t *);
-void rtp_queue (demux_t *, rtp_session_t *, block_t *);
+void rtp_queue (demux_t *, rtp_session_t *, vlc_frame_t *);
bool rtp_dequeue (demux_t *, const rtp_session_t *, vlc_tick_t *);
void rtp_dequeue_force (demux_t *, const rtp_session_t *);
int rtp_add_type (demux_t *demux, rtp_session_t *ses, const rtp_pt_t *pt);
diff --git a/modules/access/rtp/session.c b/modules/access/rtp/session.c
index 708ea61edf..e14283c607 100644
--- a/modules/access/rtp/session.c
+++ b/modules/access/rtp/session.c
@@ -96,10 +96,10 @@ static void no_destroy (demux_t *demux, void *opaque)
(void)demux; (void)opaque;
}
-static void no_decode (demux_t *demux, void *opaque, block_t *block)
+static void no_decode (demux_t *demux, void *opaque, vlc_frame_t *frame)
{
(void)demux; (void)opaque;
- block_Release (block);
+ vlc_frame_Release (frame);
}
/**
@@ -149,7 +149,7 @@ struct rtp_source_t
uint16_t max_seq; /* next expected sequence */
uint16_t last_seq; /* sequence of the next dequeued packet */
- block_t *blocks; /* re-ordered blocks queue */
+ vlc_frame_t *frames; /* re-ordered frames queue */
void *opaque[]; /* Per-source private payload data */
};
@@ -172,7 +172,7 @@ rtp_source_create (demux_t *demux, const rtp_session_t *session,
source->ref_ntp = UINT64_C (1) << 62;
source->max_seq = source->bad_seq = init_seq;
source->last_seq = init_seq - 1;
- source->blocks = NULL;
+ source->frames = NULL;
/* Initializes all payload */
for (unsigned i = 0; i < session->ptc; i++)
@@ -194,27 +194,27 @@ rtp_source_destroy (demux_t *demux, const rtp_session_t *session,
for (unsigned i = 0; i < session->ptc; i++)
session->ptv[i].destroy (demux, source->opaque[i]);
- block_ChainRelease (source->blocks);
+ vlc_frame_ChainRelease (source->frames);
free (source);
}
-static inline uint16_t rtp_seq (const block_t *block)
+static inline uint16_t rtp_seq (const vlc_frame_t *frame)
{
- assert (block->i_buffer >= 4);
- return GetWBE (block->p_buffer + 2);
+ assert (frame->i_buffer >= 4);
+ return GetWBE (frame->p_buffer + 2);
}
-static inline uint32_t rtp_timestamp (const block_t *block)
+static inline uint32_t rtp_timestamp (const vlc_frame_t *frame)
{
- assert (block->i_buffer >= 12);
- return GetDWBE (block->p_buffer + 4);
+ assert (frame->i_buffer >= 12);
+ return GetDWBE (frame->p_buffer + 4);
}
static const struct rtp_pt_t *
rtp_find_ptype (const rtp_session_t *session, rtp_source_t *source,
- const block_t *block, void **pt_data)
+ const vlc_frame_t *frame, void **pt_data)
{
- uint8_t ptype = rtp_ptype (block);
+ uint8_t ptype = rtp_ptype (frame);
for (unsigned i = 0; i < session->ptc; i++)
{
@@ -233,33 +233,33 @@ rtp_find_ptype (const rtp_session_t *session, rtp_source_t *source,
*
* @param demux VLC demux object
* @param session RTP session receiving the packet
- * @param block RTP packet including the RTP header
+ * @param frame RTP packet including the RTP header
*/
void
-rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
+rtp_queue (demux_t *demux, rtp_session_t *session, vlc_frame_t *frame)
{
demux_sys_t *p_sys = demux->p_sys;
/* RTP header sanity checks (see RFC 3550) */
- if (block->i_buffer < 12)
+ if (frame->i_buffer < 12)
goto drop;
- if ((block->p_buffer[0] >> 6 ) != 2) /* RTP version number */
+ if ((frame->p_buffer[0] >> 6 ) != 2) /* RTP version number */
goto drop;
/* Remove padding if present */
- if (block->p_buffer[0] & 0x20)
+ if (frame->p_buffer[0] & 0x20)
{
- uint8_t padding = block->p_buffer[block->i_buffer - 1];
- if ((padding == 0) || (block->i_buffer < (12u + padding)))
+ uint8_t padding = frame->p_buffer[frame->i_buffer - 1];
+ if ((padding == 0) || (frame->i_buffer < (12u + padding)))
goto drop; /* illegal value */
- block->i_buffer -= padding;
+ frame->i_buffer -= padding;
}
vlc_tick_t now = vlc_tick_now ();
rtp_source_t *src = NULL;
- const uint16_t seq = rtp_seq (block);
- const uint32_t ssrc = GetDWBE (block->p_buffer + 8);
+ const uint16_t seq = rtp_seq (frame);
+ const uint32_t ssrc = GetDWBE (frame->p_buffer + 8);
/* In most case, we know this source already */
for (unsigned i = 0, max = session->srcc; i < max; i++)
@@ -304,7 +304,7 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
}
else
{
- const rtp_pt_t *pt = rtp_find_ptype (session, src, block, NULL);
+ const rtp_pt_t *pt = rtp_find_ptype (session, src, frame, NULL);
if (pt != NULL)
{
@@ -312,7 +312,7 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
* That is computed from the RTP timestamps and the system clock.
* It is independent of RTP sequence. */
uint32_t freq = pt->frequency;
- int64_t ts = rtp_timestamp (block);
+ int64_t ts = rtp_timestamp (frame);
int64_t d = samples_from_vlc_tick(now - src->last_rx, freq);
d -= ts - src->last_ts;
if (d < 0) d = -d;
@@ -320,8 +320,8 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
}
}
src->last_rx = now;
- block->i_pts = now; /* store reception time until dequeued */
- src->last_ts = rtp_timestamp (block);
+ frame->i_pts = now; /* store reception time until dequeued */
+ src->last_ts = rtp_timestamp (frame);
/* Check sequence number */
/* NOTE: the sequence number is per-source,
@@ -337,8 +337,8 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
src->max_seq = src->bad_seq = seq + 1;
src->last_seq = seq - 0x7fffe; /* hack for rtp_decode() */
msg_Warn (demux, "sequence resynchronized");
- block_ChainRelease (src->blocks);
- src->blocks = NULL;
+ vlc_frame_ChainRelease (src->frames);
+ src->frames = NULL;
}
else
{
@@ -350,10 +350,10 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
if (delta_seq >= 0)
src->max_seq = seq + 1;
- /* Queues the block in sequence order,
+ /* Queues the frame in sequence order,
* hence there is a single queue for all payload types. */
- block_t **pp = &src->blocks;
- for (block_t *prev = *pp; prev != NULL; prev = *pp)
+ vlc_frame_t **pp = &src->frames;
+ for (vlc_frame_t *prev = *pp; prev != NULL; prev = *pp)
{
delta_seq = seq - rtp_seq (prev);
if (delta_seq < 0)
@@ -365,14 +365,14 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
}
pp = &prev->p_next;
}
- block->p_next = *pp;
- *pp = block;
+ frame->p_next = *pp;
+ *pp = frame;
/*rtp_decode (demux, session, src);*/
return;
drop:
- block_Release (block);
+ vlc_frame_Release (frame);
}
@@ -401,7 +401,7 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
for (unsigned i = 0, max = session->srcc; i < max; i++)
{
rtp_source_t *src = session->srcv[i];
- block_t *block;
+ vlc_frame_t *frame;
/* Because of IP packet delay variation (IPDV), we need to guesstimate
* how long to wait for a missing packet in the RTP sequence
@@ -419,10 +419,10 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
* LibVLC E/S-out clock synchronization. Here, we need to bother about
* re-ordering packets, as decoders can't cope with mis-ordered data.
*/
- while (((block = src->blocks)) != NULL)
+ while (((frame = src->frames)) != NULL)
{
- if ((int16_t)(rtp_seq (block) - (src->last_seq + 1)) <= 0)
- { /* Next (or earlier) block ready, no need to wait */
+ if ((int16_t)(rtp_seq (frame) - (src->last_seq + 1)) <= 0)
+ { /* Next (or earlier) frame ready, no need to wait */
rtp_decode (demux, session, src);
continue;
}
@@ -431,7 +431,7 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
* match for random gaussian jitter).
*/
vlc_tick_t deadline;
- const rtp_pt_t *pt = rtp_find_ptype (session, src, block, NULL);
+ const rtp_pt_t *pt = rtp_find_ptype (session, src, frame, NULL);
if (pt)
deadline = vlc_tick_from_samples(3 * src->jitter, pt->frequency);
else
@@ -442,11 +442,11 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
deadline = VLC_TICK_FROM_MS(25);
/* Additionnaly, we implicitly wait for the packetization time
- * multiplied by the number of missing packets. block is the first
+ * multiplied by the number of missing packets. frame is the first
* non-missing packet (lowest sequence number). We have no better
* estimated time of arrival, as we do not know the RTP timestamp
* of not yet received packets. */
- deadline += block->i_pts;
+ deadline += frame->i_pts;
if (now >= deadline)
{
rtp_decode (demux, session, src);
@@ -470,9 +470,9 @@ void rtp_dequeue_force (demux_t *demux, const rtp_session_t *session)
for (unsigned i = 0, max = session->srcc; i < max; i++)
{
rtp_source_t *src = session->srcv[i];
- block_t *block;
+ vlc_frame_t *frame;
- while (((block = src->blocks)) != NULL)
+ while (((frame = src->frames)) != NULL)
rtp_decode (demux, session, src);
}
}
@@ -483,73 +483,73 @@ void rtp_dequeue_force (demux_t *demux, const rtp_session_t *session)
static void
rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
{
- block_t *block = src->blocks;
+ vlc_frame_t *frame = src->frames;
- assert (block);
- src->blocks = block->p_next;
- block->p_next = NULL;
+ assert (frame);
+ src->frames = frame->p_next;
+ frame->p_next = NULL;
/* Discontinuity detection */
- uint16_t delta_seq = rtp_seq (block) - (src->last_seq + 1);
+ uint16_t delta_seq = rtp_seq (frame) - (src->last_seq + 1);
if (delta_seq != 0)
{
if (delta_seq >= 0x8000)
{ /* Trash too late packets (and PIM Assert duplicates) */
msg_Dbg (demux, "ignoring late packet (sequence: %"PRIu16")",
- rtp_seq (block));
+ rtp_seq (frame));
goto drop;
}
msg_Warn (demux, "%"PRIu16" packet(s) lost", delta_seq);
- block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+ frame->i_flags |= FRAME_FLAG_DISCONTINUITY;
}
- src->last_seq = rtp_seq (block);
+ src->last_seq = rtp_seq (frame);
/* Match the payload type */
void *pt_data;
- const rtp_pt_t *pt = rtp_find_ptype (session, src, block, &pt_data);
+ const rtp_pt_t *pt = rtp_find_ptype (session, src, frame, &pt_data);
if (pt == NULL)
{
msg_Dbg (demux, "unknown payload (%"PRIu8")",
- rtp_ptype (block));
+ rtp_ptype (frame));
goto drop;
}
if(pt->header)
- pt->header(demux, pt_data, block);
+ pt->header(demux, pt_data, frame);
/* Computes the PTS from the RTP timestamp and payload RTP frequency.
* DTS is unknown. Also, while the clock frequency depends on the payload
* format, a single source MUST only use payloads of a chosen frequency.
* Otherwise it would be impossible to compute consistent timestamps. */
- const uint32_t timestamp = rtp_timestamp (block);
- block->i_pts = src->ref_ntp
+ const uint32_t timestamp = rtp_timestamp (frame);
+ frame->i_pts = src->ref_ntp
+ vlc_tick_from_samples(timestamp - src->ref_rtp, pt->frequency);
/* TODO: proper inter-medias/sessions sync (using RTCP-SR) */
- src->ref_ntp = block->i_pts;
+ src->ref_ntp = frame->i_pts;
src->ref_rtp = timestamp;
/* CSRC count */
- size_t skip = 12u + (block->p_buffer[0] & 0x0F) * 4;
+ size_t skip = 12u + (frame->p_buffer[0] & 0x0F) * 4;
/* Extension header (ignored for now) */
- if (block->p_buffer[0] & 0x10)
+ if (frame->p_buffer[0] & 0x10)
{
skip += 4;
- if (block->i_buffer < skip)
+ if (frame->i_buffer < skip)
goto drop;
- skip += 4 * GetWBE (block->p_buffer + skip - 2);
+ skip += 4 * GetWBE (frame->p_buffer + skip - 2);
}
- if (block->i_buffer < skip)
+ if (frame->i_buffer < skip)
goto drop;
- block->p_buffer += skip;
- block->i_buffer -= skip;
+ frame->p_buffer += skip;
+ frame->i_buffer -= skip;
- pt->decode (demux, pt_data, block);
+ pt->decode (demux, pt_data, frame);
return;
drop:
- block_Release (block);
+ vlc_frame_Release (frame);
}
diff --git a/modules/access/rtp/xiph.c b/modules/access/rtp/xiph.c
index 8cdfcd4a57..2f1f957dc5 100644
--- a/modules/access/rtp/xiph.c
+++ b/modules/access/rtp/xiph.c
@@ -38,7 +38,7 @@
typedef struct rtp_xiph_t
{
es_out_id_t *id;
- block_t *block;
+ vlc_frame_t *frame;
uint32_t ident;
bool vorbis;
} rtp_xiph_t;
@@ -51,7 +51,7 @@ static void *xiph_init (bool vorbis)
return NULL;
self->id = NULL;
- self->block = NULL;
+ self->frame = NULL;
self->ident = 0xffffffff; /* impossible value on the wire */
self->vorbis = vorbis;
return self;
@@ -83,10 +83,10 @@ void xiph_destroy (demux_t *demux, void *data)
if (!data)
return;
- if (self->block)
+ if (self->frame)
{
- self->block->i_flags |= BLOCK_FLAG_CORRUPTED;
- codec_decode (demux, self->id, self->block);
+ self->frame->i_flags |= FRAME_FLAG_CORRUPTED;
+ codec_decode (demux, self->id, self->frame);
}
codec_destroy (demux, self->id);
free (self);
@@ -143,17 +143,17 @@ static ssize_t xiph_header (void **pextra, const uint8_t *buf, size_t len)
}
-void xiph_decode (demux_t *demux, void *data, block_t *block)
+void xiph_decode (demux_t *demux, void *data, vlc_frame_t *frame)
{
rtp_xiph_t *self = data;
- if (!data || block->i_buffer < 4)
+ if (!data || frame->i_buffer < 4)
goto drop;
/* 32-bits RTP header (§2.2) */
- uint32_t ident = GetDWBE (block->p_buffer);
- block->i_buffer -= 4;
- block->p_buffer += 4;
+ uint32_t ident = GetDWBE (frame->p_buffer);
+ frame->i_buffer -= 4;
+ frame->p_buffer += 4;
unsigned fragtype = (ident >> 6) & 3;
unsigned datatype = (ident >> 4) & 3;
@@ -161,76 +161,76 @@ void xiph_decode (demux_t *demux, void *data, block_t *block)
ident >>= 8;
/* RTP defragmentation */
- if (self->block && (block->i_flags & BLOCK_FLAG_DISCONTINUITY))
+ if (self->frame && (frame->i_flags & FRAME_FLAG_DISCONTINUITY))
{ /* Screwed! discontinuity within a fragmented packet */
msg_Warn (demux, self->vorbis ?
"discontinuity in fragmented Vorbis packet" :
"discontinuity in fragmented Theora packet");
- block_Release (self->block);
- self->block = NULL;
+ vlc_frame_Release (self->frame);
+ self->frame = NULL;
}
if (fragtype <= 1)
{
- if (self->block) /* Invalid first fragment */
+ if (self->frame) /* Invalid first fragment */
{
- block_Release (self->block);
- self->block = NULL;
+ vlc_frame_Release (self->frame);
+ self->frame = NULL;
}
}
else
{
- if (!self->block)
+ if (!self->frame)
goto drop; /* Invalid non-first fragment */
}
if (fragtype > 0)
{ /* Fragment */
- if (pkts > 0 || block->i_buffer < 2)
+ if (pkts > 0 || frame->i_buffer < 2)
goto drop;
- size_t fraglen = GetWBE (block->p_buffer);
- if (block->i_buffer < (fraglen + 2))
+ size_t fraglen = GetWBE (frame->p_buffer);
+ if (frame->i_buffer < (fraglen + 2))
goto drop; /* Invalid payload length */
- block->i_buffer = fraglen;
+ frame->i_buffer = fraglen;
if (fragtype == 1)/* Keep first fragment */
{
- block->i_buffer += 2;
- self->block = block;
+ frame->i_buffer += 2;
+ self->frame = frame;
}
else
{ /* Append non-first fragment */
- size_t len = self->block->i_buffer;
- self->block = block_Realloc (self->block, 0, len + fraglen);
- if (!self->block)
+ size_t len = self->frame->i_buffer;
+ self->frame = vlc_frame_Realloc (self->frame, 0, len + fraglen);
+ if (!self->frame)
{
- block_Release (block);
+ vlc_frame_Release (frame);
return;
}
- memcpy (self->block->p_buffer + len, block->p_buffer + 2,
+ memcpy (self->frame->p_buffer + len, frame->p_buffer + 2,
fraglen);
- block_Release (block);
+ vlc_frame_Release (frame);
}
if (fragtype < 3)
return; /* Non-last fragment */
/* Last fragment reached, process it */
- block = self->block;
- self->block = NULL;
- SetWBE (block->p_buffer, block->i_buffer - 2);
+ frame = self->frame;
+ self->frame = NULL;
+ SetWBE (frame->p_buffer, frame->i_buffer - 2);
pkts = 1;
}
/* RTP payload packets processing */
while (pkts > 0)
{
- if (block->i_buffer < 2)
+ if (frame->i_buffer < 2)
goto drop;
- size_t len = GetWBE (block->p_buffer);
- block->i_buffer -= 2;
- block->p_buffer += 2;
- if (block->i_buffer < len)
+ size_t len = GetWBE (frame->p_buffer);
+ frame->i_buffer -= 2;
+ frame->p_buffer += 2;
+ if (frame->i_buffer < len)
goto drop;
switch (datatype)
@@ -244,9 +244,9 @@ void xiph_decode (demux_t *demux, void *data, block_t *block)
"ignoring raw Theora payload without configuration");
break;
}
- block_t *raw = block_Alloc (len);
- memcpy (raw->p_buffer, block->p_buffer, len);
- raw->i_pts = block->i_pts; /* FIXME: what about pkts > 1 */
+ vlc_frame_t *raw = vlc_frame_Alloc (len);
+ memcpy (raw->p_buffer, frame->p_buffer, len);
+ raw->i_pts = frame->i_pts; /* FIXME: what about pkts > 1 */
codec_decode (demux, self->id, raw);
break;
}
@@ -257,7 +257,7 @@ void xiph_decode (demux_t *demux, void *data, block_t *block)
break; /* Ignore config retransmission */
void *extv;
- ssize_t extc = xiph_header (&extv, block->p_buffer, len);
+ ssize_t extc = xiph_header (&extv, frame->p_buffer, len);
if (extc < 0)
break;
@@ -278,11 +278,11 @@ void xiph_decode (demux_t *demux, void *data, block_t *block)
}
}
- block->i_buffer -= len;
- block->p_buffer += len;
+ frame->i_buffer -= len;
+ frame->p_buffer += len;
pkts--;
}
drop:
- block_Release (block);
+ vlc_frame_Release (frame);
}
diff --git a/modules/access/satip.c b/modules/access/satip.c
index c4e2446afa..3e1fcd790c 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -35,7 +35,6 @@
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_network.h>
-#include <vlc_block.h>
#include <vlc_rand.h>
#include <vlc_url.h>
#include <vlc_interrupt.h>
@@ -111,7 +110,7 @@ typedef struct
int cseq;
size_t fifo_size;
- block_fifo_t *fifo;
+ vlc_data_fifo_t *fifo;
vlc_thread_t thread;
uint16_t last_seq_nr;
@@ -345,15 +344,15 @@ static enum rtsp_result rtsp_handle(stream_t *access, bool *interrupted) {
#ifdef HAVE_RECVMMSG
static void satip_cleanup_blocks(void *data)
{
- block_t **input_blocks = data;
+ vlc_data_t **input_blocks = data;
for (size_t i = 0; i < VLEN; i++)
if (input_blocks[i] != NULL)
- block_Release(input_blocks[i]);
+ vlc_data_Release(input_blocks[i]);
}
#endif
-static int check_rtp_seq(stream_t *access, block_t *block)
+static int check_rtp_seq(stream_t *access, vlc_data_t *block)
{
access_sys_t *sys = access->p_sys;
uint16_t seq_nr = block->p_buffer[2] << 8 | block->p_buffer[3];
@@ -448,7 +447,7 @@ static void *satip_thread(void *data) {
#ifdef HAVE_RECVMMSG
struct mmsghdr msgs[VLEN];
struct iovec iovecs[VLEN];
- block_t *input_blocks[VLEN];
+ vlc_data_t *input_blocks[VLEN];
int retval;
for (size_t i = 0; i < VLEN; i++) {
@@ -472,7 +471,7 @@ static void *satip_thread(void *data) {
if (input_blocks[i] != NULL)
continue;
- input_blocks[i] = block_Alloc(RTSP_RECEIVE_BUFFER);
+ input_blocks[i] = vlc_data_Alloc(RTSP_RECEIVE_BUFFER);
if (unlikely(input_blocks[i] == NULL))
break;
@@ -487,7 +486,7 @@ static void *satip_thread(void *data) {
last_recv = vlc_tick_now();
for (int i = 0; i < retval; ++i) {
- block_t *block = input_blocks[i];
+ vlc_data_t *block = input_blocks[i];
len = msgs[i].msg_len;
if (check_rtp_seq(access, block))
@@ -495,36 +494,36 @@ static void *satip_thread(void *data) {
block->p_buffer += RTP_HEADER_SIZE;
block->i_buffer = len - RTP_HEADER_SIZE;
- block_FifoPut(sys->fifo, block);
+ vlc_data_FifoPut(sys->fifo, block);
input_blocks[i] = NULL;
}
#else
if (poll(&ufd, 1, 20) == -1)
continue;
- block_t *block = block_Alloc(RTSP_RECEIVE_BUFFER);
+ vlc_data_t *block = vlc_data_Alloc(RTSP_RECEIVE_BUFFER);
if (block == NULL) {
msg_Err(access, "Failed to allocate memory for input buffer");
break;
}
- block_cleanup_push(block);
+ vlc_data_cleanup_push(block);
len = recv(sock, block->p_buffer, RTSP_RECEIVE_BUFFER, 0);
vlc_cleanup_pop();
if (len < RTP_HEADER_SIZE) {
- block_Release(block);
+ vlc_data_Release(block);
continue;
}
if (check_rtp_seq(access, block)) {
- block_Release(block);
+ vlc_data_Release(block);
continue;
}
last_recv = vlc_tick_now();
block->p_buffer += RTP_HEADER_SIZE;
block->i_buffer = len - RTP_HEADER_SIZE;
- block_FifoPut(sys->fifo, block);
+ vlc_data_FifoPut(sys->fifo, block);
#endif
if (sys->keepalive_interval > 0 && vlc_tick_now() > next_keepalive) {
@@ -552,9 +551,9 @@ static void *satip_thread(void *data) {
return NULL;
}
-static block_t* satip_block(stream_t *access, bool *restrict eof) {
+static vlc_data_t* satip_block(stream_t *access, bool *restrict eof) {
access_sys_t *sys = access->p_sys;
- block_t *block;
+ vlc_data_t *block;
vlc_fifo_Lock(sys->fifo);
@@ -786,7 +785,7 @@ static int satip_open(vlc_object_t *obj)
goto error;
}
- sys->fifo = block_FifoNew();
+ sys->fifo = vlc_data_FifoNew();
if (!sys->fifo) {
msg_Err(access, "Failed to allocate block fifo.");
goto error;
@@ -813,7 +812,7 @@ error:
satip_teardown(access);
if (sys->fifo)
- block_FifoRelease(sys->fifo);
+ vlc_data_FifoRelease(sys->fifo);
if (sys->udp_sock >= 0)
net_Close(sys->udp_sock);
if (sys->rtcp_sock >= 0)
@@ -836,7 +835,7 @@ static void satip_close(vlc_object_t *obj)
satip_teardown(access);
- block_FifoRelease(sys->fifo);
+ vlc_data_FifoRelease(sys->fifo);
net_Close(sys->udp_sock);
net_Close(sys->rtcp_sock);
net_Close(sys->tcp_sock);
diff --git a/modules/access/screen/mac.c b/modules/access/screen/mac.c
index 7375f6306e..6e7eba8d6b 100644
--- a/modules/access/screen/mac.c
+++ b/modules/access/screen/mac.c
@@ -32,7 +32,7 @@
#endif
#import <vlc_common.h>
-#import <vlc_block.h>
+#import <vlc_frame.h>
#import "screen.h"
@@ -44,7 +44,7 @@ extern CGImageRef CGSCreateRegisteredCursorImage(int, char*, CGPoint*);
struct screen_data_t
{
- block_t *p_block;
+ vlc_frame_t *p_frame;
int width;
int height;
@@ -142,19 +142,19 @@ int screen_CloseCapture(demux_t *p_demux)
if (p_data->offscreen_bitmap)
free(p_data->offscreen_bitmap);
- if (p_data->p_block)
- block_Release(p_data->p_block);
+ if (p_data->p_frame)
+ vlc_frame_Release(p_data->p_frame);
free(p_data);
return VLC_SUCCESS;
}
-block_t *screen_Capture(demux_t *p_demux)
+vlc_frame_t *screen_Capture(demux_t *p_demux)
{
demux_sys_t *p_sys = p_demux->p_sys;
screen_data_t *p_data = (screen_data_t *)p_sys->p_data;
- block_t *p_block;
+ vlc_frame_t *p_frame;
CGRect capture_rect;
CGImageRef image;
@@ -226,17 +226,17 @@ block_t *screen_Capture(demux_t *p_demux)
CGContextDrawImage(p_data->offscreen_context, p_data->offscreen_rect, image);
CGContextDrawImage(p_data->offscreen_context, cursor_rect, cursor_image);
- /* build block */
- p_block = block_Alloc(p_data->offscreen_bitmap_size);
- if (!p_block) {
- msg_Warn(p_demux, "can't get block");
+ /* build frame */
+ p_frame = vlc_frame_Alloc(p_data->offscreen_bitmap_size);
+ if (!p_frame) {
+ msg_Warn(p_demux, "can't get frame");
CFRelease(image);
return NULL;
}
- memmove(p_block->p_buffer, p_data->offscreen_bitmap, p_data->offscreen_bitmap_size);
+ memmove(p_frame->p_buffer, p_data->offscreen_bitmap, p_data->offscreen_bitmap_size);
CFRelease(image);
- return p_block;
+ return p_frame;
}
diff --git a/modules/access/screen/screen.c b/modules/access/screen/screen.c
index 0c472deaa8..3e0bde1e7f 100644
--- a/modules/access/screen/screen.c
+++ b/modules/access/screen/screen.c
@@ -276,7 +276,7 @@ static void Close( vlc_object_t *p_this )
static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
- block_t *p_block;
+ vlc_frame_t *p_frame;
if( !p_sys->i_next_date ) p_sys->i_next_date = vlc_tick_now();
@@ -285,17 +285,17 @@ static int Demux( demux_t *p_demux )
p_sys->i_next_date += p_sys->i_incr;
vlc_tick_wait( p_sys->i_next_date );
- p_block = screen_Capture( p_demux );
- if( !p_block )
+ p_frame = screen_Capture( p_demux );
+ if( !p_frame )
{
p_sys->i_next_date += p_sys->i_incr;
return 1;
}
- p_block->i_dts = p_block->i_pts = p_sys->i_next_date;
+ p_frame->i_dts = p_frame->i_pts = p_sys->i_next_date;
- es_out_SetPCR( p_demux->out, p_block->i_pts );
- es_out_Send( p_demux->out, p_sys->es, p_block );
+ es_out_SetPCR( p_demux->out, p_frame->i_pts );
+ es_out_Send( p_demux->out, p_sys->es, p_frame );
p_sys->i_next_date += p_sys->i_incr;
diff --git a/modules/access/screen/screen.h b/modules/access/screen/screen.h
index 2a46c54e3a..936f0106b0 100644
--- a/modules/access/screen/screen.h
+++ b/modules/access/screen/screen.h
@@ -76,7 +76,7 @@ typedef struct
int screen_InitCapture ( demux_t * );
int screen_CloseCapture( demux_t * );
-block_t *screen_Capture( demux_t * );
+vlc_frame_t *screen_Capture( demux_t * );
#ifdef SCREEN_SUBSCREEN
void FollowMouse( demux_sys_t *, int, int );
diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c
index 07dc2c264d..fc5dfa98de 100644
--- a/modules/access/screen/wayland.c
+++ b/modules/access/screen/wayland.c
@@ -168,7 +168,7 @@ const struct screenshooter_listener screenshooter_cbs =
screenshooter_done_cb,
};
-static block_t *Shoot(demux_t *demux)
+static vlc_frame_t *Shoot(demux_t *demux)
{
demux_sys_t *sys = demux->p_sys;
@@ -182,7 +182,7 @@ static block_t *Shoot(demux_t *demux)
/* NOTE: one extra line for overflow if screen-left > 0 */
uint32_t pitch = 4u * sys->width;
size_t size = (pitch * (sys->height + 1) + sys->pagemask) & ~sys->pagemask;
- block_t *block = NULL;
+ vlc_frame_t *frame = NULL;
if (ftruncate(fd, size) < 0)
{
@@ -208,19 +208,19 @@ static block_t *Shoot(demux_t *demux)
wl_display_roundtrip(sys->display);
wl_buffer_destroy(buffer);
- block = block_File(fd, true);
+ frame = vlc_frame_File(fd, true);
- if (block != NULL)
+ if (frame != NULL)
{
size_t skip = (sys->y * sys->width + sys->x) * 4;
- block->p_buffer += skip;
- block->i_buffer -= skip;
+ frame->p_buffer += skip;
+ frame->i_buffer -= skip;
}
out:
vlc_close(fd);
- return block;
+ return frame;
}
static void cleanup_wl_display_read(void *data)
@@ -251,11 +251,11 @@ static void *Thread(void *data)
if (sys->es != NULL)
{
- block_t *block = Shoot(demux);
+ vlc_frame_t *frame = Shoot(demux);
- block->i_pts = block->i_dts = vlc_tick_now();
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send(demux->out, sys->es, block);
+ frame->i_pts = frame->i_dts = vlc_tick_now();
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send(demux->out, sys->es, frame);
}
while (wl_display_prepare_read(display) != 0)
diff --git a/modules/access/screen/win32.c b/modules/access/screen/win32.c
index f506e75c9b..e68ca56005 100644
--- a/modules/access/screen/win32.c
+++ b/modules/access/screen/win32.c
@@ -43,7 +43,7 @@ struct screen_data_t
int i_fragment_size;
int i_fragment;
- block_t *p_block;
+ vlc_frame_t *p_frame;
};
/*
@@ -170,7 +170,7 @@ int screen_CloseCapture( demux_t *p_demux )
demux_sys_t *p_sys = p_demux->p_sys;
screen_data_t *p_data = p_sys->p_data;
- if( p_data->p_block ) block_Release( p_data->p_block );
+ if( p_data->p_frame ) vlc_frame_Release( p_data->p_frame );
if( p_data->hgdi_backup)
SelectObject( p_data->hdc_dst, p_data->hgdi_backup );
@@ -182,28 +182,28 @@ int screen_CloseCapture( demux_t *p_demux )
return VLC_SUCCESS;
}
-struct block_sys_t
+struct frame_sys_t
{
- block_t self;
+ vlc_frame_t self;
HBITMAP hbmp;
};
-static void CaptureBlockRelease( block_t *p_block )
+static void CaptureFrameRelease( vlc_frame_t *p_frame )
{
- DeleteObject( ((struct block_sys_t *)p_block)->hbmp );
- free( p_block );
+ DeleteObject( ((struct frame_sys_t *)p_frame)->hbmp );
+ free( p_frame );
}
-static const struct vlc_block_callbacks CaptureBlockCallbacks =
+static const struct vlc_frame_callbacks CaptureFrameCallbacks =
{
- CaptureBlockRelease,
+ CaptureFrameRelease,
};
-static block_t *CaptureBlockNew( demux_t *p_demux )
+static vlc_frame_t *CaptureFrameNew( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
screen_data_t *p_data = p_sys->p_data;
- struct block_sys_t *p_block;
+ struct frame_sys_t *p_frame;
void *p_buffer;
int i_buffer;
HBITMAP hbmp;
@@ -232,7 +232,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
p_sys->f_fps *= (p_sys->fmt.video.i_height/p_data->i_fragment_size);
p_sys->i_incr = vlc_tick_rate_duration( p_sys->f_fps );
p_data->i_fragment = 0;
- p_data->p_block = 0;
+ p_data->p_frame = 0;
}
@@ -257,34 +257,34 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
goto error;
}
- /* Build block */
- if( !(p_block = malloc( sizeof( struct block_sys_t ) )) )
+ /* Build frame */
+ if( !(p_frame = malloc( sizeof( struct frame_sys_t ) )) )
goto error;
/* Fill all fields */
int i_stride =
( ( ( ( p_sys->fmt.video.i_width * p_sys->fmt.video.i_bits_per_pixel ) + 31 ) & ~31 ) >> 3 );
i_buffer = i_stride * p_sys->fmt.video.i_height;
- block_Init( &p_block->self, &CaptureBlockCallbacks, p_buffer, i_buffer );
- p_block->hbmp = hbmp;
+ vlc_frame_Init( &p_frame->self, &CaptureFrameCallbacks, p_buffer, i_buffer );
+ p_frame->hbmp = hbmp;
- return &p_block->self;
+ return &p_frame->self;
error:
if( hbmp ) DeleteObject( hbmp );
return NULL;
}
-block_t *screen_Capture( demux_t *p_demux )
+vlc_frame_t *screen_Capture( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
screen_data_t *p_data = p_sys->p_data;
if( !p_data->i_fragment )
{
- if( !( p_data->p_block = CaptureBlockNew( p_demux ) ) )
+ if( !( p_data->p_frame = CaptureFrameNew( p_demux ) ) )
{
- msg_Warn( p_demux, "cannot get block" );
+ msg_Warn( p_demux, "cannot get frame" );
return NULL;
}
}
@@ -316,9 +316,9 @@ block_t *screen_Capture( demux_t *p_demux )
if( !( p_data->i_fragment %
(p_sys->fmt.video.i_height/p_data->i_fragment_size) ) )
{
- block_t *p_block = p_data->p_block;
+ vlc_frame_t *p_frame = p_data->p_frame;
p_data->i_fragment = 0;
- p_data->p_block = 0;
+ p_data->p_frame = 0;
if( p_sys->p_mouse )
{
@@ -327,10 +327,10 @@ block_t *screen_Capture( demux_t *p_demux )
GetCursorPos( &pos );
FromScreenCoordinates( p_demux, &pos );
RenderCursor( p_demux, pos.x, pos.y,
- p_block->p_buffer );
+ p_frame->p_buffer );
}
- return p_block;
+ return p_frame;
}
return NULL;
diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index df7bd2e1b6..a0fe11808c 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -432,7 +432,7 @@ discard:
(sys->window != geo->root) ? sys->pixmap : sys->window;
free (geo);
- block_t *block = NULL;
+ vlc_frame_t *frame = NULL;
#if HAVE_SYS_SHM_H
if (sys->shm)
{ /* Capture screen through shared memory */
@@ -473,13 +473,13 @@ discard:
return;
}
- block = block_shm_Alloc (shm, size);
- if (unlikely(block == NULL))
+ frame = vlc_frame_shm_Alloc (shm, size);
+ if (unlikely(frame == NULL))
shmdt (shm);
}
noshm:
#endif
- if (block == NULL)
+ if (frame == NULL)
{ /* Capture screen through socket (fallback) */
xcb_get_image_reply_t *img;
@@ -491,23 +491,23 @@ noshm:
uint8_t *data = xcb_get_image_data (img);
size_t datalen = xcb_get_image_data_length (img);
- block = block_heap_Alloc (img, data + datalen - (uint8_t *)img);
- if (block == NULL)
+ frame = vlc_frame_heap_Alloc (img, data + datalen - (uint8_t *)img);
+ if (frame == NULL)
return;
- block->p_buffer = data;
- block->i_buffer = datalen;
+ frame->p_buffer = data;
+ frame->i_buffer = datalen;
}
- /* Send block - zero copy */
+ /* Send frame - zero copy */
if (sys->es != NULL)
{
- block->i_pts = block->i_dts = vlc_tick_now ();
+ frame->i_pts = frame->i_dts = vlc_tick_now ();
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
else
- block_Release (block);
+ vlc_frame_Release (frame);
}
static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
diff --git a/modules/access/sdi.c b/modules/access/sdi.c
index cd6a97a190..c076c4f6c1 100644
--- a/modules/access/sdi.c
+++ b/modules/access/sdi.c
@@ -77,7 +77,7 @@ void v210_convert(uint16_t *dst, const uint32_t *bytes, const int width, const i
}
#undef vanc_to_cc
-block_t *vanc_to_cc(vlc_object_t *obj, uint16_t *buf, size_t words)
+vlc_frame_t *vanc_to_cc(vlc_object_t *obj, uint16_t *buf, size_t words)
{
if (words < 3) {
msg_Err(obj, "VANC line too small (%zu words)", words);
@@ -190,7 +190,7 @@ block_t *vanc_to_cc(vlc_object_t *obj, uint16_t *buf, size_t words)
return NULL;
}
- block_t *cc = block_Alloc(cc_count * 3);
+ vlc_frame_t *cc = vlc_frame_Alloc(cc_count * 3);
for (size_t i = 0; i < cc_count; i++) {
cc->p_buffer[3*i+0] = cdp[9 + 3*i+0] /* & 3 */;
diff --git a/modules/access/sdi.h b/modules/access/sdi.h
index 7360bd9c43..0ba61fb3e3 100644
--- a/modules/access/sdi.h
+++ b/modules/access/sdi.h
@@ -23,13 +23,13 @@ extern "C" {
#endif
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <inttypes.h>
void v210_convert(uint16_t *dst, const uint32_t *bytes, const int width, const int height);
-block_t *vanc_to_cc(vlc_object_t *, uint16_t *, size_t);
+vlc_frame_t *vanc_to_cc(vlc_object_t *, uint16_t *, size_t);
#define vanc_to_cc(obj, buf, words) vanc_to_cc(VLC_OBJECT(obj), buf, words)
#ifdef __cplusplus
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 1b12bf6e92..b3e5dd5e45 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -324,14 +324,14 @@ static void DemuxFile (void *data)
demux_sys_t *sys = demux->p_sys;
/* Copy frame */
- block_t *block = block_File(sys->fd, true);
- if (block == NULL)
+ vlc_frame_t *frame = vlc_frame_File(sys->fd, true);
+ if (frame == NULL)
return;
- block->i_pts = block->i_dts = vlc_tick_now ();
+ frame->i_pts = frame->i_dts = vlc_tick_now ();
- /* Send block */
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ /* Send frame */
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
static void CloseFile (demux_sys_t *sys)
@@ -346,15 +346,15 @@ static void DemuxIPC (void *data)
demux_sys_t *sys = demux->p_sys;
/* Copy frame */
- block_t *block = block_Alloc (sys->mem.length);
- if (block == NULL)
+ vlc_frame_t *frame = vlc_frame_Alloc (sys->mem.length);
+ if (frame == NULL)
return;
- memcpy (block->p_buffer, sys->mem.addr, sys->mem.length);
- block->i_pts = block->i_dts = vlc_tick_now ();
+ memcpy (frame->p_buffer, sys->mem.addr, sys->mem.length);
+ frame->i_pts = frame->i_dts = vlc_tick_now ();
- /* Send block */
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ /* Send frame */
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
static void CloseIPC (demux_sys_t *sys)
diff --git a/modules/access/srt.c b/modules/access/srt.c
index ac73fbcebf..19807610f2 100644
--- a/modules/access/srt.c
+++ b/modules/access/srt.c
@@ -217,7 +217,7 @@ out:
return !failed;
}
-static block_t *BlockSRT(stream_t *p_stream, bool *restrict eof)
+static vlc_data_t *BlockSRT(stream_t *p_stream, bool *restrict eof)
{
stream_sys_t *p_sys = p_stream->p_sys;
int i_chunk_size = var_InheritInteger( p_stream, "chunk-size" );
@@ -237,7 +237,7 @@ static block_t *BlockSRT(stream_t *p_stream, bool *restrict eof)
size_t i_chunk_size_actual = ( i_chunk_size > 0 )
? i_chunk_size : SRT_DEFAULT_CHUNK_SIZE;
size_t bufsize = i_chunk_size_actual * p_sys->i_chunks;
- block_t *pkt = block_Alloc( bufsize );
+ vlc_data_t *pkt = vlc_data_Alloc( bufsize );
if ( unlikely( pkt == NULL ) )
{
return NULL;
@@ -323,7 +323,7 @@ static block_t *BlockSRT(stream_t *p_stream, bool *restrict eof)
out:
if (pkt->i_buffer == 0) {
- block_Release(pkt);
+ vlc_data_Release(pkt);
pkt = NULL;
}
diff --git a/modules/access/timecode.c b/modules/access/timecode.c
index d2c5819d84..8ae4c313c2 100644
--- a/modules/access/timecode.c
+++ b/modules/access/timecode.c
@@ -78,16 +78,16 @@ static int DemuxOnce (demux_t *demux, bool master)
if (len == -1)
return -1;
- block_t *block = block_heap_Alloc (str, len + 1);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_heap_Alloc (str, len + 1);
+ if (unlikely(frame == NULL))
return -1;
- block->i_buffer = len;
+ frame->i_buffer = len;
assert(str[len] == '\0');
- block->i_pts = block->i_dts = pts;
- block->i_length = date_Increment (&sys->date, 1) - pts;
- es_out_Send (demux->out, sys->es, block);
+ frame->i_pts = frame->i_dts = pts;
+ frame->i_length = date_Increment (&sys->date, 1) - pts;
+ es_out_Send (demux->out, sys->es, frame);
if (master)
es_out_SetPCR(demux->out, pts);
return 1;
diff --git a/modules/access/udp.c b/modules/access/udp.c
index 0443aec30d..10bb49b1af 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -40,7 +40,7 @@
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_network.h>
-#include <vlc_block.h>
+#include <vlc_data.h>
#include <vlc_interrupt.h>
#ifdef HAVE_POLL
# include <poll.h>
@@ -80,13 +80,13 @@ typedef struct
int fd;
int timeout;
size_t mtu;
- block_t *overflow_block;
+ vlc_data_t *overflow_block;
} access_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static block_t *BlockUDP( stream_t *, bool * );
+static vlc_data_t *BlockUDP( stream_t *, bool * );
static int Control( stream_t *, int, va_list );
/*****************************************************************************
@@ -109,7 +109,7 @@ static int Open( vlc_object_t *p_this )
/* Overflow can be max theoretical datagram content less anticipated MTU,
* IPv6 headers are larger than IPv4, ignore IPv6 jumbograms
*/
- sys->overflow_block = block_Alloc(65507 - sys->mtu);
+ sys->overflow_block = vlc_data_Alloc(65507 - sys->mtu);
if( unlikely( sys->overflow_block == NULL ) )
return VLC_ENOMEM;
@@ -192,7 +192,7 @@ static void Close( vlc_object_t *p_this )
stream_t *p_access = (stream_t*)p_this;
access_sys_t *sys = p_access->p_sys;
if( sys->overflow_block )
- block_Release( sys->overflow_block );
+ vlc_data_Release( sys->overflow_block );
net_Close( sys->fd );
}
@@ -228,11 +228,11 @@ static int Control( stream_t *p_access, int i_query, va_list args )
/*****************************************************************************
* BlockUDP:
*****************************************************************************/
-static block_t *BlockUDP(stream_t *access, bool *restrict eof)
+static vlc_data_t *BlockUDP(stream_t *access, bool *restrict eof)
{
access_sys_t *sys = access->p_sys;
- block_t *pkt = block_Alloc(sys->mtu);
+ vlc_data_t *pkt = vlc_data_Alloc(sys->mtu);
if (unlikely(pkt == NULL))
{ /* OOM - dequeue and discard one packet */
char dummy;
@@ -273,7 +273,7 @@ static block_t *BlockUDP(stream_t *access, bool *restrict eof)
if (len < 0)
{
skip:
- block_Release(pkt);
+ vlc_data_Release(pkt);
return NULL;
}
@@ -285,13 +285,13 @@ skip:
{
msg_Warn(access, "%zd bytes packet received (MTU was %zu), adjusting mtu",
len, sys->mtu);
- block_t *gather_block = sys->overflow_block;
+ vlc_data_t *gather_block = sys->overflow_block;
- sys->overflow_block = block_Alloc(65507 - len);
+ sys->overflow_block = vlc_data_Alloc(65507 - len);
gather_block->i_buffer = len - sys->mtu;
pkt->p_next = gather_block;
- pkt = block_ChainGather( pkt );
+ pkt = vlc_data_ChainGather( pkt );
sys->mtu = len;
}
diff --git a/modules/access/v4l2/access.c b/modules/access/v4l2/access.c
index d3c31385f0..3f8de8c04f 100644
--- a/modules/access/v4l2/access.c
+++ b/modules/access/v4l2/access.c
@@ -50,8 +50,8 @@ typedef struct
vlc_v4l2_ctrl_t *controls;
} access_sys_t;
-static block_t *MMapBlock (stream_t *, bool *);
-static block_t *ReadBlock (stream_t *, bool *);
+static vlc_data_t *MMapBlock (stream_t *, bool *);
+static vlc_data_t *ReadBlock (stream_t *, bool *);
static int AccessControl( stream_t *, int, va_list );
static int InitVideo(stream_t *, int, uint32_t);
@@ -145,17 +145,17 @@ int InitVideo (stream_t *access, int fd, uint32_t caps)
case V4L2_FIELD_INTERLACED:
msg_Dbg (access, "Interlacing setting: interleaved");
/*if (NTSC)
- sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ sys->block_flags = FRAME_FLAG_BOTTOM_FIELD_FIRST;
else*/
- sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+ sys->block_flags = FRAME_FLAG_TOP_FIELD_FIRST;
break;
case V4L2_FIELD_INTERLACED_TB:
msg_Dbg (access, "Interlacing setting: interleaved top bottom" );
- sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+ sys->block_flags = FRAME_FLAG_TOP_FIELD_FIRST;
break;
case V4L2_FIELD_INTERLACED_BT:
msg_Dbg (access, "Interlacing setting: interleaved bottom top" );
- sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ sys->block_flags = FRAME_FLAG_BOTTOM_FIELD_FIRST;
break;
default:
break;
@@ -210,38 +210,67 @@ static int AccessPoll (stream_t *access)
}
-static block_t *MMapBlock (stream_t *access, bool *restrict eof)
+static vlc_data_t *MMapBlock (stream_t *access, bool *restrict eof)
{
access_sys_t *sys = access->p_sys;
if (AccessPoll (access))
return NULL;
- block_t *block = GrabVideo (VLC_OBJECT(access), sys->fd, sys->bufv);
- if( block != NULL )
+ struct v4l2_buffer buf = {
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ .memory = V4L2_MEMORY_MMAP,
+ };
+
+ /* Wait for next frame */
+ if (v4l2_ioctl (sys->fd, VIDIOC_DQBUF, &buf) < 0)
+ {
+ switch (errno)
+ {
+ case EAGAIN:
+ return NULL;
+ case EIO:
+ /* Could ignore EIO, see spec. */
+ /* fall through */
+ default:
+ msg_Err (access, "dequeue error: %s", vlc_strerror_c(errno));
+ return NULL;
+ }
+ }
+
+ /* Copy frame */
+ vlc_data_t *data = vlc_data_Alloc (buf.bytesused);
+ if (unlikely(data == NULL))
+ return NULL;
+
+ memcpy (data->p_buffer, sys->bufv[buf.index].start, buf.bytesused);
+
+ /* Unlock */
+ if (v4l2_ioctl (sys->fd, VIDIOC_QBUF, &buf) < 0)
{
- block->i_pts = block->i_dts = vlc_tick_now();
- block->i_flags |= sys->block_flags;
+ msg_Err (access, "queue error: %s", vlc_strerror_c(errno));
+ vlc_data_Release (data);
+ return NULL;
}
(void) eof;
- return block;
+ return data;
}
-static block_t *ReadBlock (stream_t *access, bool *restrict eof)
+static vlc_data_t *ReadBlock (stream_t *access, bool *restrict eof)
{
access_sys_t *sys = access->p_sys;
if (AccessPoll (access))
return NULL;
- block_t *block = block_Alloc (sys->blocksize);
+ vlc_data_t *block = vlc_data_Alloc (sys->blocksize);
if (unlikely(block == NULL))
return NULL;
ssize_t val = v4l2_read (sys->fd, block->p_buffer, block->i_buffer);
if (val < 0)
{
- block_Release (block);
+ vlc_data_Release (block);
msg_Err (access, "cannot read buffer: %s", vlc_strerror_c(errno));
*eof = true;
return NULL;
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index 00f02ee76e..bebfeddc64 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -53,7 +53,7 @@ typedef struct
uint32_t bufc;
uint32_t blocksize;
};
- uint32_t block_flags;
+ uint32_t frame_flags;
es_out_id_t *es;
vlc_v4l2_ctrl_t *controls;
@@ -342,7 +342,7 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
msg_Dbg (demux, "%d bytes maximum for complete image",
fmt.fmt.pix.sizeimage);
/* Check interlacing */
- sys->block_flags = 0;
+ sys->frame_flags = 0;
switch (fmt.fmt.pix.field)
{
case V4L2_FIELD_NONE:
@@ -350,18 +350,18 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
break;
case V4L2_FIELD_TOP:
msg_Dbg (demux, "Interlacing setting: top field only");
- sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD;
+ sys->frame_flags = FRAME_FLAG_TOP_FIELD_FIRST|FRAME_FLAG_SINGLE_FIELD;
break;
case V4L2_FIELD_BOTTOM:
msg_Dbg (demux, "Interlacing setting: bottom field only");
- sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD;
+ sys->frame_flags = FRAME_FLAG_BOTTOM_FIELD_FIRST|FRAME_FLAG_SINGLE_FIELD;
break;
case V4L2_FIELD_INTERLACED:
msg_Dbg (demux, "Interlacing setting: interleaved");
/*if (NTSC)
- sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ sys->frame_flags = FRAME_FLAG_BOTTOM_FIELD_FIRST;
else*/
- sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+ sys->frame_flags = FRAME_FLAG_TOP_FIELD_FIRST;
break;
case V4L2_FIELD_SEQ_TB:
msg_Dbg (demux, "Interlacing setting: sequential top bottom (TODO)");
@@ -375,11 +375,11 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
break;
case V4L2_FIELD_INTERLACED_TB:
msg_Dbg (demux, "Interlacing setting: interleaved top bottom");
- sys->block_flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+ sys->frame_flags = FRAME_FLAG_TOP_FIELD_FIRST;
break;
case V4L2_FIELD_INTERLACED_BT:
msg_Dbg (demux, "Interlacing setting: interleaved bottom top");
- sys->block_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+ sys->frame_flags = FRAME_FLAG_BOTTOM_FIELD_FIRST;
break;
default:
msg_Warn (demux, "Interlacing setting: unknown type (%d)",
@@ -558,7 +558,7 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
{
/* In principles, mmap() will pad the length to a multiple of the
* page size, so there is no need to care. Nevertheless with the
- * page size, block->i_size can be set optimally. */
+ * page size, frame->i_size can be set optimally. */
const long pagemask = sysconf (_SC_PAGE_SIZE) - 1;
sys->blocksize = (fmt.fmt.pix.sizeimage + pagemask) & ~pagemask;
@@ -635,7 +635,7 @@ void DemuxClose( vlc_object_t *obj )
}
/** Allocates and queue a user buffer using mmap(). */
-static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
+static vlc_frame_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
{
void *ptr = mmap (NULL, length, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -646,8 +646,8 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
return NULL;
}
- block_t *block = block_mmap_Alloc (ptr, length);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_mmap_Alloc (ptr, length);
+ if (unlikely(frame == NULL))
{
munmap (ptr, length);
return NULL;
@@ -665,10 +665,10 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0)
{
msg_Err (obj, "cannot queue buffer: %s", vlc_strerror_c(errno));
- block_Release (block);
+ vlc_frame_Release (frame);
return NULL;
}
- return block;
+ return frame;
}
static void *UserPtrThread (void *data)
@@ -689,13 +689,13 @@ static void *UserPtrThread (void *data)
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
.memory = V4L2_MEMORY_USERPTR,
};
- block_t *block = UserPtrQueue (VLC_OBJECT(demux), fd, sys->blocksize);
- if (block == NULL)
+ vlc_frame_t *frame = UserPtrQueue (VLC_OBJECT(demux), fd, sys->blocksize);
+ if (frame == NULL)
break;
/* Wait for data */
vlc_restorecancel (canc);
- block_cleanup_push (block);
+ vlc_frame_cleanup_push (frame);
while (poll (ufd, numfds, -1) == -1)
if (errno != EINTR)
msg_Err (demux, "poll error: %s", vlc_strerror_c(errno));
@@ -706,16 +706,16 @@ static void *UserPtrThread (void *data)
{
msg_Err (demux, "cannot dequeue buffer: %s",
vlc_strerror_c(errno));
- block_Release (block);
+ vlc_frame_Release (frame);
continue;
}
- assert (block->p_buffer == (void *)buf.m.userptr);
- block->i_buffer = buf.length;
- block->i_pts = block->i_dts = GetBufferPTS (&buf);
- block->i_flags |= sys->block_flags;
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ assert (frame->p_buffer == (void *)buf.m.userptr);
+ frame->i_buffer = buf.length;
+ frame->i_pts = frame->i_dts = GetBufferPTS (&buf);
+ frame->i_flags |= sys->frame_flags;
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
vlc_restorecancel (canc); /* <- hmm, this is purely cosmetic */
return NULL;
@@ -754,12 +754,12 @@ static void *MmapThread (void *data)
if( ufd[0].revents )
{
int canc = vlc_savecancel ();
- block_t *block = GrabVideo (VLC_OBJECT(demux), fd, sys->bufv);
- if (block != NULL)
+ vlc_frame_t *frame = GrabVideo (VLC_OBJECT(demux), fd, sys->bufv);
+ if (frame != NULL)
{
- block->i_flags |= sys->block_flags;
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ frame->i_flags |= sys->frame_flags;
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
vlc_restorecancel (canc);
}
@@ -804,26 +804,26 @@ static void *ReadThread (void *data)
if( ufd[0].revents )
{
- block_t *block = block_Alloc (sys->blocksize);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc (sys->blocksize);
+ if (unlikely(frame == NULL))
{
msg_Err (demux, "read error: %s", vlc_strerror_c(errno));
v4l2_read (fd, NULL, 0); /* discard frame */
continue;
}
- block->i_pts = block->i_dts = vlc_tick_now ();
- block->i_flags |= sys->block_flags;
+ frame->i_pts = frame->i_dts = vlc_tick_now ();
+ frame->i_flags |= sys->frame_flags;
int canc = vlc_savecancel ();
- ssize_t val = v4l2_read (fd, block->p_buffer, block->i_buffer);
+ ssize_t val = v4l2_read (fd, frame->p_buffer, frame->i_buffer);
if (val != -1)
{
- block->i_buffer = val;
- es_out_SetPCR(demux->out, block->i_pts);
- es_out_Send (demux->out, sys->es, block);
+ frame->i_buffer = val;
+ es_out_SetPCR(demux->out, frame->i_pts);
+ es_out_Send (demux->out, sys->es, frame);
}
else
- block_Release (block);
+ vlc_frame_Release (frame);
vlc_restorecancel (canc);
}
#ifdef ZVBI_COMPILED
diff --git a/modules/access/v4l2/v4l2.h b/modules/access/v4l2/v4l2.h
index c8ebd7b15e..d6ee83a031 100644
--- a/modules/access/v4l2/v4l2.h
+++ b/modules/access/v4l2/v4l2.h
@@ -56,7 +56,7 @@ struct buffer_t *StartMmap (vlc_object_t *, int, uint32_t *);
void StopMmap (int, struct buffer_t *, uint32_t);
vlc_tick_t GetBufferPTS (const struct v4l2_buffer *);
-block_t* GrabVideo (vlc_object_t *, int, const struct buffer_t *);
+vlc_frame_t* GrabVideo (vlc_object_t *, int, const struct buffer_t *);
#ifdef ZVBI_COMPILED
/* vbi.c */
diff --git a/modules/access/v4l2/vbi.c b/modules/access/v4l2/vbi.c
index d645cdfcbf..622d6ea76a 100644
--- a/modules/access/v4l2/vbi.c
+++ b/modules/access/v4l2/vbi.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include <fcntl.h>
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include <vlc_fs.h>
#include <vlc_demux.h>
@@ -123,11 +123,11 @@ void GrabVBI (demux_t *p_demux, vlc_v4l2_vbi_t *vbi)
int sliced_size = 2; /* Number of bytes per sliced line */
int size = (sliced_size + 1) * n_lines;
- block_t *p_block = block_Alloc (size);
- if (unlikely(p_block == NULL))
+ vlc_frame_t *p_frame = vlc_frame_Alloc (size);
+ if (unlikely(p_frame == NULL))
break;
- uint8_t* data = p_block->p_buffer;
+ uint8_t* data = p_frame->p_buffer;
vbi_sliced *sliced_array = sliced_bytes->data;
for (int field = 0; field < n_lines; field++)
{
@@ -136,18 +136,18 @@ void GrabVBI (demux_t *p_demux, vlc_v4l2_vbi_t *vbi)
memcpy(data, sliced_array[field].data, sliced_size);
data += sliced_size;
}
- p_block->i_pts = vlc_tick_now();
+ p_frame->i_pts = vlc_tick_now();
for (unsigned i = 0; i < VBI_NUM_CC_STREAMS; i++)
{
if (vbi->es[i] == NULL)
continue;
- block_t *dup = block_Duplicate(p_block);
+ vlc_frame_t *dup = vlc_frame_Duplicate(p_frame);
if (likely(dup != NULL))
es_out_Send(p_demux->out, vbi->es[i], dup);
}
- block_Release(p_block);
+ vlc_frame_Release(p_frame);
}
}
vlc_restorecancel (canc);
diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 4a4802368b..61661ffaed 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -34,7 +34,7 @@
#include <sys/mman.h>
#include <vlc_common.h>
-#include <vlc_block.h>
+#include <vlc_frame.h>
#include "v4l2.h"
@@ -580,7 +580,7 @@ vlc_tick_t GetBufferPTS (const struct v4l2_buffer *buf)
/*****************************************************************************
* GrabVideo: Grab a video frame
*****************************************************************************/
-block_t *GrabVideo (vlc_object_t *demux, int fd,
+vlc_frame_t *GrabVideo (vlc_object_t *demux, int fd,
const struct buffer_t *restrict bufv)
{
struct v4l2_buffer buf = {
@@ -605,20 +605,20 @@ block_t *GrabVideo (vlc_object_t *demux, int fd,
}
/* Copy frame */
- block_t *block = block_Alloc (buf.bytesused);
- if (unlikely(block == NULL))
+ vlc_frame_t *frame = vlc_frame_Alloc (buf.bytesused);
+ if (unlikely(frame == NULL))
return NULL;
- block->i_pts = block->i_dts = GetBufferPTS (&buf);
- memcpy (block->p_buffer, bufv[buf.index].start, buf.bytesused);
+ frame->i_pts = frame->i_dts = GetBufferPTS (&buf);
+ memcpy (frame->p_buffer, bufv[buf.index].start, buf.bytesused);
/* Unlock */
if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0)
{
msg_Err (demux, "queue error: %s", vlc_strerror_c(errno));
- block_Release (block);
+ vlc_frame_Release (frame);
return NULL;
}
- return block;
+ return frame;
}
/**
diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c
index 86fd68004c..8e22fc5c78 100644
--- a/modules/access/vcd/vcd.c
+++ b/modules/access/vcd/vcd.c
@@ -81,7 +81,7 @@ typedef struct
int *p_sectors; /* Track sectors */
} access_sys_t;
-static block_t *Block( stream_t *, bool * );
+static vlc_data_t *Block( stream_t *, bool * );
static int Seek( stream_t *, uint64_t );
static int Control( stream_t *, int, va_list );
static int EntryPoints( stream_t * );
@@ -328,11 +328,11 @@ static int Control( stream_t *p_access, int i_query, va_list args )
/*****************************************************************************
* Block:
*****************************************************************************/
-static block_t *Block( stream_t *p_access, bool *restrict eof )
+static vlc_data_t *Block( stream_t *p_access, bool *restrict eof )
{
access_sys_t *p_sys = p_access->p_sys;
int i_blocks = VCD_BLOCKS_ONCE;
- block_t *p_block;
+ vlc_data_t *p_block;
/* Check end of title */
while( p_sys->i_sector >= p_sys->p_sectors[p_sys->i_current_title + 2] )
@@ -356,7 +356,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
}
/* Do the actual reading */
- if( i_blocks < 0 || !( p_block = block_Alloc( i_blocks * VCD_DATA_SIZE ) ) )
+ if( i_blocks < 0 || !( p_block = vlc_data_Alloc( i_blocks * VCD_DATA_SIZE ) ) )
{
msg_Err( p_access, "cannot get a new block of size: %i",
i_blocks * VCD_DATA_SIZE );
@@ -367,7 +367,7 @@ static block_t *Block( stream_t *p_access, bool *restrict eof )
p_sys->i_sector, p_block->p_buffer, i_blocks, VCD_TYPE ) < 0 )
{
msg_Err( p_access, "cannot read sector %i", p_sys->i_sector );
- block_Release( p_block );
+ vlc_data_Release( p_block );
/* Try to skip one sector (in case of bad sectors) */
p_sys->offset += VCD_DATA_SIZE;
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index 8dcd05c228..26990e2e6f 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -118,7 +118,7 @@ typedef struct
rfbClient* p_client;
int i_framebuffersize;
- block_t *p_block;
+ vlc_frame_t *p_frame;
float f_fps;
int i_frame_interval;
@@ -190,14 +190,14 @@ static rfbBool mallocFrameBufferHandler( rfbClient* p_client )
/* Set up framebuffer */
p_sys->i_framebuffersize = i_width * i_height * i_depth / 8;
- /* Reuse unsent block */
- if ( p_sys->p_block )
- p_sys->p_block = block_Realloc( p_sys->p_block, 0, p_sys->i_framebuffersize );
+ /* Reuse unsent frame */
+ if ( p_sys->p_frame )
+ p_sys->p_frame = vlc_frame_Realloc( p_sys->p_frame, 0, p_sys->i_framebuffersize );
else
- p_sys->p_block = block_Alloc( p_sys->i_framebuffersize );
+ p_sys->p_frame = vlc_frame_Alloc( p_sys->i_framebuffersize );
- if ( p_sys->p_block )
- p_sys->p_block->i_buffer = p_sys->i_framebuffersize;
+ if ( p_sys->p_frame )
+ p_sys->p_frame->i_buffer = p_sys->i_framebuffersize;
else
return FALSE;
@@ -355,7 +355,7 @@ static void *DemuxThread( void *p_data )
if ( i_status > 0 )
{
- p_sys->p_client->frameBuffer = p_sys->p_block->p_buffer;
+ p_sys->p_client->frameBuffer = p_sys->p_frame->p_buffer;
p_sys->i_cancel_state = vlc_savecancel();
i_status = HandleRFBServerMessage( p_sys->p_client );
vlc_restorecancel( p_sys->i_cancel_state );
@@ -368,13 +368,13 @@ static void *DemuxThread( void *p_data )
}
else
{
- block_t *p_block = block_Duplicate( p_sys->p_block );
- if ( p_block ) /* drop frame/content if no next block */
+ vlc_frame_t *p_frame = vlc_frame_Duplicate( p_sys->p_frame );
+ if ( p_frame ) /* drop frame/content if no next frame */
{
- p_sys->p_block->i_dts = p_sys->p_block->i_pts = vlc_tick_now();
- es_out_SetPCR( p_demux->out, p_sys->p_block->i_pts );
- es_out_Send( p_demux->out, p_sys->es, p_sys->p_block );
- p_sys->p_block = p_block;
+ p_sys->p_frame->i_dts = p_sys->p_frame->i_pts = vlc_tick_now();
+ es_out_SetPCR( p_demux->out, p_sys->p_frame->i_pts );
+ es_out_Send( p_demux->out, p_sys->es, p_sys->p_frame );
+ p_sys->p_frame = p_frame;
}
}
}
@@ -504,6 +504,6 @@ static void Close( vlc_object_t *p_this )
rfbClientCleanup( p_sys->p_client );
- if ( p_sys->p_block )
- block_Release( p_sys->p_block );
+ if ( p_sys->p_frame )
+ vlc_frame_Release( p_sys->p_frame );
}
diff --git a/modules/access/wasapi.c b/modules/access/wasapi.c
index 9f06c792c2..518986546d 100644
--- a/modules/access/wasapi.c
+++ b/modules/access/wasapi.c
@@ -329,13 +329,13 @@ static unsigned __stdcall Thread(void *data)
es_out_SetPCR(demux->out, pts);
size_t bytes = frames * sys->frame_size;
- block_t *block = block_Alloc(bytes);
+ vlc_frame_t *frame = vlc_frame_Alloc(bytes);
- if (likely(block != NULL)) {
- memcpy(block->p_buffer, buf, bytes);
- block->i_nb_samples = frames;
- block->i_pts = block->i_dts = pts;
- es_out_Send(demux->out, sys->es, block);
+ if (likely(frame != NULL)) {
+ memcpy(frame->p_buffer, buf, bytes);
+ frame->i_nb_samples = frames;
+ frame->i_pts = frame->i_dts = pts;
+ es_out_Send(demux->out, sys->es, frame);
}
IAudioCaptureClient_ReleaseBuffer(capture, frames);
--
2.20.1
More information about the vlc-devel
mailing list