vlc_mtime.h File Reference

Include dependency graph for vlc_mtime.h:

Go to the source code of this file.

Data Structures

struct  date_t

Defines

#define __VLC_MTIME_H   1
#define LAST_MDATE   ((mtime_t)((uint64_t)(-1)/2))
#define MSTRTIME_MAX_SIZE   22
#define MILLISECONDS_PER_SEC   1000
#define msecstotimestr(psz_buffer, msecs)   secstotimestr( psz_buffer, (msecs / (int) MILLISECONDS_PER_SEC) )
#define check_delay(d)   (d)
#define check_deadline(d)   (d)
#define msleep(d)   msleep(check_delay(d))
#define mwait(d)   mwait(check_deadline(d))

Functions

char * mstrtime (char *psz_buffer, mtime_t date)
 Return a date in a readable format.
mtime_t mdate (void)
 Return high precision date.
void mwait (mtime_t date)
 Wait for a date.
void msleep (mtime_t delay)
 Portable usleep().
char * secstotimestr (char *psz_buffer, int secs)
 Convert seconds to a time in the format h:mm:ss.
void date_Init (date_t *, uint32_t, uint32_t)
 Initialize a date_t.
void date_Change (date_t *, uint32_t, uint32_t)
 Change a date_t.
void date_Set (date_t *, mtime_t)
 Set the date value of a date_t.
mtime_t date_Get (const date_t *)
 Get the date of a date_t.
void date_Move (date_t *, mtime_t)
 Move forwards or backwards the date of a date_t.
mtime_t date_Increment (date_t *, uint32_t)
 Increment the date and return the result, taking into account rounding errors.
mtime_t date_Decrement (date_t *, uint32_t)
 Decrement the date and return the result, taking into account rounding errors.
uint64_t NTPtime64 (void)


Define Documentation

#define __VLC_MTIME_H   1

#define check_deadline (  )     (d)

#define check_delay (  )     (d)

#define LAST_MDATE   ((mtime_t)((uint64_t)(-1)/2))

#define MILLISECONDS_PER_SEC   1000

#define msecstotimestr ( psz_buffer,
msecs   )     secstotimestr( psz_buffer, (msecs / (int) MILLISECONDS_PER_SEC) )

Referenced by Redraw().

#define msleep (  )     msleep(check_delay(d))

#define MSTRTIME_MAX_SIZE   22

#define mwait (  )     mwait(check_deadline(d))


Function Documentation

void date_Change ( date_t p_date,
uint32_t  i_divider_n,
uint32_t  i_divider_d 
)

Change a date_t.

Parameters:
date to change
divider (sample rate) numerator
divider (sample rate) denominator

References date_t::i_divider_den, date_t::i_divider_num, and date_t::i_remainder.

Referenced by dirac_InspectDataUnit(), HandleMeta(), and ReadBlockHeader().

mtime_t date_Decrement ( date_t p_date,
uint32_t  i_nb_samples 
)

Decrement the date and return the result, taking into account rounding errors.

Parameters:
date to decrement
decrementation in number of samples
Returns:
date value

References date_t::date, date_t::i_divider_den, date_t::i_divider_num, and date_t::i_remainder.

Referenced by dirac_BackdateDTS(), dirac_BackdatePTS(), and dirac_TimeGenPush().

mtime_t date_Get ( const date_t p_date  ) 

mtime_t date_Increment ( date_t p_date,
uint32_t  i_nb_samples 
)

void date_Init ( date_t p_date,
uint32_t  i_divider_n,
uint32_t  i_divider_d 
)

void date_Move ( date_t p_date,
mtime_t  i_difference 
)

Move forwards or backwards the date of a date_t.

Parameters:
date to move
difference value

References date_t::date.

Referenced by aout_FifoMoveDates().

void date_Set ( date_t p_date,
mtime_t  i_new_date 
)

mtime_t mdate ( void   ) 

Return high precision date.

Use a 1 MHz clock when possible, or 1 kHz

Beware ! It doesn't reflect the actual date (since epoch), but can be the machine's uptime or anything (when monotonic clock is used)

References CLOCK_MONOTONIC, FreeLibrary(), GetProcAddress(), INT64_C, lldiv(), LoadLibrary, lldiv_t::quot, lldiv_t::rem, timespec::tv_nsec, and timespec::tv_sec.

Referenced by __stats_TimerStart(), __stats_TimerStop(), Activate(), Add(), AddToQueue(), ALSAFill(), aout_InputPlay(), aout_OutputNextBuffer(), AStreamPrebufferBlock(), AStreamPrebufferStream(), AStreamRefillBlock(), AStreamRefillStream(), AStreamSeekBlock(), AStreamSeekStream(), AudioStreamChangeFormat(), AVI_IndexCreate(), Block(), BlockScan(), BuildRegions(), Control(), CounterUpdate(), Create(), CreateAnnounce(), CreateFilter(), DateTimeManage(), DateTimeSend(), DecodeBlock(), DecodeFrame(), DecodePacket(), decoder_SynchroChoose(), decoder_SynchroDecode(), decoder_SynchroEnd(), decoder_SynchroNewPicture(), DecoderTeletextFixTs(), DecodeVideo(), DeleteDecoder(), Demux(), DemuxControl(), DemuxPause(), DisplayAnchor(), DisplayNew(), DisplayStat(), DisplayTitleOnOSD(), EncodeVideo(), EsOutControlLocked(), EsOutDecodersStopBuffering(), EsOutGetBuffering(), EventThread(), EventThreadCreate(), EventThreadMouseAutoHide(), CAtmoLiveView::Execute(), FakeCallback(), Filter(), FrontendPoll(), FrontendSet(), GenerateGuid(), GetNewPicture(), GrabAudio(), GrabVideo(), HandleInterval(), ImageRead(), Inhibit(), input_clock_ConvertTS(), ItemChange(), main(), MainLoop(), MainLoopDemux(), MainLoopTryRepeat(), VLCMain::manageIntf:, ManageVideo(), mediacontrol_display_text(), MediaNew(), MixBuffer(), Mouse(), VLCView::MouseDown(), VLCView::MouseMoved(), msleep(), mwait(), Open(), OpenAnalog(), OpenDecoder(), OpenDemux(), OpenSPDIF(), osd_CreateWidget(), osd_ShowTextRelative(), OSSThread(), paCallback(), ParseSAP(), Play(), PlayingChange(), BDAOutput::Pop(), VLCView::Pulse(), QNXaoutThread(), Read(), CapturePin::Receive(), RenderCallbackAnalog(), RenderCallbackSPDIF(), ResetCurrentlyPlaying(), rtp_dequeue(), rtp_queue(), Run(), RunThread(), scan_Init(), scan_Next(), Send(), SendBlock(), SendIn(), VLCMain::setScrollField:stopAfter:, sout_MuxSendBuffer(), spu_RenderSubpictures(), spu_SortSubpictures(), SpuRegionAlpha(), stream_request_cb(), Stress(), system_Init(), Thread(), CThread::ThreadSleep(), ThreadWrite(), TimerDump(), transcode_video_process(), TSDate(), vlc_cond_timedwait(), vlc_timer_schedule(), vlclua_mdate(), vout_ManageDisplay(), vout_ShowTextRelative(), vout_snapshot_Get(), VoutDisplayEventMouse(), VoutSnapshotPip(), WaitPreparsed(), and Write().

void msleep ( mtime_t  delay  ) 

Portable usleep().

Cancellation point.

Parameters:
delay the amount of time to sleep

References CLOCK_MONOTONIC, lldiv(), mdate(), mwait, lldiv_t::quot, lldiv_t::rem, timespec::tv_nsec, and timespec::tv_sec.

char* mstrtime ( char *  psz_buffer,
mtime_t  date 
)

Return a date in a readable format.

This function converts a mtime date into a string. psz_buffer should be a buffer long enough to store the formatted date.

Parameters:
date to be converted
psz_buffer should be a buffer at least MSTRTIME_MAX_SIZE characters
Returns:
psz_buffer is returned so this can be used as printf parameter.

References MSTRTIME_MAX_SIZE.

void mwait ( mtime_t  date  ) 

Wait for a date.

This function uses select() and an system date function to wake up at a precise date. It should be used for process synchronization. If current date is posterior to wished date, the function returns immediately.

Parameters:
date The date to wake up at

References CLOCK_MONOTONIC, lldiv(), mdate(), mprec(), msleep, lldiv_t::quot, lldiv_t::rem, timespec::tv_nsec, timespec::tv_sec, and vlc_testcancel().

uint64_t NTPtime64 ( void   ) 

Returns:
NTP 64-bits timestamp in host byte order.

References timespec::tv_nsec, and timespec::tv_sec.

Referenced by CloseRTCP(), OpenRTCP(), sdp_Start(), SendRTCP(), and vlc_rand_bytes().

char* secstotimestr ( char *  psz_buffer,
int  i_seconds 
)

Convert seconds to a time in the format h:mm:ss.

This function is provided for any interface function which need to print a time string in the format h:mm:ss date.

Parameters:
secs the date to be converted
psz_buffer should be a buffer at least MSTRTIME_MAX_SIZE characters
Returns:
psz_buffer is returned so this can be used as printf parameter.

References MSTRTIME_MAX_SIZE.

Referenced by CDDAFormatStr(), CDDAMetaInfo(), DisplayPosition(), InitTitles(), InputSlider::InputSlider(), InputSlider::mouseMoveEvent(), Timer::Notify(), Interface::OnSliderUpdate(), print_playlist(), psz_column_meta(), Run(), scan_Next(), and Playlist::UpdateItem().


Generated on Sat Nov 21 08:05:26 2009 for VLC by  doxygen 1.5.6