char *psz_name;
char *psz_now_playing;
char *psz_publisher;
-
- vlc_epg_t *p_epg;
} es_out_pgrm_t;
struct es_out_id_t
free( p_pgrm->psz_now_playing );
free( p_pgrm->psz_publisher );
free( p_pgrm->psz_name );
- if( p_pgrm->p_epg )
- vlc_epg_Delete( p_pgrm->p_epg );
free( p_pgrm );
}
TAB_CLEAN( p_sys->i_pgrm, p_sys->pgrm );
+
+ input_item_SetEpgOffline( p_sys->p_input->p->p_item );
+
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
if( b_record )
{
- char *psz_path = var_CreateGetString( p_input, "input-record-path" );
- if( !psz_path || *psz_path == '\0' )
+ char *psz_path = var_CreateGetNonEmptyString( p_input, "input-record-path" );
+ if( !psz_path )
{
- free( psz_path );
- psz_path = strdup( config_GetHomeDir() );
+ if( var_CountChoices( p_input, "video-es" ) )
+ psz_path = config_GetUserDir( VLC_VIDEOS_DIR );
+ else if( var_CountChoices( p_input, "audio-es" ) )
+ psz_path = config_GetUserDir( VLC_MUSIC_DIR );
+ else
+ psz_path = config_GetUserDir( VLC_DOWNLOAD_DIR );
}
char *psz_sout = NULL; // TODO conf
p_pgrm->psz_name = NULL;
p_pgrm->psz_now_playing = NULL;
p_pgrm->psz_publisher = NULL;
- p_pgrm->p_epg = NULL;
p_pgrm->p_clock = input_clock_New( p_sys->i_rate );
if( !p_pgrm->p_clock )
{
free( p_pgrm->psz_name );
free( p_pgrm->psz_now_playing );
free( p_pgrm->psz_publisher );
- if( p_pgrm->p_epg )
- vlc_epg_Delete( p_pgrm->p_epg );
free( p_pgrm );
/* Update "program" variable */
free( psz_cat );
}
-static void vlc_epg_Merge( vlc_epg_t *p_dst, const vlc_epg_t *p_src )
-{
- int i;
-
- /* Add new event */
- for( i = 0; i < p_src->i_event; i++ )
- {
- vlc_epg_event_t *p_evt = p_src->pp_event[i];
- bool b_add = true;
- int j;
-
- for( j = 0; j < p_dst->i_event; j++ )
- {
- if( p_dst->pp_event[j]->i_start == p_evt->i_start && p_dst->pp_event[j]->i_duration == p_evt->i_duration )
- {
- b_add = false;
- break;
- }
- if( p_dst->pp_event[j]->i_start > p_evt->i_start )
- break;
- }
- if( b_add )
- {
- vlc_epg_event_t *p_copy = calloc( 1, sizeof(vlc_epg_event_t) );
- if( !p_copy )
- break;
- p_copy->i_start = p_evt->i_start;
- p_copy->i_duration = p_evt->i_duration;
- p_copy->psz_name = p_evt->psz_name ? strdup( p_evt->psz_name ) : NULL;
- p_copy->psz_short_description = p_evt->psz_short_description ? strdup( p_evt->psz_short_description ) : NULL;
- p_copy->psz_description = p_evt->psz_description ? strdup( p_evt->psz_description ) : NULL;
- TAB_INSERT( p_dst->i_event, p_dst->pp_event, p_copy, j );
- }
- }
- /* Update current */
- if( p_src->p_current )
- vlc_epg_SetCurrent( p_dst, p_src->p_current->i_start );
-
- /* Keep only 1 old event */
- if( p_dst->p_current )
- {
- while( p_dst->i_event > 1 && p_dst->pp_event[0] != p_dst->p_current && p_dst->pp_event[1] != p_dst->p_current )
- TAB_REMOVE( p_dst->i_event, p_dst->pp_event, p_dst->pp_event[0] );
- }
-}
-
static void EsOutProgramEpg( es_out_t *out, int i_group, const vlc_epg_t *p_epg )
{
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
+ input_item_t *p_item = p_input->p->p_item;
es_out_pgrm_t *p_pgrm;
char *psz_cat;
if( !p_pgrm )
return;
- /* Merge EPG */
- if( !p_pgrm->p_epg )
- p_pgrm->p_epg = vlc_epg_New( p_pgrm->psz_name );
- vlc_epg_Merge( p_pgrm->p_epg, p_epg );
-
/* Update info */
- msg_Dbg( p_input, "EsOutProgramEpg: number=%d name=%s", i_group, p_pgrm->p_epg->psz_name );
-
psz_cat = EsOutProgramGetMetaName( p_pgrm );
+ msg_Dbg( p_input, "EsOutProgramEpg: number=%d name=%s", i_group, psz_cat );
- char *psz_epg;
- if( asprintf( &psz_epg, "EPG %s", psz_cat ) >= 0 )
- {
- input_item_SetEpg( p_input->p->p_item, psz_epg, p_pgrm->p_epg );
- free( psz_epg );
- }
+ /* Merge EPG */
+ vlc_epg_t epg;
+
+ epg = *p_epg;
+ epg.psz_name = psz_cat;
+
+ input_item_SetEpg( p_item, &epg );
/* Update now playing */
free( p_pgrm->psz_now_playing );
p_pgrm->psz_now_playing = NULL;
- if( p_pgrm->p_epg->p_current && p_pgrm->p_epg->p_current->psz_name && *p_pgrm->p_epg->p_current->psz_name )
- p_pgrm->psz_now_playing = strdup( p_pgrm->p_epg->p_current->psz_name );
+
+ vlc_mutex_lock( &p_item->lock );
+ for( int i = 0; i < p_item->i_epg; i++ )
+ {
+ const vlc_epg_t *p_tmp = p_item->pp_epg[i];
+
+ if( p_tmp->psz_name && !strcmp(p_tmp->psz_name, psz_cat) )
+ {
+ if( p_tmp->p_current && p_tmp->p_current->psz_name && *p_tmp->p_current->psz_name )
+ p_pgrm->psz_now_playing = strdup( p_tmp->p_current->psz_name );
+ break;
+ }
+ }
+ vlc_mutex_unlock( &p_item->lock );
if( p_pgrm == p_sys->p_pgrm )
{
if( p_sys->i_preroll_end >= 0 )
{
int64_t i_date = p_block->i_pts;
- if( i_date <= 0 )
+ if( p_block->i_pts <= VLC_TS_INVALID )
i_date = p_block->i_dts;
if( i_date < p_sys->i_preroll_end )
/* Check buffering state on master clock update */
EsOutDecodersStopBuffering( out, false );
}
- else if( b_late )
+ else if( b_late && ( !out->b_sout ||
+ !p_sys->p_input->p->b_out_pace_control ) )
{
mtime_t i_pts_delay = input_clock_GetJitter( p_pgrm->p_clock );
if( p_fmt->i_extra )
{
es->fmt.i_extra = p_fmt->i_extra;
- es->fmt.p_extra = realloc( es->fmt.p_extra, p_fmt->i_extra );
+ es->fmt.p_extra = xrealloc( es->fmt.p_extra, p_fmt->i_extra );
memcpy( es->fmt.p_extra, p_fmt->p_extra, p_fmt->i_extra );
if( !es->p_dec )
#else
es->p_dec->fmt_in.i_extra = p_fmt->i_extra;
es->p_dec->fmt_in.p_extra =
- realloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
+ xrealloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
memcpy( es->p_dec->fmt_in.p_extra,
p_fmt->p_extra, p_fmt->i_extra );
#endif
if( !p_sys->b_buffering )
{
+ mtime_t i_delay;
+
/* Fix for buffering delay */
- const mtime_t i_delay = EsOutGetBuffering( out );
+ if( !out->b_sout || !p_sys->p_input->p->b_out_pace_control )
+ i_delay = EsOutGetBuffering( out );
+ else
+ i_delay = 0;
i_time -= i_delay;
if( i_time < 0 )