/*****************************************************************************
* video.c: libvlc new API video functions
*****************************************************************************
- * Copyright (C) 2005-2010 the VideoLAN team
+ * Copyright (C) 2005-2010 VLC authors and VideoLAN
*
* $Id$
*
* Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
* Damien Fouilleul <damienf a_t videolan dot org>
*
- * 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
unsigned *restrict px, unsigned *restrict py )
{
-#if 0
- vout_thread_t *p_vout = GetVout (p_mi, num);
- if (p_vout == NULL)
- return -1;
+ libvlc_media_track_info_t *info;
+ int ret = -1;
+ if (!p_mi->p_md)
+ return ret;
+ int infos = libvlc_media_get_tracks_info(p_mi->p_md, &info);
+ if (infos <= 0)
+ return ret;
+
+ for (int i = 0; i < infos; i++)
+ if (info[i].i_type == libvlc_track_video && num-- == 0) {
+ *px = info[i].u.video.i_width;
+ *py = info[i].u.video.i_height;
+ ret = 0;
+ break;
+ }
- *px = p_vout->i_window_height;
- *py = p_vout->i_window_width;
- vlc_object_release (p_vout);
- return 0;
-#else
- return -1;
-#endif
+ free(info);
+ return ret;
}
int libvlc_video_get_height( libvlc_media_player_t *p_mi )
{
- unsigned height, width;
+ unsigned width, height;
- if (libvlc_video_get_size (p_mi, 0, &height, &width))
+ if (libvlc_video_get_size (p_mi, 0, &width, &height))
return 0;
return height;
}
int libvlc_video_get_width( libvlc_media_player_t *p_mi )
{
- unsigned height, width;
+ unsigned width, height;
- if (libvlc_video_get_size (p_mi, 0, &height, &width))
+ if (libvlc_video_get_size (p_mi, 0, &width, &height))
return 0;
return width;
}
return b_ret;
}
+int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
+ int64_t val = 0;
+
+ if( p_input_thread )
+ {
+ val = var_GetTime( p_input_thread, "spu-delay" );
+ vlc_object_release( p_input_thread );
+ }
+ else
+ {
+ libvlc_printerr( "No active input" );
+ }
+
+ return val;
+}
+
+int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
+ int64_t i_delay )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
+ int ret = -1;
+
+ if( p_input_thread )
+ {
+ var_SetTime( p_input_thread, "spu-delay", i_delay );
+ vlc_object_release( p_input_thread );
+ ret = 0;
+ }
+ else
+ {
+ libvlc_printerr( "No active input" );
+ }
+
+ return ret;
+}
+
libvlc_track_description_t *
libvlc_video_get_title_description( libvlc_media_player_t *p_mi )
{