Commit 56439bf0 authored by Filippo Carone's avatar Filippo Carone

Mediacontrol interface changes to detach use of vlc/control.h

header from internal headers. 
Patch elaborated with Olivier Aubert.
parent 064023b0
......@@ -28,34 +28,17 @@
extern "C" {
# endif
#include <vlc/vlc.h>
#if defined( WIN32 )
#define WINDOWHANDLE HWND
#else
#define WINDOWHANDLE int
#endif
#include <vlc/control_structures.h>
/************************************************************************
* Position Object Manipulation
*************************************************************************/
typedef enum {
mediacontrol_AbsolutePosition,
mediacontrol_RelativePosition,
mediacontrol_ModuloPosition
} mediacontrol_PositionOrigin;
typedef enum {
mediacontrol_ByteCount,
mediacontrol_SampleCount,
mediacontrol_MediaTime
} mediacontrol_PositionKey;
typedef struct {
mediacontrol_PositionOrigin origin;
mediacontrol_PositionKey key;
long value;
} mediacontrol_Position;
typedef struct {
int width;
......@@ -83,12 +66,7 @@ typedef struct {
#define mediacontrol_PlaylistException 4
#define mediacontrol_InternalException 5
typedef struct {
vlc_object_t *p_vlc;
playlist_t *p_playlist;
intf_thread_t *p_intf;
int vlc_object_id;
} mediacontrol_Instance;
typedef mediacontrol_Instance;
/* Cf stream_control.h */
enum mediacontrol_PlayerStatusList
......@@ -110,13 +88,6 @@ typedef struct {
/**************************************************************************
* Helper functions
***************************************************************************/
vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
vlc_int64_t value );
vlc_int64_t mediacontrol_position2microsecond(
input_thread_t *p_input,
const mediacontrol_Position *pos );
mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
......
/*****************************************************************************
* control.h: private header for mediacontrol
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id: vlc.h 10101 2005-03-02 16:47:31Z robux4 $
*
* Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLC_CONTROL_STRUCTURES_H
#define _VLC_CONTROL_STRUCTURES_H 1
# ifdef __cplusplus
extern "C" {
# endif
typedef enum {
mediacontrol_AbsolutePosition,
mediacontrol_RelativePosition,
mediacontrol_ModuloPosition
} mediacontrol_PositionOrigin;
typedef enum {
mediacontrol_ByteCount,
mediacontrol_SampleCount,
mediacontrol_MediaTime
} mediacontrol_PositionKey;
typedef struct {
mediacontrol_PositionOrigin origin;
mediacontrol_PositionKey key;
long value;
} mediacontrol_Position;
# ifdef __cplusplus
}
# endif
#endif
/*****************************************************************************
* control.h: private header for mediacontrol
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id: vlc.h 10101 2005-03-02 16:47:31Z robux4 $
*
* Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLC_PRIVATE_CONTROL_H
#define _VLC_PRIVATE_CONTROL_H 1
# ifdef __cplusplus
extern "C" {
# endif
#include <vlc/vlc.h>
#include "vlc/control_structures.h"
typedef struct {
vlc_object_t *p_vlc;
playlist_t *p_playlist;
intf_thread_t *p_intf;
int vlc_object_id;
} mediacontrol_Instance;
vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
mediacontrol_PositionKey from,
mediacontrol_PositionKey to,
vlc_int64_t value );
vlc_int64_t mediacontrol_position2microsecond(
input_thread_t *p_input,
const mediacontrol_Position *pos );
# ifdef __cplusplus
}
# endif
#endif
......@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc_control.h>
#include <vlc/control.h>
#include <vlc/intf.h>
......@@ -416,7 +418,7 @@ vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
RAISE( mediacontrol_InternalException, "No vlc reference" );
return 0;
}
value.i_int = (int) visual_id;
value.i_int=visual_id;
ret = var_Set(self->p_vlc, "drawable", value);
return (ret == VLC_SUCCESS);
......
......@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc_control.h>
#include <vlc/control.h>
#include <vlc/intf.h>
......@@ -168,6 +169,15 @@ mediacontrol_set_media_position( mediacontrol_Instance *self,
}
/* Starts playing a stream */
/*
* Known issues: since moving in the playlist using playlist_Next
* or playlist_Prev implies starting to play items, the a_position
* argument will be only honored for the 1st item in the list.
*
* XXX:FIXME split moving in the playlist and playing items two
* different actions or make playlist_<Next|Prev> accept a time
* value to start to play from.
*/
void
mediacontrol_start( mediacontrol_Instance *self,
const mediacontrol_Position * a_position,
......@@ -185,18 +195,18 @@ mediacontrol_start( mediacontrol_Instance *self,
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
int i_from;
vlc_mutex_unlock( &p_playlist->object_lock );
int i_from;
char * psz_from = (char *) malloc (20 * sizeof(char));
playlist_item_t * p_item = *(p_playlist->pp_items);
i_from = mediacontrol_position2microsecond( p_playlist->p_input, a_position ) / 1000000;
/* Set start time */
snprintf( psz_from, 20, "start-time=%i", i_from);
playlist_ItemAddOption( p_item, psz_from);
free(psz_from);
if( p_playlist->status.p_item )
{
char psz_from[20];
snprintf( psz_from, 20, "start-time=%i", i_from);
playlist_ItemAddOption( p_playlist->status.p_item, psz_from);
}
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
}
......@@ -204,7 +214,6 @@ mediacontrol_start( mediacontrol_Instance *self,
{
RAISE( mediacontrol_PlaylistException, "Empty playlist." );
vlc_mutex_unlock( &p_playlist->object_lock );
return;
}
return;
......@@ -286,6 +295,22 @@ mediacontrol_playlist_add_item( mediacontrol_Instance *self,
PLAYLIST_END );
}
void
mediacontrol_playlist_next_item( mediacontrol_Instance *self,
mediacontrol_Exception *exception )
{
exception=mediacontrol_exception_init( exception );
if ( !self->p_playlist )
{
RAISE( mediacontrol_InternalException, "No playlist" );
return;
}
playlist_Next( self->p_playlist );
return;
}
void
mediacontrol_playlist_clear( mediacontrol_Instance *self,
mediacontrol_Exception *exception )
......
#define __VLC__
#include <vlc_control.h>
#include <vlc/control.h>
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
......
#include <vlc_control.h>
#include <vlc/control.h>
#include <vlc/intf.h>
......
......@@ -2,7 +2,7 @@
* util.c: Utility functions and exceptions management
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id: vlc.c 10786 2005-04-23 23:19:17Z zorglub $
* $Id$
*
* Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
*
......@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc_control.h>
#include <vlc/control.h>
#include <vlc/intf.h>
......
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