apps/camogm/camogm.c File Reference

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <time.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/ext353.h>
#include <asm/byteorder.h>
#include <ogg/ogg.h>
#include "ogmstreams.h"
#include "camogm_ogm.h"
#include "camogm_jpeg.h"
#include "camogm_mov.h"
#include "camogm_kml.h"
#include "camogm.h"

Include dependency graph for camogm.c:

Go to the source code of this file.

Defines

#define TRAILER_SIZE   0x02
#define MAP_OPTIONS   MAP_FILE|MAP_PRIVATE
#define DEFAULT_DURATION   60
#define DEFAULT_LENGTH   100000000
#define DEFAULT_FRAMES   16384
 Next 2 for Quicktime (mostly).
#define DEFAULT_FRAMES_PER_CHUNK   10
#define DEFAULT_LENGTH   100000000
#define DEFAULT_EXIF   1
#define COMMAND_LOOP_DELAY   500000

Functions

int camogm_init (void)
int camogm_start (void)
int camogm_stop (void)
int camogm_reset (void)
int camogm_debug (const char *fname)
 reset circbuf read pointer
int camogm_debug_level (int d)
void camogm_set_segment_duration (int sd)
void camogm_set_segment_length (int sl)
void camogm_set_save_gp (int d)
void camogm_set_prefix (const char *p)
void camogm_set_exif (int d)
void camogm_set_timescale (double d)
void camogm_set_frames_skip (int d)
 set timescale, default=1.0
void camogm_set_format (int d)
 set number of frames to skip, if negative - seconds between frames
void camogm_kml_set_enable (int d)
 kml stuff
void camogm_kml_set_horHalfFov (double dd)
void camogm_kml_set_vertHalfFov (double dd)
void camogm_kml_set_height_mode (int d)
void camogm_kml_set_height (double dd)
void camogm_kml_set_period (int d)
void camogm_kml_set_near (double dd)
int parse_cmd (FILE *npipe)
char * getLineFromPipe (FILE *npipe)
 will read from pipe, return pointer to null terminated string if available, NULL otherwise
int sendImageFrame (void)
void camogm_set_max_frames (int d)
 needed for Quicktime - maybe something else?
void camogm_set_frames_per_chunk (int d)
void put_uint16 (void *buf, u_int16_t val)
 ======================================================================================================
void put_uint32 (void *buf, u_int32_t val)
void put_uint64 (void *buf, u_int64_t val)
void camogm_free ()
void camogm_status (char *fn, int xml)
int main (int argc, char *argv[])
unsigned long getGPValue (unsigned long GPNumber)
 Read either G_* parameter (these are 'regular' values defined by number) or P_* parameter (it can be read for up to 6 frames ahead, but current interface only allows to read last/current value).
void setGValue (unsigned long GNumber, unsigned long value)
 Set value of the specified global (G_*) parameter.
int 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)
int isDaemonEnabled (int daemonBit)
 check if this application is enabled (by appropriate bit in P_DAEMON_EN)

Variables

char trailer [TRAILER_SIZE] = {0xff,0xd9}
const char ExifFileName [] = "/dev/exif_exif"
const char HeadFileName [] = "/dev/jpeghead"
const char ctlFileName [] = "/dev/frameparsall"
unsigned long * ccam_dma_buf
int lastDaemonBit = DAEMON_BIT_CAMOGM
framepars_all_tframeParsAll
framepars_tframePars
unsigned long * globalPars
int buff_size
 parameters that are not frame-related, their changes do not initiate any actions
static char cmdbuf [1024]
static int cmdbufp = 0
static int cmdstrt = 0
camogm_state sstate
camogm_statestate
int debug_level
FILE * debug_file


Define Documentation

#define COMMAND_LOOP_DELAY   500000

Referenced by main().

#define DEFAULT_DURATION   60

Definition at line 124 of file camogm.c.

Referenced by camogm_init(), and parse_cmd().

#define DEFAULT_EXIF   1

Definition at line 131 of file camogm.c.

Referenced by camogm_init().

#define DEFAULT_FRAMES   16384

Next 2 for Quicktime (mostly).

Definition at line 127 of file camogm.c.

Referenced by camogm_init().

#define DEFAULT_FRAMES_PER_CHUNK   10

