/** * \brief Show EPG information about the current program of an input item * \param vout pointer to the vout the information is to be showed on * \param p_input pointer to the input item the information is to be showed */ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input) { char *now_playing = input_item_GetNowPlaying(input); vlc_epg_t *epg = NULL; vlc_mutex_lock(&input->lock); /* Look for the current program EPG event */ for (int i = 0; i < input->i_epg; i++) { vlc_epg_t *tmp = input->pp_epg[i]; if (tmp->p_current && tmp->p_current->psz_name && now_playing != NULL && !strcmp(tmp->p_current->psz_name, now_playing)) { epg = vlc_epg_New(tmp->psz_name); vlc_epg_Merge(epg, tmp); break; } } vlc_mutex_unlock(&input->lock); /* If no EPG event has been found. */ if (epg == NULL) return VLC_EGENERIC; subpicture_updater_sys_t *sys = (subpicture_updater_sys_t *)malloc(sizeof(*sys)); // sunqueen modify if (!sys) { vlc_epg_Delete(epg); return VLC_EGENERIC; } sys->epg = epg; subpicture_updater_t updater = { // sunqueen modify start /*.pf_validate =*/ OSDEpgValidate, /*.pf_update =*/ OSDEpgUpdate, /*.pf_destroy =*/ OSDEpgDestroy, /*.p_sys =*/ sys // sunqueen modify end }; const mtime_t now = mdate(); subpicture_t *subpic = subpicture_New(&updater); if (!subpic) { vlc_epg_Delete(sys->epg); free(sys); return VLC_EGENERIC; } subpic->i_channel = SPU_DEFAULT_CHANNEL; subpic->i_start = now; subpic->i_stop = now + 3000 * INT64_C(1000); subpic->b_ephemer = true; subpic->b_absolute = true; subpic->b_fade = true; vout_PutSubpicture(vout, subpic); return VLC_SUCCESS; }
/** * This function will inject a subpicture into the vout with the provided * picture */ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic ) { subpicture_t *p_subpic = subpicture_NewFromPicture( VLC_OBJECT(p_vout), p_pic, VLC_CODEC_YUVA ); if( !p_subpic ) return VLC_EGENERIC; /* FIXME SPU_DEFAULT_CHANNEL is not good (used by the text) but * hardcoded 0 doesn't seem right */ p_subpic->i_channel = 0; p_subpic->i_start = mdate(); p_subpic->i_stop = p_subpic->i_start + 4000000; p_subpic->b_ephemer = true; p_subpic->b_fade = true; /* Reduce the picture to 1/4^2 of the screen */ p_subpic->i_original_picture_width *= 4; p_subpic->i_original_picture_height *= 4; vout_PutSubpicture( p_vout, p_subpic ); return VLC_SUCCESS; }
/** * \brief Show EPG information about the current program of an input item * \param p_vout pointer to the vout the information is to be showed on * \param p_input pointer to the input item the information is to be showed */ int vout_OSDEpg( vout_thread_t *p_vout, input_item_t *p_input ) { subpicture_t *p_spu; mtime_t i_now = mdate(); char *psz_now_playing = input_item_GetNowPlaying( p_input ); vlc_epg_t *p_epg = NULL; vlc_mutex_lock( &p_input->lock ); /* Look for the current program EPG event */ for( int i = 0; i < p_input->i_epg; i++ ) { vlc_epg_t *p_tmp = p_input->pp_epg[i]; if( p_tmp->p_current && p_tmp->p_current->psz_name && psz_now_playing != NULL && !strcmp( p_tmp->p_current->psz_name, psz_now_playing ) ) { p_epg = vlc_epg_New( p_tmp->psz_name ); vlc_epg_Merge( p_epg, p_tmp ); break; } } vlc_mutex_unlock( &p_input->lock ); /* If no EPG event has been found. */ if( p_epg == NULL ) return VLC_EGENERIC; subpicture_updater_sys_t *p_sys = malloc( sizeof( *p_sys ) ); if( !p_sys ) { vlc_epg_Delete( p_epg ); return VLC_EGENERIC; } p_sys->p_epg = p_epg; subpicture_updater_t updater = { .pf_validate = OSDEpgValidate, .pf_update = OSDEpgUpdate, .pf_destroy = OSDEpgDestroy, .p_sys = p_sys }; p_spu = subpicture_New( &updater ); if( !p_spu ) { vlc_epg_Delete( p_sys->p_epg ); free( p_sys ); return VLC_EGENERIC; } p_spu->i_channel = SPU_DEFAULT_CHANNEL; p_spu->i_start = i_now; p_spu->i_stop = i_now + 3000 * INT64_C(1000); p_spu->b_ephemer = true; p_spu->b_absolute = true; p_spu->b_fade = true; vout_PutSubpicture( p_vout, p_spu ); return VLC_SUCCESS; }