Video Class Reference

#include <video.h>

Inherits RTP_Stream.

Inheritance diagram for Video:

Inheritance graph
[legend]
Collaboration diagram for Video:

Collaboration graph
[legend]

Public Types

enum  vevent { VEVENT0, DAEMON_DISABLED, FPS_CHANGE, SIZE_CHANGE }

Public Member Functions

 Video (void)
 parameters that are not frame-related, their changes do not initiate any actions
virtual ~Video (void)
int width (void)
int height (void)
int quality (void)
float fps (void)
void fps (float)
void Start (string ip, long port)
void Stop (void)
unsigned long getGPValue (unsigned long GPNumber)
 Using Video class to interface global camera parameters.
void setGValue (unsigned long GNumber, unsigned long value)
 Set value of the specified global (G_*) parameter.
bool waitDaemonEnabled (int daemonBit)
 check if this application is enabled (by appropriate bit in P_DAEMON_EN), if not - and wait until enabled (return false when enabled)
bool isDaemonEnabled (int daemonBit)
 check if this application is enabled (by appropriate bit in P_DAEMON_EN)

Protected Member Functions

long getFramePars (struct interframe_params_t *frame_pars, long before)
 Return (byte) pointer to valid frame 'before' current(if current is invalid - use latest, wait if none are ready. Restore (or modify if had to wait) file pointer. fill provided frame_pars with the metadata (including the time stamp).
long capture (void)
long process (void)

Protected Attributes

unsigned long prev_jpeg_wp
int f_width
int f_height
int f_quality
bool qtables_include
unsigned char qtable [128]
long buffer_length
unsigned long * buffer_ptr
unsigned long * buffer_ptr_s
void * frame_ptr
 Second copy of the circbuf just after the end of the first to prevent rollovers.
long v_t_sec
long v_t_usec
int v_frames
unsigned long used_width
unsigned long used_height
 frame width reported by Video::width(), used as the stream width
float used_fps
 similar to above

Detailed Description

Definition at line 15 of file video.h.


Member Enumeration Documentation

enum Video::vevent

Enumerator:
VEVENT0 
DAEMON_DISABLED 
FPS_CHANGE 
SIZE_CHANGE 

Definition at line 17 of file video.h.


Constructor & Destructor Documentation

Video::Video ( void   ) 

parameters that are not frame-related, their changes do not initiate any actions

now try to mmap

<0 - use default

mmap for all the lifetime of the program, not per stream. AF

preventing buffer rollovers

Skip several frames if it is just booted May get stuck here if compressor is off, it should be enabled externally

get to the end of buffer

wait frame got ready there

One more wait always to make sure compressor is actually running

Definition at line 44 of file video.cpp.

References RTP_Stream::_fd, RTP_Stream::_play, RTP_Stream::_ptype, buffer_length, buffer_ptr, buffer_ptr_s, D, f_quality, fd_circbuf, fd_fparmsall, fd_jpeghead, fd_stream, framepars_all_t::framePars, framePars, frameParsAll, G_THIS_FRAME, GLOBALPARS, framepars_all_t::globalPars, globalPars, RTP_Stream::init_pthread(), LSEEK_CIRC_TOWP, LSEEK_CIRC_WAIT, prev_jpeg_wp, qtables_include, RTP_Stream::rtcp_socket, RTP_Stream::rtp_socket, SEEK_END, RTP_Stream::SSRC, RTP_Stream::stream_name, and waitDaemonEnabled().

Video::~Video ( void   )  [virtual]

Definition at line 106 of file video.cpp.

References fd_circbuf, fd_jpeghead, and fd_stream.


Member Function Documentation

int Video::width ( void   ) 

Definition at line 257 of file video.cpp.

Referenced by Streamer::handler(), Streamer::Main(), and Start().

int Video::height ( void   ) 

Definition at line 265 of file video.cpp.

References D, FRAMEPARS_BEFORE, and interframe_params_t::height.

Referenced by Streamer::handler(), Streamer::Main(), and Start().

int Video::quality ( void   ) 

Definition at line 273 of file video.cpp.

References D, FRAMEPARS_BEFORE, getFramePars(), and interframe_params_t::quality2.

Referenced by capture().

float Video::fps ( void   ) 

Definition at line 280 of file video.cpp.

References D, FRAMEPARS_BEFORE, getFramePars(), interframe_params_t::timestamp_sec, interframe_params_t::timestamp_usec, and used_fps.

Referenced by Streamer::handler(), Streamer::Main(), and Streamer::Streamer().

void Video::fps ( float   ) 

Definition at line 295 of file video.cpp.

References FRAMEPARS_SETFRAME, FRAMES_AHEAD_FPS, FRAMES_SKIP_FPS, GLOBALPARS, LSEEK_FRAME_WAIT_ABS, P_FP1000SLIM, P_FPSFLAGS, SEEK_END, and write.

void Video::Start ( string  ip,
long  port 
)

Definition at line 119 of file video.cpp.

References RTP_Stream::_play, COMPRESSOR_RUN_CONT, D, f_height, f_width, FRAMEPARS_SETFRAME, GLOBALPARS, height(), P_COMPRESSOR_RUN, RTP_Stream::Start(), v_frames, v_t_sec, v_t_usec, width(), and write.

Referenced by Streamer::handler(), and Streamer::Main().

void Video::Stop ( void   )  [virtual]

Reimplemented from RTP_Stream.

Definition at line 142 of file video.cpp.

References RTP_Stream::_play, prev_jpeg_wp, and RTP_Stream::Stop().

Referenced by Streamer::handler().

unsigned long Video::getGPValue ( unsigned long  GPNumber  ) 

Using Video class to interface global camera parameters.

Parameters:
GPNumber parameter number (as defined in c313a.h), G_* parameters have numbers above FRAMEPAR_GLOBALS, P_* - below)
Returns:
parameter value