Definition at line 128 of file camogm.c.

Referenced by camogm_init().

#define DEFAULT_LENGTH   100000000

Definition at line 130 of file camogm.c.

#define DEFAULT_LENGTH   100000000

Definition at line 130 of file camogm.c.

Referenced by camogm_init(), and parse_cmd().

#define MAP_OPTIONS   MAP_FILE|MAP_PRIVATE

Definition at line 106 of file camogm.c.

Referenced by main().

#define TRAILER_SIZE   0x02

*************************************************************************** ! FILE NAME : camogm.c ! DESCRIPTION: Program to write captured video (and audio) to camera file system ! using Ogg container. ! Original implementation will copy package data to a buffer to use library calls? ! Copyright (C) 2007 Elphel, Inc. ! -----------------------------------------------------------------------------** ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** ! !

Log
camogm.c,v
! Revision 1.1.1.1 2008/11/27 20:04:01 elphel ! ! ! Revision 1.6 2008/11/21 01:52:53 elphel ! updated for 8.0 ! ! Revision 1.5 2008/11/20 23:21:32 elphel ! Put FIXME notes and removed parameters that are not used anymore ! ! Revision 1.4 2008/10/29 04:18:28 elphel ! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue) ! ! Revision 1.3 2008/10/13 16:55:53 elphel ! removed (some) obsolete P_* parameters, renamed CIRCLSEEK to LSEEK_CIRC constants (same as other similar) ! ! Revision 1.2 2008/09/07 19:48:08 elphel ! snapshot ! ! Revision 1.9 2008/04/13 21:05:19 elphel ! Fixing KML generation ! ! Revision 1.8 2008/04/11 23:09:33 elphel ! modified to handle kml generation ! ! Revision 1.7 2008/04/07 09:13:34 elphel ! Changes related to new Exif generation/processing ! ! Revision 1.6 2008/01/14 22:59:00 elphel ! 7.1.7.4 - added timelapse mode to camogm ! ! Revision 1.5 2007/12/03 08:28:45 elphel ! Multiple changes, mostly cleanup ! ! Revision 1.4 2007/11/29 00:38:57 elphel ! fixed timescale bug ! ! Revision 1.3 2007/11/19 05:07:19 elphel ! fixed 2 typos ! ! Revision 1.2 2007/11/19 03:23:21 elphel ! 7.1.5.5 Added support for *.mov files in camogm. ! ! Revision 1.1 2007/11/16 08:49:56 elphel ! Initial release of camogm - program to record video/image to the camera hard drive (or other storage) !

Definition at line 105 of file camogm.c.


Function Documentation

int camogm_debug ( const char *  fname  ) 

reset circbuf read pointer

Definition at line 287 of file camogm.c.

References debug_file, camogm_state::debug_name, state, stderr, and stdout.

Referenced by parse_cmd().

int camogm_debug_level ( int  d  ) 

Definition at line 307 of file camogm.c.

References debug_level.

Referenced by camogm_init(), and parse_cmd().

void camogm_free (  ) 

Definition at line 678 of file camogm.c.

References CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, camogm_free_jpeg(), camogm_free_mov(), camogm_free_ogm(), f, camogm_state::format, camogm_state::formats, and state.

Referenced by parse_cmd().

int camogm_init ( void   ) 

Definition at line 222 of file camogm.c.

References camogm_debug_level(), CAMOGM_FORMAT_OGM, camogm_kml_set_enable(), camogm_kml_set_height(), camogm_kml_set_height_mode(), camogm_kml_set_horHalfFov(), camogm_kml_set_near(), camogm_kml_set_period(), camogm_kml_set_vertHalfFov(), camogm_reset(), camogm_set_format(), camogm_set_frames_per_chunk(), camogm_set_frames_skip(), camogm_set_max_frames(), camogm_set_prefix(), camogm_set_save_gp(), camogm_set_segment_duration(), camogm_set_segment_length(), camogm_set_timescale(), debug_file, camogm_state::debug_name, DEFAULT_DURATION, DEFAULT_EXIF, DEFAULT_FRAMES, DEFAULT_FRAMES_PER_CHUNK, DEFAULT_LENGTH, camogm_state::exif, camogm_state::exifSize, camogm_state::formats, camogm_state::frame_lengths, camogm_state::frameno, camogm_state::kml_file, camogm_state::kml_path, camogm_state::last, camogm_state::running, camogm_state::serialno, camogm_state::starting, state, stderr, and camogm_state::vf.

