jlong Java_org_videolan_libvlc_LibVLC_getLength(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) return (jlong) libvlc_media_player_get_length(mp); return -1; }
int player::getLength() { if (mp) {// if player is initialise return the media time length return libvlc_media_player_get_length(mp); } else { return 0; } }
gint64 xmr_player_get_duration(XmrPlayer *player) { g_return_val_if_fail(player != NULL, 0L); return libvlc_media_player_get_length(player->priv->player); }
qint64 NPlaybackEngineVlc::durationMsec() const { if (!hasMedia()) return -1; return libvlc_media_player_get_length(m_mediaPlayer); }
int VlcMediaPlayer::lenght() const { libvlc_time_t lenght = libvlc_media_player_get_length(_vlcMediaPlayer); VlcError::errmsg(); return lenght; }
Real64 VLCVideoWrapper::getDuration(void) const { // just ask VLC for the vid length // libvlc_time_t is just a typedef for a 64 bit integer libvlc_time_t totalTime = libvlc_media_player_get_length(_MediaPlayer); bool error = checkVLCError("getting duration"); return static_cast<Real64>(totalTime) / 1000.0; }
__int64 CAVPlayer::GetTotalTime() { if (m_pVLC_Player) { return libvlc_media_player_get_length(m_pVLC_Player); } return 0; }
jlong Java_org_videolan_libvlc_MediaPlayer_getLength(JNIEnv *env, jobject thiz) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return -1; return (jlong) libvlc_media_player_get_length(p_obj->u.p_mp); }
JNIEXPORT jint JNICALL NAME(nativeGetDuration)(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = (libvlc_media_player_t *) getIntValue(env, thiz, "mLibVlcMediaPlayer"); int64_t duration = libvlc_media_player_get_length(mp); if (duration < 0) { return -1; } return (jint) (duration / 1000); }
void VLCFullScreenWnd::SetVideoPosScrollRangeByVideoLen() { libvlc_media_player_t* p_md = getMD(); if( p_md ){ libvlc_time_t MaxLen = libvlc_media_player_get_length(p_md); VideoPosShiftBits = 0; while(MaxLen>0xffff){ MaxLen >>= 1; ++VideoPosShiftBits; }; SendMessage(hVideoPosScroll, (UINT)PBM_SETRANGE, 0, MAKELPARAM(0, MaxLen)); } }
STDMETHODIMP VLCInput::get_length(double* length) { if( NULL == length ) return E_POINTER; *length = 0; libvlc_media_player_t *p_md; HRESULT hr = getMD(&p_md); if( SUCCEEDED(hr) ) { *length = (double)libvlc_media_player_get_length(p_md); } return hr; };
void VLCAudioPlayer::checkFrame() { static int framenb = -1; fps = libvlc_media_player_get_fps(mediaPlayer, &vlc_ex); length = libvlc_media_player_get_length(mediaPlayer, &vlc_ex); float pos = libvlc_media_player_get_position(mediaPlayer, &vlc_ex); qDebug() << pos; int frame = ((length * fps) / 1000) * pos; if ((int) frame != framenb) { framenb = frame; emit frameChanged(framenb); } }
void VlcMediaWidget::updateCurrentTotalTime() { currentTime = int(libvlc_media_player_get_time(vlcMediaPlayer)); totalTime = int(libvlc_media_player_get_length(vlcMediaPlayer)); if (currentTime < 0) { currentTime = 0; } if (totalTime < 0) { totalTime = 0; } if (currentTime > totalTime) { currentTime = totalTime; } }
static int clutter_vlc_get_duration(ClutterVlcVideoTexture* video_texture) { ClutterVlcVideoTexturePrivate* priv; libvlc_time_t ret; priv = video_texture->priv; if (priv->vlc_media_player == NULL) return 0; ret = libvlc_media_player_get_length(priv->vlc_media_player, &priv->vlc_exception); clutter_vlc_catch(&priv->vlc_exception); return (int)ret; }
/** * Thumbnailer vout unlock **/ static void thumbnailer_unlock(void *opaque, void *picture, void *const *pixels) { thumbnailer_sys_t *sys = opaque; /* If we have already received a thumbnail, we skip this frame. */ pthread_mutex_lock(&sys->doneMutex); bool hasThumb = sys->hasThumb; pthread_mutex_unlock(&sys->doneMutex); if (hasThumb) return; sys->nbReceivedFrames++; if (libvlc_media_player_get_position(sys->mp) < THUMBNAIL_POSITION / 2 // Arbitrary choice to work around broken files. && libvlc_media_player_get_length(sys->mp) > 1000 && sys->nbReceivedFrames < 10) { return; } /* Else we have received our first thumbnail and we can exit. */ const char *dataSrc = sys->frameData; char *dataDest = sys->thumbnail + sys->thumbnailOffset; /* Copy the thumbnail. */ unsigned i; for (i = 0; i < sys->nbLines; ++i) { memcpy(dataDest, dataSrc, sys->picPitch); dataDest += sys->lineSize; dataSrc += sys->picPitch; } /* Signal that the thumbnail was created. */ pthread_mutex_lock(&sys->doneMutex); sys->hasThumb = true; pthread_cond_signal(&sys->doneCondVar); pthread_mutex_unlock(&sys->doneMutex); }
long VlcVideoPlayer::getTotalTimeMs() { return libvlc_media_player_get_length(vlcPlayer); }
mediacontrol_StreamInformation * mediacontrol_get_stream_information( mediacontrol_Instance *self, mediacontrol_PositionKey a_key, mediacontrol_Exception *exception ) { (void)a_key; mediacontrol_StreamInformation *retval = NULL; libvlc_media_t * p_media; libvlc_exception_t ex; libvlc_exception_init( &ex ); retval = ( mediacontrol_StreamInformation* ) malloc( sizeof( mediacontrol_StreamInformation ) ); if( ! retval ) { RAISE( mediacontrol_InternalException, "Out of memory" ); return NULL; } p_media = libvlc_media_player_get_media( self->p_media_player, &ex ); HANDLE_LIBVLC_EXCEPTION_NULL( &ex ); if( ! p_media ) { /* No p_media defined */ retval->streamstatus = mediacontrol_UndefinedStatus; retval->url = strdup( "" ); retval->position = 0; retval->length = 0; } else { libvlc_state_t state; state = libvlc_media_player_get_state( self->p_media_player, &ex ); HANDLE_LIBVLC_EXCEPTION_NULL( &ex ); switch( state ) { case libvlc_NothingSpecial: retval->streamstatus = mediacontrol_UndefinedStatus; break; case libvlc_Opening : retval->streamstatus = mediacontrol_InitStatus; break; case libvlc_Buffering: retval->streamstatus = mediacontrol_BufferingStatus; break; case libvlc_Playing: retval->streamstatus = mediacontrol_PlayingStatus; break; case libvlc_Paused: retval->streamstatus = mediacontrol_PauseStatus; break; case libvlc_Stopped: retval->streamstatus = mediacontrol_StopStatus; break; case libvlc_Forward: retval->streamstatus = mediacontrol_ForwardStatus; break; case libvlc_Backward: retval->streamstatus = mediacontrol_BackwardStatus; break; case libvlc_Ended: retval->streamstatus = mediacontrol_EndStatus; break; case libvlc_Error: retval->streamstatus = mediacontrol_ErrorStatus; break; default : retval->streamstatus = mediacontrol_UndefinedStatus; break; } retval->url = libvlc_media_get_mrl( p_media, &ex ); retval->position = libvlc_media_player_get_time( self->p_media_player, &ex ); if( libvlc_exception_raised( &ex ) ) { libvlc_exception_clear( &ex ); retval->position = 0; } retval->length = libvlc_media_player_get_length( self->p_media_player, &ex ); if( libvlc_exception_raised( &ex ) ) { libvlc_exception_clear( &ex ); retval->length = 0; } } return retval; }
qint64 VPlayer::getDuration() { return mp?libvlc_media_player_get_length(mp):-1; }
void VlcPluginBase::control_handler(vlc_toolbar_clicked_t clicked) { switch( clicked ) { case clicked_Play: { playlist_play(); } break; case clicked_Pause: { playlist_pause(); } break; case clicked_Stop: { playlist_stop(); } break; case clicked_Fullscreen: { toggle_fullscreen(); } break; case clicked_Mute: case clicked_Unmute: #if 0 { if( p_md ) libvlc_audio_toggle_mute( p_md ); } #endif break; case clicked_timeline: #if 0 { /* if a movie is loaded */ if( p_md ) { int64_t f_length; f_length = libvlc_media_player_get_length( p_md ) / 100; f_length = (float)f_length * ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) ); libvlc_media_player_set_time( p_md, f_length ); } } #endif break; case clicked_Time: { /* Not implemented yet*/ } break; default: /* button_Unknown */ fprintf(stderr, "button Unknown!\n"); break; } }
int64_t PlayerEngine_vlc::get_media_length(){ // type cast to gint64 and return media length return (int64_t)libvlc_media_player_get_length(vlcPlayer); }
int VLCWrapper::GetLength () const { return libvlc_media_player_get_length (Player_.get ()); }
void Libvlc_Video_Display_Callback(void *opaque, void *picture) { CVlcRtspSDK *pDlg = (CVlcRtspSDK *)opaque; if (pDlg == NULL) return ; if(pDlg->Width ==0) return ; if( ! pDlg->CapturePath.IsEmpty()) { ZOGDramBMP(pDlg->CapturePath.GetBuffer(0),(unsigned char *)picture,pDlg->Width,pDlg->Height); pDlg->CapturePath=""; } memcpy(pDlg->m_DC_Cache.GetCacheBuffer(), picture, pDlg->Width*pDlg->Height*pDlg->m_nBitCount/8); CRect rect; ::GetWindowRect(pDlg->hWnd,&rect); pDlg->pDc->StretchBlt(0, 0,rect.Width(), rect.Height(), pDlg->m_DC_Cache.GetCacheDC(), 0, 0,pDlg->Width,pDlg->Height ,SRCCOPY); //车牌识别 #if OPEN_LC_CARDETECT_CODE //启用识别 if(DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].enableCarDetect) { DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]++; if(0==DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]%CAR_JUMP_NUM) { DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]=0; //拷贝数值 DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].m_playhandle=pDlg->screenNo; DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].camid= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].camID; strcpy(DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].cam_name, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].name.GetBuffer(0)); if(DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].ip.GetLength() >0) { strcpy(DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].l_ipaddr, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].ip.GetBuffer(0)); } else strcpy(DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].l_ipaddr,"0.0.0.0"); DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].cam_Direction= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].Direction; //颜色LC_VIDEO_FORMAT_YV12 与颜色LC_VIDEO_FORMAT_I420 相反 DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].Start(LC_VIDEO_FORMAT_BGR24, (unsigned char *)picture,pDlg->Width,pDlg->Height,pDlg->Width*pDlg->Height*3); DlgMain->DlgTabVideo.DlgScreen.CarDetect[pDlg->screenNo].Result(); } } #endif //车牌识别 #if OPEN_HYZJ_CARDETECT_CODE //启用识别 if(DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].enableCarDetect) { DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]++; if(0==DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]%CAR_JUMP_NUM) { DlgMain->DlgTabVideo.DlgScreen.CarAdd[pDlg->screenNo]=0; //拷贝数值 DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].m_playhandle=pDlg->screenNo; DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].camid= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].camID; strcpy(DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].cam_name, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].name.GetBuffer(0)); if(DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].ip.GetLength() >0) { strcpy(DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].l_ipaddr, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].ip.GetBuffer(0)); } else strcpy(DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].l_ipaddr,"0.0.0.0"); DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].cam_Direction= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].Direction; //颜色LC_VIDEO_FORMAT_YV12 与颜色LC_VIDEO_FORMAT_I420 相反 //ImageFormatBGR #if 0 unsigned long yuvlen=pDlg->Width*pDlg->Height*3; RGB2YUV((unsigned char *)picture,pDlg->Width,pDlg->Height,pDlg->YUVdata,&yuvlen) ; DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].Start(ImageFormatYUV420, pDlg->YUVdata,pDlg->Width,pDlg->Height,yuvlen); #else DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].Start(ImageFormatBGR, (unsigned char *)picture,pDlg->Width,pDlg->Height,pDlg->Width*pDlg->Height*3); #endif DlgMain->DlgTabVideo.DlgScreen.HYZJCarDetect[pDlg->screenNo].Result(); } } #endif #if OPEN_FACEDETECT_CODE //启用识别 if(DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].enableFaceDetect) { DlgMain->DlgTabVideo.DlgScreen.FaceAdd[pDlg->screenNo]++; if(0==DlgMain->DlgTabVideo.DlgScreen.FaceAdd[pDlg->screenNo]%FACE_JUMP_NUM) { DlgMain->DlgTabVideo.DlgScreen.FaceAdd[pDlg->screenNo]=0; // YUV2RGB((unsigned char *)pBuf, DlgMain->DlgTabVideo.DlgScreen.RGBdata[screenNo], nWidth,nHeight); //拷贝数值 DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].m_playhandle=pDlg->screenNo; DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].camid= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].camID; strcpy(DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].cam_name, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].name.GetBuffer(0)); strcpy(DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].l_ipaddr, DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].ip.GetBuffer(0)); DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].cam_Direction= DlgMain->DlgTabVideo.DlgScreen.m_videoInfo[pDlg->screenNo].Direction; DlgMain->DlgTabVideo.DlgScreen.FaceDetect[pDlg->screenNo].Start(VIDEO_FORMAT_RGB888, (unsigned char *)picture,pDlg->Width,pDlg->Height,pDlg->Width*3,pDlg->Width*pDlg->Height*3); //ZOGDramBMP("d:\\112212121.bmp",DlgMain->DlgTabVideo.DlgScreen.RGBdata[screenNo], nWidth,nHeight); } } #endif #if (TEST_DEBUG && DEAD_WHILE) libvlc_time_t end=libvlc_media_player_get_length( pDlg->m_pLibvlc_Mp); libvlc_time_t cur= libvlc_media_player_get_time( pDlg->m_pLibvlc_Mp); if(( end-cur)<=100) { libvlc_media_player_set_time(pDlg->m_pLibvlc_Mp,0); } #endif }
/** * @brief Get media length * * @param player \e GtkVlcPlayer instance * @return Length of media (in milliseconds) */ gint64 gtk_vlc_player_get_length(GtkVlcPlayer *player) { return (gint64)libvlc_media_player_get_length(player->priv->media_player); }
int64_t VLCWrapperImpl::GetLength() { int64_t iLength=libvlc_media_player_get_length(m_pMediaPlayer, &m_VLCex); ProcessVLCException(&m_VLCex, m_EH); return iLength; }
int64_t VLCWrapperImpl::GetLength() { int64_t length = libvlc_media_player_get_length(pMediaPlayer_); return length; }
RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVariant &result) { /* is plugin still running */ if( isPluginRunning() ) { VlcPlugin* p_plugin = getPrivate<VlcPlugin>(); libvlc_exception_t ex; libvlc_exception_init(&ex); libvlc_media_player_t *p_md = p_plugin->getMD(&ex); if( libvlc_exception_raised(&ex) ) { if( index != ID_input_state ) { NPN_SetException(this, libvlc_exception_get_message(&ex)); libvlc_exception_clear(&ex); return INVOKERESULT_GENERIC_ERROR; } else { /* for input state, return CLOSED rather than an exception */ INT32_TO_NPVARIANT(0, result); libvlc_exception_clear(&ex); return INVOKERESULT_NO_ERROR; } } switch( index ) { case ID_input_length: { double val = (double)libvlc_media_player_get_length(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_position: { double val = libvlc_media_player_get_position(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_time: { double val = (double)libvlc_media_player_get_time(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_state: { int val = libvlc_media_player_get_state(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); INT32_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_rate: { float val = libvlc_media_player_get_rate(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_fps: { double val = libvlc_media_player_get_fps(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); DOUBLE_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } case ID_input_hasvout: { bool val = p_plugin->player_has_vout(&ex); RETURN_ON_EXCEPTION(this,ex); BOOLEAN_TO_NPVARIANT(val, result); return INVOKERESULT_NO_ERROR; } default: ; } } return INVOKERESULT_GENERIC_ERROR; }