#include <video.h>
Inherits RTP_Stream.
Inheritance diagram for Video:
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 |
Definition at line 15 of file video.h.
enum Video::vevent |
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] |
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.
GPNumber | parameter number (as defined in c313a.h), G_* parameters have numbers above FRAMEPAR_GLOBALS, P_* - below) |
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.
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)
daemonBit | - bit number to accept control in P_DAEMON_EN parameter |
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)
daemonBit | - bit number to accept control in P_DAEMON_EN parameter |
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).
frame_pars | - pointer to a interframe parameters structure | |
before | - how many frames before current pointer is needed |
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.
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.
unsigned long Video::prev_jpeg_wp [protected] |
int Video::f_width [protected] |
int Video::f_height [protected] |
int Video::f_quality [protected] |
bool Video::qtables_include [protected] |
unsigned char Video::qtable[128] [protected] |
long Video::buffer_length [protected] |
unsigned long* Video::buffer_ptr [protected] |
unsigned long* Video::buffer_ptr_s [protected] |
void* Video::frame_ptr [protected] |
long Video::v_t_sec [protected] |
long Video::v_t_usec [protected] |
int Video::v_frames [protected] |
unsigned long Video::used_width [protected] |
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] |