Commit 2401b662 authored by Johan Bilien's avatar Johan Bilien

* modules/access/vcd/vcd.*: added entry points support (sort of

    chapters).
  * modules/gui/gtk/gtk_callbacks.c: added some locks to the
    navigation functions
parent 93160b29
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vcd.h: thread structure of the VCD plugin * vcd.h: thread structure of the VCD plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: vcd.h,v 1.2 2002/10/15 19:56:59 gbazin Exp $ * $Id: vcd.h,v 1.3 2002/11/06 15:41:29 jobi Exp $
* *
* Author: Johan Bilien <jobi@via.ecp.fr> * Author: Johan Bilien <jobi@via.ecp.fr>
* *
...@@ -29,11 +29,56 @@ ...@@ -29,11 +29,56 @@
#define VCD_SECTOR_SIZE 2352 #define VCD_SECTOR_SIZE 2352
/* size of a CD sector */ /* size of a CD sector */
#define CD_SECTOR_SIZE 2048 #define CD_SECTOR_SIZE 2048
/* sector containing the entry points */
#define VCD_ENTRIES_SECTOR 151
/*****************************************************************************
* Misc. Macros
*****************************************************************************/
/* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
#define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
/* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
#define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
/* Converts BCD to Binary data */
#define BCD_TO_BIN(i) \
((uint8_t)(0xf & (uint8_t)i)+((uint8_t)10*((uint8_t)i >> 4)))
#ifndef VCDDEV_T #ifndef VCDDEV_T
typedef struct vcddev_s vcddev_t; typedef struct vcddev_s vcddev_t;
#endif #endif
/*****************************************************************************
* structure to store minute/second/frame locations
*****************************************************************************/
typedef struct msf_s
{
uint8_t minute;
uint8_t second;
uint8_t frame;
} msf_t;
/*****************************************************************************
* entries_sect structure: the sector containing entry points
*****************************************************************************/
typedef struct entries_sect_s
{
uint8_t psz_id[8]; /* "ENTRYVCD" */
uint8_t i_version; /* 0x02 VCD2.0
0x01 SVCD */
uint8_t i_sys_prof_tag; /* 0x01 if VCD1.1
0x00 else */
uint16_t i_entries_nb; /* entries number <= 500 */
struct
{
uint8_t i_track; /* track number */
msf_t msf; /* msf location
(in BCD format) */
} entry[500];
uint8_t zeros[36]; /* should be 0x00 */
} entries_sect_t;
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -41,4 +86,4 @@ vcddev_t *ioctl_Open ( vlc_object_t *, const char * ); ...@@ -41,4 +86,4 @@ vcddev_t *ioctl_Open ( vlc_object_t *, const char * );
void ioctl_Close ( vlc_object_t *, vcddev_t * ); void ioctl_Close ( vlc_object_t *, vcddev_t * );
int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** ); int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** );
int ioctl_ReadSector ( vlc_object_t *, const vcddev_t *, int ioctl_ReadSector ( vlc_object_t *, const vcddev_t *,
int, byte_t * ); int, byte_t * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_callbacks.c : Callbacks for the Gtk+ plugin. * gtk_callbacks.c : Callbacks for the Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_callbacks.c,v 1.3 2002/09/30 11:05:39 sam Exp $ * $Id: gtk_callbacks.c,v 1.4 2002/11/06 15:41:29 jobi Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -217,11 +217,13 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data ) ...@@ -217,11 +217,13 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data )
p_intf = GtkGetIntf( button ); p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1; i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1;
if( i_id >= 0 ) if( i_id >= 0 )
{ {
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
...@@ -229,8 +231,8 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data ) ...@@ -229,8 +231,8 @@ void GtkTitlePrev( GtkButton * button, gpointer user_data )
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
GtkSetupMenus( p_intf ); GtkSetupMenus( p_intf );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
...@@ -241,11 +243,13 @@ void GtkTitleNext( GtkButton * button, gpointer user_data ) ...@@ -241,11 +243,13 @@ void GtkTitleNext( GtkButton * button, gpointer user_data )
int i_id; int i_id;
p_intf = GtkGetIntf( button ); p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1; i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb ) if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{ {
p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id];
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
...@@ -253,8 +257,8 @@ void GtkTitleNext( GtkButton * button, gpointer user_data ) ...@@ -253,8 +257,8 @@ void GtkTitleNext( GtkButton * button, gpointer user_data )
p_intf->p_sys->b_title_update = 1; p_intf->p_sys->b_title_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
GtkSetupMenus( p_intf ); GtkSetupMenus( p_intf );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
...@@ -264,20 +268,22 @@ void GtkChapterPrev( GtkButton * button, gpointer user_data ) ...@@ -264,20 +268,22 @@ void GtkChapterPrev( GtkButton * button, gpointer user_data )
input_area_t * p_area; input_area_t * p_area;
p_intf = GtkGetIntf( button ); p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area; p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if( p_area->i_part > 0 ) if( p_area->i_part > 0 )
{ {
p_area->i_part--; p_area->i_part--;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
GtkSetupMenus( p_intf ); GtkSetupMenus( p_intf );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
...@@ -287,20 +293,23 @@ void GtkChapterNext( GtkButton * button, gpointer user_data ) ...@@ -287,20 +293,23 @@ void GtkChapterNext( GtkButton * button, gpointer user_data )
input_area_t * p_area; input_area_t * p_area;
p_intf = GtkGetIntf( button ); p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_area = p_intf->p_sys->p_input->stream.p_selected_area; p_area = p_intf->p_sys->p_input->stream.p_selected_area;
if( p_area->i_part < p_area->i_part_nb ) if( p_area->i_part < p_area->i_part_nb )
{ {
p_area->i_part++; p_area->i_part++;
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
p_intf->p_sys->b_chapter_update = 1; p_intf->p_sys->b_chapter_update = 1;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
GtkSetupMenus( p_intf ); GtkSetupMenus( p_intf );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
/**************************************************************************** /****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment