decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys;
- if (p_dec->fmt_in.i_codec != VLC_FOURCC ('M', 'I', 'D', 'I'))
+ if (p_dec->fmt_in.i_codec != VLC_CODEC_MIDI)
return VLC_EGENERIC;
char *font_path = var_CreateGetNonEmptyString (p_this, "soundfont");
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
- p_dec->fmt_out.i_codec = VLC_FOURCC('f', 'l', '3', '2');
+ p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
p_dec->fmt_out.audio.i_bitspersample = 32;
p_dec->pf_decode_audio = DecodeBlock;
{
block_t *p_block;
decoder_sys_t *p_sys = p_dec->p_sys;
+ aout_buffer_t *p_out = NULL;
if (pp_block == NULL)
return NULL;
p_block = *pp_block;
if (p_block == NULL)
return NULL;
+ *pp_block = NULL;
if (p_block->i_pts && !aout_DateGet (&p_sys->end_date))
aout_DateSet (&p_sys->end_date, p_block->i_pts);
if (p_block->i_pts < aout_DateGet (&p_sys->end_date))
{
msg_Warn (p_dec, "MIDI message in the past?");
- block_Release (p_block);
- return NULL;
+ goto drop;
}
if (p_block->i_buffer < 1)
- return NULL;
+ goto drop;
uint8_t channel = p_block->p_buffer[0] & 0xf;
uint8_t p1 = (p_block->i_buffer > 1) ? (p_block->p_buffer[1] & 0x7f) : 0;
fluid_synth_pitch_bend (p_sys->synth, channel, (p1 << 7) | p2);
break;
}
- p_block->p_buffer += p_block->i_buffer;
- p_block->i_buffer = 0;
unsigned samples =
(p_block->i_pts - aout_DateGet (&p_sys->end_date)) * 441 / 10000;
if (samples == 0)
return NULL;
- aout_buffer_t *p_out = decoder_NewAudioBuffer (p_dec, samples);
+ p_out = decoder_NewAudioBuffer (p_dec, samples);
if (p_out == NULL)
- {
- block_Release (p_block);
- return NULL;
- }
+ goto drop;
p_out->start_date = aout_DateGet (&p_sys->end_date );
p_out->end_date = aout_DateIncrement (&p_sys->end_date, samples);
fluid_synth_write_float (p_sys->synth, samples,
p_out->p_buffer, 0, 2,
p_out->p_buffer, 1, 2);
+ drop:
+ block_Release (p_block);
return p_out;
}
/* Connect to X */
p_sys->conn = Connect (obj);
if (p_sys->conn == NULL)
+ {
+ free (p_sys);
return VLC_EGENERIC;
+ }
/* Get window */
const xcb_screen_t *scr;
if (p_sys->embed == NULL)
{
xcb_disconnect (p_sys->conn);
+ free (p_sys);
return VLC_EGENERIC;
}
{
case 24:
if (fmt->bits_per_pixel == 32)
- chroma = VLC_FOURCC ('R', 'V', '3', '2');
+ chroma = VLC_CODEC_RGB32;
else if (fmt->bits_per_pixel == 24)
- chroma = VLC_FOURCC ('R', 'V', '2', '4');
+ chroma = VLC_CODEC_RGB24;
else
continue;
break;
case 16:
if (fmt->bits_per_pixel != 16)
continue;
- chroma = VLC_FOURCC ('R', 'V', '1', '6');
+ chroma = VLC_CODEC_RGB16;
break;
case 15:
if (fmt->bits_per_pixel != 16)
continue;
- chroma = VLC_FOURCC ('R', 'V', '1', '5');
+ chroma = VLC_CODEC_RGB15;
break;
case 8:
if (fmt->bits_per_pixel != 8)
continue;
- chroma = VLC_FOURCC ('R', 'G', 'B', '2');
+ chroma = VLC_CODEC_RGB8;
break;
default:
continue;
if (!gray)
continue; /* Prefer color over gray scale */
vid = vt->visual_id;
- chroma = VLC_FOURCC ('G', 'R', 'E', 'Y');
+ chroma = VLC_CODEC_GREY;
}
}
if (pic->i_status != FREE_PICTURE)
continue;
- vout_InitPicture (vout, pic, vout->output.i_chroma,
- vout->output.i_width, vout->output.i_height,
- vout->output.i_aspect);
+ picture_Setup (pic, vout->output.i_chroma,
+ vout->output.i_width, vout->output.i_height,
+ vout->output.i_aspect);
if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines,
p_sys->shm ? p_sys->conn : NULL))
break;
/* Connect to X */
p_sys->conn = Connect (obj);
if (p_sys->conn == NULL)
+ {
+ free (p_sys);
return VLC_EGENERIC;
+ }
if (!CheckXVideo (vout, p_sys->conn))
{
msg_Warn (vout, "Please enable XVideo 2.2 for faster video display");
xcb_disconnect (p_sys->conn);
+ free (p_sys);
return VLC_EGENERIC;
}
if (p_sys->embed == NULL)
{
xcb_disconnect (p_sys->conn);
+ free (p_sys);
return VLC_EGENERIC;
}
{
case 32:
if (f->depth == 24)
- return VLC_FOURCC ('R', 'V', '3', '2');
+ return VLC_CODEC_RGB32;
break;
case 24:
if (f->depth == 24)
- return VLC_FOURCC ('R', 'V', '2', '4');
+ return VLC_CODEC_RGB24;
break;
case 16:
if (f->depth == 16)
- return VLC_FOURCC ('R', 'V', '1', '6');
+ return VLC_CODEC_RGB16;
if (f->depth == 15)
- return VLC_FOURCC ('R', 'V', '1', '5');
+ return VLC_CODEC_RGB15;
break;
case 8:
if (f->depth == 8)
- return VLC_FOURCC ('R', 'G', 'B', '2');
+ return VLC_CODEC_RGB8;
break;
}
break;
{
/*untested: case 24:
if (f->vhorz_u_period == 1 && f->vvert_u_period == 1)
- return VLC_FOURCC ('I', '4', '4', '4');
+ return VLC_CODEC_I444;
break;*/
case 16:
if (f->vhorz_u_period == 2 && f->vvert_u_period == 1)
{
if (!strcmp ((const char *)f->vcomp_order, "YUYV"))
- return VLC_FOURCC ('Y', 'U', 'Y', '2');
+ return VLC_CODEC_YUYV;
if (!strcmp ((const char *)f->vcomp_order, "UYVY"))
- return VLC_FOURCC ('U', 'Y', 'V', 'Y');
+ return VLC_CODEC_UYVY;
}
break;
}
if (f->vhorz_u_period == 2 && f->vvert_u_period == 2)
{
if (!strcmp ((const char *)f->vcomp_order, "YVU"))
- return VLC_FOURCC ('Y', 'V', '1', '2');
+ return VLC_CODEC_YV12;
if (!strcmp ((const char *)f->vcomp_order, "YUV"))
- return VLC_FOURCC ('I', '4', '2', '0');
+ return VLC_CODEC_I420;
}
}
break;
xcb_connection_t *conn = vout->p_sys->conn;
const xcb_xv_image_format_info_t *f, *end;
+#ifndef XCB_XV_OLD
f = xcb_xv_list_image_formats_format (list);
+#else
+ f = (xcb_xv_image_format_info_t *) (list + 1);
+#endif
end = f + xcb_xv_list_image_formats_format_length (list);
for (; f < end; f++)
{
/* Video chroma in preference order */
const vlc_fourcc_t chromas[] = {
vout->fmt_in.i_chroma,
- VLC_FOURCC ('Y', 'U', 'Y', '2'),
- VLC_FOURCC ('R', 'V', '2', '4'),
- VLC_FOURCC ('R', 'V', '1', '5'),
+ VLC_CODEC_YUYV,
+ VLC_CODEC_RGB24,
+ VLC_CODEC_RGB15,
};
for (size_t i = 0; i < sizeof (chromas) / sizeof (chromas[0]); i++)
{
if (pic->i_status != FREE_PICTURE)
continue;
- vout_InitPicture (vout, pic, vout->output.i_chroma,
- att->width, att->height,
- vout->fmt_in.i_aspect);
+ picture_Setup (pic, vout->output.i_chroma,
+ att->width, att->height,
+ vout->fmt_in.i_aspect);
if (PictureAlloc (vout, pic, att->data_size,
p_sys->shm ? p_sys->conn : NULL))
break;
libvlc_instance_t * p_libvlc_instance;
int i_refcount;
vlc_mutex_t object_lock;
+ vlc_mutex_t refcount_lock;
libvlc_media_t * p_md; /* The media from which the
* mlist comes, if any. */
vlc_array_t items;
uint32_t xid;
uint32_t agl;
} drawable;
-
- bool b_own_its_input_thread;
};
- struct libvlc_media_list_player_t
- {
- libvlc_event_manager_t * p_event_manager;
- libvlc_instance_t * p_libvlc_instance;
- unsigned i_refcount;
- vlc_mutex_t object_lock;
- libvlc_media_list_path_t current_playing_item_path;
- libvlc_media_t * p_current_playing_item;
- libvlc_media_list_t * p_mlist;
- libvlc_media_player_t * p_mi;
- };
-
struct libvlc_media_library_t
{
libvlc_event_manager_t * p_event_manager;
input_thread_t *libvlc_get_input_thread(
libvlc_media_player_t *,
libvlc_exception_t * );
-
-/* Media instance */
-libvlc_media_player_t *
-libvlc_media_player_new_from_input_thread( libvlc_instance_t *,
- input_thread_t *,
- libvlc_exception_t * );
-
-void libvlc_media_player_destroy(
- libvlc_media_player_t * );
/* Media Descriptor */
libvlc_media_t * libvlc_media_new_from_input_item(
#include <vlc/libvlc.h>
#include "media_list_path.h"
+
+ struct libvlc_media_list_player_t
+ {
+ libvlc_event_manager_t * p_event_manager;
+ libvlc_instance_t * p_libvlc_instance;
+ int i_refcount;
+ vlc_mutex_t object_lock;
+ libvlc_media_list_path_t current_playing_item_path;
+ libvlc_media_t * p_current_playing_item;
+ libvlc_media_list_t * p_mlist;
+ libvlc_media_player_t * p_mi;
+ };
+
/*
* Private functions
*/
p_mlp->p_mlist,
p_mlp->current_playing_item_path );
- int deepness = libvlc_media_list_path_deepness( p_mlp->current_playing_item_path );
- if( deepness < 1 || !p_parent_of_playing_item )
+ int depth = libvlc_media_list_path_depth( p_mlp->current_playing_item_path );
+ if( depth < 1 || !p_parent_of_playing_item )
return NULL;
ret = libvlc_media_list_path_copy( p_mlp->current_playing_item_path );
- while( ret[deepness-1] >= libvlc_media_list_count( p_parent_of_playing_item, NULL ) )
+ while( ret[depth-1] >= libvlc_media_list_count( p_parent_of_playing_item, NULL ) )
{
- deepness--;
- if( deepness <= 0 )
+ depth--;
+ if( depth <= 0 )
{
free( ret );
libvlc_media_list_release( p_parent_of_playing_item );
return NULL;
}
- ret[deepness] = -1;
- ret[deepness-1]++;
+ ret[depth] = -1;
+ ret[depth-1]++;
p_parent_of_playing_item = libvlc_media_list_parentlist_at_path(
p_mlp->p_mlist,
ret );
if( !p_mlp )
return NULL;
+ libvlc_retain( p_instance );
+ p_mlp->p_libvlc_instance = p_instance;
+ p_mlp->i_refcount = 0;
+ vlc_mutex_init( &p_mlp->object_lock );
p_mlp->current_playing_item_path = NULL;
- p_mlp->p_mi = NULL;
p_mlp->p_mlist = NULL;
- vlc_mutex_init( &p_mlp->object_lock );
+ p_mlp->p_mi = NULL;
p_mlp->p_event_manager = libvlc_event_manager_new( p_mlp,
p_instance,
p_e );
**************************************************************************/
void libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp )
{
- free(p_mlp);
+ if( !p_mlp )
+ return;
+
+ vlc_mutex_lock( &p_mlp->object_lock );
+
+ p_mlp->i_refcount--;
+ if( p_mlp->i_refcount > 0 )
+ {
+ vlc_mutex_unlock( &p_mlp->object_lock );
+ return;
+ }
+ vlc_mutex_unlock( &p_mlp->object_lock );
+ vlc_mutex_destroy( &p_mlp->object_lock );
+
+ libvlc_event_manager_release( p_mlp->p_event_manager );
+ libvlc_media_player_release( p_mlp->p_mi );
+
+ if( p_mlp->p_mlist )
+ {
+ uninstall_playlist_observer( p_mlp );
+ libvlc_media_list_release( p_mlp->p_mlist );
+ }
+
+ free( p_mlp->current_playing_item_path );
+ libvlc_release( p_mlp->p_libvlc_instance );
+ free( p_mlp );
}
/**************************************************************************