Referenced by main().

void camogm_kml_set_enable ( int  d  ) 

kml stuff

Definition at line 702 of file camogm.c.

References camogm_state::kml_enable, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_height ( double  dd  ) 

Definition at line 714 of file camogm.c.

References camogm_state::kml_height, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_height_mode ( int  d  ) 

Definition at line 711 of file camogm.c.

References camogm_state::kml_height_mode, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_horHalfFov ( double  dd  ) 

Definition at line 705 of file camogm.c.

References camogm_state::kml_horHalfFov, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_near ( double  dd  ) 

Definition at line 722 of file camogm.c.

References camogm_state::kml_near, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_period ( int  d  ) 

Definition at line 717 of file camogm.c.

References camogm_state::kml_last_ts, camogm_state::kml_last_uts, camogm_state::kml_period, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_kml_set_vertHalfFov ( double  dd  ) 

Definition at line 708 of file camogm.c.

References camogm_state::kml_vertHalfFov, and state.

Referenced by camogm_init(), and parse_cmd().

int camogm_reset ( void   ) 

Definition at line 695 of file camogm.c.

References camogm_state::buf_overruns, camogm_state::cirbuf_rp, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_exif ( int  d  ) 

Definition at line 736 of file camogm.c.

References camogm_state::exif, and state.

Referenced by parse_cmd().

void camogm_set_format ( int  d  ) 

set number of frames to skip, if negative - seconds between frames

Definition at line 762 of file camogm.c.

References CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, camogm_init_jpeg(), camogm_init_mov(), camogm_init_ogm(), D0, debug_file, camogm_state::format, camogm_state::formats, camogm_state::running, camogm_state::set_format, camogm_state::starting, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_frames_per_chunk ( int  d  ) 

Definition at line 784 of file camogm.c.

References camogm_state::frames_per_chunk, camogm_state::running, camogm_state::set_frames_per_chunk, camogm_state::starting, and state.

Referenced by camogm_init().

void camogm_set_frames_skip ( int  d  ) 

set timescale, default=1.0

set frames to skip (for time lapse)

Definition at line 752 of file camogm.c.

References camogm_state::frames_skip, camogm_state::frames_skip_left, camogm_state::running, camogm_state::set_frames_skip, camogm_state::starting, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_max_frames ( int  d  ) 

needed for Quicktime - maybe something else?

Definition at line 780 of file camogm.c.

References camogm_state::max_frames, camogm_state::running, camogm_state::set_max_frames, camogm_state::starting, and state.

Referenced by camogm_init().

void camogm_set_prefix ( const char *  p  ) 

Definition at line 740 of file camogm.c.

References camogm_state::path_prefix, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_save_gp ( int  d  ) 

Definition at line 733 of file camogm.c.

References camogm_state::save_gp, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_segment_duration ( int  sd  ) 

Definition at line 727 of file camogm.c.

References camogm_state::segment_duration, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_segment_length ( int  sl  ) 

Definition at line 730 of file camogm.c.

References camogm_state::segment_length, and state.

Referenced by camogm_init(), and parse_cmd().

void camogm_set_timescale ( double  d  ) 

Definition at line 745 of file camogm.c.

References camogm_state::running, camogm_state::set_timescale, camogm_state::starting, state, and camogm_state::timescale.

Referenced by camogm_init(), and parse_cmd().

int camogm_start ( void   ) 

Definition at line 315 of file camogm.c.

References camogm_state::buf_min, camogm_state::buf_overruns, CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, CAMOGM_FRAME_BROKEN, CAMOGM_FRAME_CHANGED, CAMOGM_FRAME_NOT_READY, camogm_init_jpeg(), camogm_init_kml(), camogm_init_mov(), camogm_init_ogm(), camogm_start_jpeg(), camogm_start_kml(), camogm_start_mov(), camogm_start_ogm(), ccam_dma_buf, CCAM_MMAP_META, CCAM_MMAP_META_SEC, camogm_state::cirbuf_rp, camogm_state::circ_buff_size, D0, D1, D3, debug_file, camogm_state::fd_circ, camogm_state::fd_head, camogm_state::format, camogm_state::formats, fp, interframe_params_t::frame_length, camogm_state::frame_params, camogm_state::frame_period, camogm_state::frameno, camogm_state::frames_per_chunk, camogm_state::frames_skip, camogm_state::frames_skip_left, G_FREECIRCBUF, getGPValue(), camogm_state::head_size, camogm_state::height, interframe_params_t::height, JPEG_HEADER_MAXSIZE, camogm_state::jpeg_len, camogm_state::jpegHeader, camogm_state::kml_enable, LSEEK_CIRC_LAST, LSEEK_CIRC_NEXT, LSEEK_CIRC_PREV, LSEEK_CIRC_READY, LSEEK_CIRC_VALID, camogm_state::max_frames, memcpy(), camogm_state::metadata_start, read, camogm_state::running, SEEK_END, SEEK_SET, camogm_state::set_format, camogm_state::set_frames_skip, camogm_state::set_max_frames, camogm_state::set_timescale, interframe_params_t::signffff, camogm_state::starting, state, camogm_state::this_frame_params, camogm_state::time_unit, timescale, camogm_state::timescale, interframe_params_t::timestamp_sec, interframe_params_t::timestamp_usec, camogm_state::width, and interframe_params_t::width.

Referenced by main(), and parse_cmd().

void camogm_status ( char *  fn,
int  xml 
)

Definition at line 788 of file camogm.c.

References camogm_state::buf_min, camogm_state::buf_overruns, CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_OGM, camogm_state::cirbuf_rp, D0, debug_file, debug_level, camogm_state::debug_name, camogm_state::exif, f, camogm_state::format, camogm_state::frame_params, camogm_state::frame_period, camogm_state::frameno, camogm_state::frames_per_chunk, camogm_state::frames_skip, camogm_state::frames_skip_left, G_CIRCBUFSIZE, G_FREECIRCBUF, getGPValue(), camogm_state::height, camogm_state::ivf, camogm_state::kml_enable, camogm_state::kml_height, camogm_state::kml_height_mode, camogm_state::kml_horHalfFov, camogm_state::kml_last_ts, camogm_state::kml_last_uts, camogm_state::kml_near, camogm_state::kml_path, camogm_state::kml_period, camogm_state::kml_used, camogm_state::kml_vertHalfFov, camogm_state::max_frames, P_COMPRESSOR_RUN, camogm_state::path, camogm_state::path_prefix, camogm_state::running, camogm_state::save_gp, SEEK_CUR, camogm_state::segment_duration, camogm_state::segment_length, camogm_state::starting, state, stderr, stdout, camogm_state::this_frame_params, camogm_state::timescale, interframe_params_t::timestamp_sec, interframe_params_t::timestamp_usec, camogm_state::vf, and camogm_state::width.

Referenced by parse_cmd().

int camogm_stop ( void   ) 

Definition at line 647 of file camogm.c.

References camogm_end_jpeg(), camogm_end_kml(), camogm_end_mov(), camogm_end_ogm(), CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, D1, D2, debug_file, camogm_state::format, camogm_state::kml_used, camogm_state::last, camogm_state::running, camogm_state::starting, state, and camogm_state::vf.

Referenced by main(), and parse_cmd().

unsigned long getGPValue ( unsigned long  GPNumber  ) 

Read either G_* parameter (these are 'regular' values defined by number) or P_* parameter (it can be read for up to 6 frames ahead, but current interface only allows to read last/current value).

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

Definition at line 1309 of file camogm.c.

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

Referenced by camogm_start(), and camogm_status().

char * getLineFromPipe ( FILE *  npipe  ) 

will read from pipe, return pointer to null terminated string if available, NULL otherwise

remove used string if any

moving overlapping strings

is there any complete string in a buffer?

