From 8b03f6e1d25c39d894fb8e22f11e50afb62b3899 Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Mon, 19 Aug 2002 17:17:00 +0000 Subject: sync to libdvdnav cvs - update clut and spu/audio channel more often - align read cache in memory to allow use of raw devices CVS patchset: 2483 CVS date: 2002/08/19 17:17:00 --- src/input/libdvdnav/dvdnav.c | 13 +++++++++++-- src/input/libdvdnav/read_cache.c | 19 ++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/input/libdvdnav/dvdnav.c b/src/input/libdvdnav/dvdnav.c index 67013286f..206420653 100644 --- a/src/input/libdvdnav/dvdnav.c +++ b/src/input/libdvdnav/dvdnav.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvdnav.c,v 1.3 2002/08/09 22:52:14 mroi Exp $ + * $Id: dvdnav.c,v 1.4 2002/08/19 17:17:00 mroi Exp $ * */ @@ -567,7 +567,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf, #ifdef LOG_DEBUG fprintf(stderr,"libdvdnav:SPU_CLUT_CHANGE\n"); #endif - (*len) = sizeof(dvdnav_still_event_t); + (*len) = 16 * sizeof(uint32_t); memcpy(*buf, &(state->pgc->palette), 16 * sizeof(uint32_t)); this->spu_clut_changed = 0; #ifdef LOG_DEBUG @@ -754,6 +754,10 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf, this->vobu.vobu_length = 0; this->vobu.blockN = this->vobu.vobu_length + 1; /* Make blockN > vobu_next to do expected_nav */ + /* update the spu palette on PGC changes */ + this->spu_clut_changed = 1; + this->position_current.spu_channel = -1; /* Force an update */ + this->position_current.audio_channel = -1; /* Force an update */; (*event) = DVDNAV_CELL_CHANGE; (*len) = 0; pthread_mutex_unlock(&this->vm_lock); @@ -995,6 +999,11 @@ uint32_t dvdnav_get_next_still_flag(dvdnav_t *this) { /* * $Log: dvdnav.c,v $ + * Revision 1.4 2002/08/19 17:17:00 mroi + * sync to libdvdnav cvs + * - update clut and spu/audio channel more often + * - align read cache in memory to allow use of raw devices + * * Revision 1.3 2002/08/09 22:52:14 mroi * change includes from system include to local include where the file is in * our tree now to avoid version clashes diff --git a/src/input/libdvdnav/read_cache.c b/src/input/libdvdnav/read_cache.c index 1d6e68727..72ff2d801 100644 --- a/src/input/libdvdnav/read_cache.c +++ b/src/input/libdvdnav/read_cache.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: read_cache.c,v 1.1 2002/08/08 17:49:21 richwareham Exp $ + * $Id: read_cache.c,v 1.2 2002/08/19 17:17:00 mroi Exp $ * */ @@ -69,8 +69,12 @@ struct read_cache_s { #define READ_CACHE_CHUNKS 10 +/* all cache chunks must be memory aligned to allow use of raw devices */ +#define ALIGNMENT 2048 + typedef struct read_cache_chunk_s { uint8_t *cache_buffer; + uint8_t *cache_buffer_base; /* used in malloc and free for alignment */ int32_t cache_start_sector; /* -1 means cache invalid */ size_t cache_block_count; size_t cache_malloc_size; @@ -362,7 +366,7 @@ void dvdnav_read_cache_free(read_cache_t* self) { self->freeing = 1; for (i = 0; i < READ_CACHE_CHUNKS; i++) if (self->chunk[i].cache_buffer && self->chunk[i].usage_count == 0) { - free(self->chunk[i].cache_buffer); + free(self->chunk[i].cache_buffer_base); self->chunk[i].cache_buffer = NULL; } pthread_mutex_unlock(&self->lock); @@ -432,8 +436,10 @@ void dvdnav_pre_cache_blocks(read_cache_t *self, int sector, size_t block_count) (use == -1 || self->chunk[use].cache_malloc_size < self->chunk[i].cache_malloc_size)) use = i; if (use >= 0) { - self->chunk[use].cache_buffer = realloc(self->chunk[use].cache_buffer, - block_count * DVD_VIDEO_LB_LEN); + self->chunk[use].cache_buffer_base = realloc(self->chunk[use].cache_buffer_base, + block_count * DVD_VIDEO_LB_LEN + ALIGNMENT); + self->chunk[use].cache_buffer = + (uint8_t *)(((int)self->chunk[use].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT); dprintf("pre_cache DVD read realloc happened\n"); self->chunk[use].cache_malloc_size = block_count; } else { @@ -448,7 +454,10 @@ void dvdnav_pre_cache_blocks(read_cache_t *self, int sector, size_t block_count) * Some DVDs I have seen venture to 450 blocks. * This is so that fewer realloc's happen if at all. */ - self->chunk[i].cache_buffer = malloc((block_count > 500 ? block_count : 500) * DVD_VIDEO_LB_LEN); + self->chunk[i].cache_buffer_base = + malloc((block_count > 500 ? block_count : 500) * DVD_VIDEO_LB_LEN + ALIGNMENT); + self->chunk[i].cache_buffer = + (uint8_t *)(((int)self->chunk[i].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT); self->chunk[i].cache_malloc_size = block_count > 500 ? block_count : 500; dprintf("pre_cache DVD read malloc %d blocks\n", (block_count > 500 ? block_count : 500 )); -- cgit v1.2.3