Definition at line 158 of file video.cpp.

References FRAMEPAR_GLOBALS, framePars, GLOBALPARS, framepars_t::pars, and PARS_FRAMES_MASK.

Referenced by capture().

void Video::setGValue ( unsigned long  GNumber,
unsigned long  value 
)

Set value of the specified global (G_*) parameter.

Parameters:
GNumber - parameter number (as defined in c313a.h)
value - value to set

Definition at line 169 of file video.cpp.

References GLOBALPARS.

bool Video::waitDaemonEnabled ( int  daemonBit  ) 

check if this application is enabled (by appropriate bit in P_DAEMON_EN), if not - and wait until enabled (return false when enabled)

Parameters:
daemonBit - bit number to accept control in P_DAEMON_EN parameter
Returns:
(after possible waiting) true if there was no waiting, false if there was waiting

No semaphors, so it is possible to miss event and wait until the streamer will be re-enabled before sending message, but it seems not so terrible

Definition at line 179 of file video.cpp.

References D, fd_circbuf, GLOBALPARS, lastDaemonBit, LSEEK_DAEMON_CIRCBUF, SEEK_END, and this_frame.

Referenced by Streamer::Main(), and Video().

bool Video::isDaemonEnabled ( int  daemonBit  ) 

check if this application is enabled (by appropriate bit in P_DAEMON_EN)

Parameters:
daemonBit - bit number to accept control in P_DAEMON_EN parameter
Returns:
(after possible waiting) true if there was no waiting, false if there was waiting

Definition at line 197 of file video.cpp.

References framePars, GLOBALPARS, lastDaemonBit, P_DAEMON_EN, and PARS_FRAMES_MASK.

Referenced by Streamer::handler().

long Video::getFramePars ( struct interframe_params_t frame_pars,
long  before 
) [protected]

Return (byte) pointer to valid frame 'before' current(if current is invalid - use latest, wait if none are ready. Restore (or modify if had to wait) file pointer. fill provided frame_pars with the metadata (including the time stamp).

Parameters:
frame_pars - pointer to a interframe parameters structure
before - how many frames before current pointer is needed
Returns:
pointer (offset in circbuf) to the frame start

save orifinal file pointer

Invalid frame - reset to the latest acquired

Last acquired frame (may be not yet available if none are)

try to get earlier valid frame

if 'before' is still >0 - not enough frames acquired, wait for more

copy the interframe data (timestamps are not yet there)

frame_pars->frame_length is now the length of bitstream

find location of the timestamp and copy it to the frame_pars structure ==================================

magic shift - should index first byte of the time stamp

restore the file pointer

Definition at line 211 of file video.cpp.

References buffer_length, buffer_ptr, D, fd_circbuf, LSEEK_CIRC_LAST, LSEEK_CIRC_NEXT, LSEEK_CIRC_PREV, LSEEK_CIRC_VALID, LSEEK_CIRC_WAIT, memcpy(), SEEK_CUR, SEEK_END, and SEEK_SET.

Referenced by capture(), fps(), and quality().

long Video::capture ( void   )  [protected]

Definition at line 313 of file video.cpp.

References buffer_length, buffer_ptr, CCAM_MMAP_META, CCAM_MMAP_META_SEC, D, DAEMON_DISABLED, f_quality, RTP_Stream::f_tv, fd_circbuf, fd_jpeghead, fp, frame_ptr, framePars, G_SKIP_DIFF_FRAME, getFramePars(), getGPValue(), GLOBALPARS, interframe_params_t::height, int, lastDaemonBit, LSEEK_CIRC_TOWP, LSEEK_CIRC_WAIT, memcpy(), P_DAEMON_EN, PARS_FRAMES_MASK, qtable, qtables_include, quality(), read, SEEK_END, SIZE_CHANGE, t, USE_REAL_OLD_TIMESTAMP, used_height, used_width, and interframe_params_t::width.

Referenced by process().

long Video::process ( void   )  [protected, virtual]

Implements RTP_Stream.

Definition at line 439 of file video.cpp.

References RTP_Stream::_play, RTP_Stream::_ptype, capture(), D, data, f, f_height, f_quality, RTP_Stream::f_tv, f_width, frame_ptr, memcpy(), RTP_Stream::packet_num, qtable, qtables_include, RTP_Stream::rtp_octets, RTP_Stream::rtp_packets, RTP_Stream::rtp_socket, Socket::send2v(), Socket::send3v(), RTP_Stream::SSRC, and RTP_Stream::timestamp.


Field Documentation

unsigned long Video::prev_jpeg_wp [protected]

Definition at line 44 of file video.h.

Referenced by Stop(), and Video().

int Video::f_width [protected]

Definition at line 47 of file video.h.

Referenced by process(), and Start().

int Video::f_height [protected]

Definition at line 48 of file video.h.

Referenced by process(), and Start().

int Video::f_quality [protected]

Definition at line 49 of file video.h.

Referenced by capture(), process(), and Video().

bool Video::qtables_include [protected]

Definition at line 50 of file video.h.

Referenced by capture(), process(), and Video().

unsigned char Video::qtable[128] [protected]

Definition at line 51 of file video.h.

Referenced by capture(), and process().

long Video::buffer_length [protected]

Definition at line 53 of file video.h.

Referenced by capture(), getFramePars(), and Video().

unsigned long* Video::buffer_ptr [protected]

Definition at line 54 of file video.h.

Referenced by capture(), getFramePars(), and Video().

unsigned long* Video::buffer_ptr_s [protected]

Definition at line 55 of file video.h.

Referenced by Video().

void* Video::frame_ptr [protected]

Second copy of the circbuf just after the end of the first to prevent rollovers.

Definition at line 56 of file video.h.

Referenced by capture(), and process().

long Video::v_t_sec [protected]

Definition at line 63 of file video.h.

Referenced by Start().

long Video::v_t_usec [protected]

Definition at line 64 of file video.h.

Referenced by Start().

int Video::v_frames [protected]

Definition at line 65 of file video.h.

Referenced by Start().

unsigned long Video::used_width [protected]

Definition at line 66 of file video.h.

Referenced by capture().

unsigned long Video::used_height [protected]

frame width reported by Video::width(), used as the stream width

Definition at line 67 of file video.h.

Referenced by capture().

float Video::used_fps [protected]

similar to above

Definition at line 68 of file video.h.

Referenced by fps().


The documentation for this class was generated from the following files:
Generated on Fri Nov 28 00:08:56 2008 for elphel by  doxygen 1.5.1