null-terminate first access (probably not needed for the static buffer

no complete string, try to read more

is there any complete string in a buffer after reading?

there were no new lines before cmdbufp

advance pointer after pipe read

Definition at line 948 of file camogm.c.

References cmdbuf, cmdbufp, and cmdstrt.

Referenced by parse_cmd().

int 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 1345 of file camogm.c.

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

int main ( int  argc,
char *  argv[] 
)

*************************************************************************** ! FILE NAME : autoexposure.c ! DESCRIPTION: Daemon to adjust camera exposure and white balance ! Copyright (C) 2008 Elphel, Inc. ! -----------------------------------------------------------------------------** ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** ! !

Log
autoexposure.c,v
! Revision 1.1.1.1 2008/11/27 20:04:01 elphel ! ! ! Revision 1.16 2008/11/18 19:30:16 elphel ! Added initialization of the "next" frame - otherwise it wait _very_ long if the camera frame number is reset ! ! Revision 1.15 2008/11/15 23:08:24 elphel ! 8.0.alpha17 - split autoexposure source file ! ! Revision 1.14 2008/11/15 07:05:38 elphel ! implemented analog gain control (in addition to gammas) while while balancing ! ! Revision 1.13 2008/11/15 03:10:13 elphel ! Some parameters renamed, reassigned. ! ! Revision 1.12 2008/11/14 07:13:32 elphel ! Added gammaReverse() and gammaDirect() functions, TODO lists, bug fixes ! ! Revision 1.11 2008/11/14 01:01:59 elphel ! cleared debug output ! ! Revision 1.10 2008/11/13 05:40:45 elphel ! 8.0.alpha16 - modified histogram storage, profiling ! ! Revision 1.9 2008/11/08 05:52:21 elphel ! debug feature ! ! Revision 1.8 2008/11/04 17:40:34 elphel ! comment typos ! ! Revision 1.7 2008/11/02 00:32:35 elphel ! added TODO ! ! Revision 1.6 2008/10/31 18:26:32 elphel ! Adding support for constants like SENSOR_REGS32 (defined constant plus 32 to simplify referencing sensor registers from PHP ! ! Revision 1.5 2008/10/29 04:18:28 elphel ! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue) ! ! Revision 1.4 2008/10/28 07:05:12 elphel ! implemented white balance, HDR mode (1/1 and 2/2) ! ! Revision 1.3 2008/10/26 05:55:38 elphel ! snapshot ! ! Revision 1.2 2008/10/25 19:49:15 elphel ! 8.0.alpha8 - added autoexposure to the installation ! ! Revision 1.1 2008/10/24 00:34:12 elphel ! initial release !

no command line options processing yet

open Exif header file

open JPEG header file

open circbuf and mmap it (once at startup)

find total buffer length (it is in defines, actually in c313a.h

Now open/mmap file to read sensor/compressor parameters (currently - just free memory in circbuf and compressor state)

open circbuf and mmap it (once at startup)

now try to mmap

create a named pipe always delete the pipe if it existed, start a fresh one

now should not exist

now open the pipe - will block until something will be written (or just open for writing Reads themselves will not block

Here is a main loop. If recording is on, it will check for commands after each frame, if it is off - poll with fixed usleep

look at command queue first

no commands in queue, started

frame sent OK, nothing to do (TODO: check file length/duration)

just wait for the frame to appear at the current pointer

we'll wait for a frame, not to waste resources. But if the compressor is stopped this program will not respond to any commands TODO - add another wait with (short) timeout?

frame parameters have changed

next file needed (need to switch to a new file (time/size exceeded limit)

invalid frame pointer

frame broken (buffer overrun)

restart the file

error with file I/O

other errors

no commands in queue,starting (but not started yet)

retry starting

file started OK, nothing to do

just wait for the frame to appear at the current pointer

we'll wait for a frame, not to waste resources. But if the compressor is stopped this program will not respond to any commands TODO - add another wait with (short) timeout?

frame parameters have changed

invalid frame pointer

frame broken (buffer overrun)

it should be not too long so empty buffer will not be overrun

error with file I/O

other errors

not running, not starting

make it longer but interruptible by signals?

Definition at line 1110 of file camogm.c.

References CAMOGM_FRAME_BROKEN, CAMOGM_FRAME_CHANGED, CAMOGM_FRAME_FILE_ERR, CAMOGM_FRAME_INVALID, CAMOGM_FRAME_NEXTFILE, CAMOGM_FRAME_NOT_READY, CAMOGM_FRAME_OTHER, camogm_init(), camogm_start(), camogm_stop(), ccam_dma_buf, camogm_state::circ_buff_size, cmd, COMMAND_LOOP_DELAY, ctlFileName, D0, D1, debug_file, ExifFileName, exit, camogm_state::fd_circ, camogm_state::fd_exif, camogm_state::fd_fparmsall, camogm_state::fd_head, framepars_all_t::framePars, framePars, frameParsAll, framepars_all_t::globalPars, globalPars, camogm_state::head_size, HeadFileName, JPEG_HEADER_MAXSIZE, LSEEK_CIRC_WAIT, parse_cmd(), camogm_state::running, SEEK_END, sendImageFrame(), sstate, camogm_state::starting, state, and usage.

int parse_cmd ( FILE *  npipe  ) 

Definition at line 985 of file camogm.c.

References camogm_debug(), camogm_debug_level(), CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_OGM, camogm_free(), camogm_kml_set_enable(), camogm_kml_set_height(), camogm_kml_set_height_mode(), camogm_kml_set_horHalfFov(), camogm_kml_set_near(), camogm_kml_set_period(), camogm_kml_set_vertHalfFov(), camogm_reset(), camogm_set_exif(), camogm_set_format(), camogm_set_frames_skip(), camogm_set_prefix(), camogm_set_save_gp(), camogm_set_segment_duration(), camogm_set_segment_length(), camogm_set_timescale(), camogm_start(), camogm_status(), camogm_stop(), cmd, d, DEFAULT_DURATION, DEFAULT_LENGTH, exit, and getLineFromPipe().

Referenced by main().

void put_uint16 ( void *  buf,
u_int16_t  val 
)

======================================================================================================

Definition at line 184 of file camogm.c.

Referenced by camogm_audio_init(), and camogm_start_ogm().

void put_uint32 ( void *  buf,
u_int32_t  val 
)

Definition at line 194 of file camogm.c.

Referenced by camogm_audio_init(), and camogm_start_ogm().

void put_uint64 ( void *  buf,
u_int64_t  val 
)

Definition at line 206 of file camogm.c.

Referenced by camogm_audio_init(), and camogm_start_ogm().

int sendImageFrame ( void   ) 

Definition at line 469 of file camogm.c.

References CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, CAMOGM_FRAME_BROKEN, CAMOGM_FRAME_CHANGED, CAMOGM_FRAME_INVALID, camogm_frame_jpeg(), camogm_frame_kml(), camogm_frame_mov(), CAMOGM_FRAME_NOT_READY, camogm_frame_ogm(), ccam_dma_buf, CCAM_MMAP_META, CCAM_MMAP_META_SEC, camogm_state::chunk_index, camogm_state::cirbuf_rp, camogm_state::circ_buff_size, D0, D1, D3, debug_file, camogm_state::ed, camogm_state::exif, camogm_state::exifSize, camogm_state::fd_circ, camogm_state::fd_exif, camogm_state::format, interframe_params_t::frame_length, camogm_state::frame_params, camogm_state::frameno, camogm_state::frames_skip, camogm_state::frames_skip_left, camogm_state::head_size, interframe_params_t::height, camogm_state::ivf, camogm_state::jpeg_len, camogm_state::jpegHeader, camogm_state::kml_used, LSEEK_CIRC_NEXT, LSEEK_CIRC_READY, LSEEK_CIRC_SETP, camogm_state::max_frames, memcpy(), interframe_params_t::meta_index, camogm_state::metadata_start, PACKET_IS_SYNCPOINT, camogm_state::packetchunks, read, camogm_state::save_gp, SEEK_CUR, SEEK_END, SEEK_SET, camogm_state::segment_duration, camogm_state::segment_length, camogm_state::set_format, interframe_params_t::signffff, state, camogm_state::this_frame_params, interframe_params_t::timestamp_sec, trailer, camogm_state::vf, and interframe_params_t::width.

Referenced by main().

void 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 1320 of file camogm.c.

References GLOBALPARS.

int 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 1330 of file camogm.c.

References camogm_state::fd_circ, G_THIS_FRAME, GLOBALPARS, lastDaemonBit, LSEEK_DAEMON_CIRCBUF, SEEK_END, state, and this_frame.


Variable Documentation

int buff_size

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

Definition at line 122 of file camogm.c.

Referenced by listener_loop(), main(), metaXML(), PHP_FUNCTION(), and sendImage().

unsigned long* ccam_dma_buf

Definition at line 114 of file camogm.c.

Referenced by camogm_start(), circbuf_lseek(), circbuf_mmap(), circbuf_read(), circbuf_write(), circbufValidPointer(), grab_and_send(), init_ccam_dma_buf_ptr(), listener_loop(), main(), metaXML(), PHP_FUNCTION(), sendImage(), and sendImageFrame().

char cmdbuf[1024] [static]

Definition at line 133 of file camogm.c.

Referenced by getLineFromPipe().

int cmdbufp = 0 [static]

Definition at line 134 of file camogm.c.

Referenced by getLineFromPipe().

int cmdstrt = 0 [static]

Definition at line 135 of file camogm.c.

Referenced by getLineFromPipe().

const char ctlFileName[] = "/dev/frameparsall"

Definition at line 113 of file camogm.c.

Referenced by framePointersXML(), and main().

FILE* debug_file

Definition at line 141 of file camogm.c.

Referenced by camogm_debug(), camogm_end_mov(), camogm_end_ogm(), camogm_frame_jpeg(), camogm_frame_kml(), camogm_frame_mov(), camogm_frame_ogm(), camogm_init(), camogm_init_mov(), camogm_set_format(), camogm_start(), camogm_start_jpeg(), camogm_start_kml(), camogm_start_mov(), camogm_start_ogm(), camogm_status(), camogm_stop(), main(), ogm_flush_to_file(), parse(), parse_special(), quicktime_template_parser(), and sendImageFrame().

int debug_level

Definition at line 140 of file camogm.c.

Referenced by camogm_debug_level(), and camogm_status().

const char ExifFileName[] = "/dev/exif_exif"

Definition at line 110 of file camogm.c.

Referenced by main(), and sendImage().

struct framepars_t* framePars

Definition at line 118 of file camogm.c.

struct framepars_all_t* frameParsAll

Definition at line 117 of file camogm.c.

unsigned long* globalPars

Definition at line 119 of file camogm.c.

const char HeadFileName[] = "/dev/jpeghead"

Definition at line 112 of file camogm.c.

Referenced by main(), and sendImage().

int lastDaemonBit = DAEMON_BIT_CAMOGM

Definition at line 116 of file camogm.c.

camogm_state sstate

Definition at line 137 of file camogm.c.

Referenced by main().

camogm_state* state

Definition at line 138 of file camogm.c.

Referenced by audio_end(), audio_init(), audio_process(), audio_start(), begin_wave(), camogm_audio_init(), camogm_debug(), camogm_end_kml(), camogm_end_mov(), camogm_end_ogm(), camogm_frame_jpeg(), camogm_frame_kml(), camogm_frame_mov(), camogm_frame_ogm(), camogm_free(), camogm_init(), camogm_kml_set_enable(), camogm_kml_set_height(), camogm_kml_set_height_mode(), camogm_kml_set_horHalfFov(), camogm_kml_set_near(), camogm_kml_set_period(), camogm_kml_set_vertHalfFov(), camogm_reset(), camogm_set_audio_format(), camogm_set_audio_state(), camogm_set_exif(), camogm_set_format(), camogm_set_frames_per_chunk(), camogm_set_frames_skip(), camogm_set_max_frames(), camogm_set_prefix(), camogm_set_save_gp(), camogm_set_segment_duration(), camogm_set_segment_length(), camogm_set_sync_state(), camogm_set_timescale(), camogm_start(), camogm_start_jpeg(), camogm_start_kml(), camogm_start_mov(), camogm_start_ogm(), camogm_status(), camogm_stop(), createDefaultConfig(), main(), RTSP_Server::main(), nand_get_device(), nand_release_device(), nand_wait(), ogm_flush_to_file(), parse(), sendImageFrame(), waitDaemonEnabled(), and write_coil_form().

char trailer[TRAILER_SIZE] = {0xff,0xd9}

Definition at line 108 of file camogm.c.

Referenced by sendImage(), and sendImageFrame().


Generated on Fri Nov 28 00:06:47 2008 for elphel by  doxygen 1.5.1