#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[]) |
Variables | |
char | trailer [TRAILER_SIZE] = {0xff,0xd9} |
const char | ExifFileName [] = "/dev/exif_exif" |
const char | HeadFileName [] = "/dev/jpeghead" |
const char | SensParsFileName [] = "/dev/sensorpars" |
unsigned long * | ccam_dma_buf |
unsigned long * | imageParamsR |
int | buff_size |
static char | cmdbuf [1024] |
static int | cmdbufp = 0 |
static int | cmdstrt = 0 |
camogm_state | sstate |
camogm_state * | state |
int | debug_level |
FILE * | debug_file |
#define COMMAND_LOOP_DELAY 500000 |
Referenced by main().
#define DEFAULT_DURATION 60 |
#define DEFAULT_EXIF 1 |
#define DEFAULT_FRAMES 16384 |
Next 2 for Quicktime (mostly).
Definition at line 103 of file camogm.c.
Referenced by camogm_init().
#define DEFAULT_FRAMES_PER_CHUNK 10 |
#define DEFAULT_LENGTH 100000000 |
#define MAP_OPTIONS MAP_FILE|MAP_PRIVATE |
Definition at line 88 of file camogm.c.
Referenced by calculateBeamParams(), initVertexArray(), main(), send_buf_image(), send_jpegfile_image(), and sendLastFrame().
#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/>. ! -----------------------------------------------------------------------------** ! !
Definition at line 87 of file camogm.c.
Referenced by cmoscam_open_dma(), x313_dma_lseek(), and x313_dma_read().
int camogm_debug | ( | const char * | fname | ) |
reset circbuf read pointer
Definition at line 263 of file camogm.c.
References debug_file, state, stderr, and stdout.
Referenced by parse_cmd().
Definition at line 283 of file camogm.c.
References debug_level.
Referenced by camogm_init(), and parse_cmd().
void camogm_free | ( | ) |
Definition at line 649 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(), and state.
Referenced by parse_cmd().
int camogm_init | ( | void | ) |
Definition at line 198 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, DEFAULT_DURATION, DEFAULT_EXIF, DEFAULT_FRAMES, DEFAULT_FRAMES_PER_CHUNK, DEFAULT_LENGTH, state, and stderr.
Referenced by main().
void camogm_kml_set_enable | ( | int | d | ) |
kml stuff
Definition at line 673 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_height | ( | double | dd | ) |
Definition at line 685 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_height_mode | ( | int | d | ) |
Definition at line 682 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_horHalfFov | ( | double | dd | ) |
Definition at line 676 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_near | ( | double | dd | ) |
Definition at line 693 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_period | ( | int | d | ) |
Definition at line 688 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_kml_set_vertHalfFov | ( | double | dd | ) |
Definition at line 679 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
int camogm_reset | ( | void | ) |
Definition at line 666 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_exif | ( | int | d | ) |
void camogm_set_format | ( | int | d | ) |
set number of frames to skip, if negative - seconds between frames
Definition at line 733 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, and state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_frames_per_chunk | ( | int | d | ) |
void camogm_set_frames_skip | ( | int | d | ) |
set timescale, default=1.0
set frames to skip (for time lapse)
Definition at line 723 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_max_frames | ( | int | d | ) |
needed for Quicktime - maybe something else?
Definition at line 751 of file camogm.c.
References state.
Referenced by camogm_init().
void camogm_set_prefix | ( | const char * | p | ) |
Definition at line 711 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_save_gp | ( | int | d | ) |
Definition at line 704 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_segment_duration | ( | int | sd | ) |
Definition at line 698 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_segment_length | ( | int | sl | ) |
Definition at line 701 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
void camogm_set_timescale | ( | double | d | ) |
Definition at line 716 of file camogm.c.
References state.
Referenced by camogm_init(), and parse_cmd().
int camogm_start | ( | void | ) |
Definition at line 291 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_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, CIRCLSEEK_LAST, CIRCLSEEK_NEXT, CIRCLSEEK_PREV, CIRCLSEEK_READY, CIRCLSEEK_VALID, D0, D1, D3, debug_file, autoexp_t::height, imageParamsR, memcpy(), P_FREECIRCBUF, read, state, timescale, and autoexp_t::width.
Referenced by main(), and parse_cmd().
void camogm_status | ( | char * | fn, | |
int | xml | |||
) |
Definition at line 759 of file camogm.c.
References CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_OGM, CAMSEQ_JPEG, CAMSEQ_OFF, CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, D0, debug_file, debug_level, autoexp_t::height, imageParamsR, P_CAMSEQSTATE, P_CIRCBUFSIZE, P_FREECIRCBUF, state, stderr, stdout, and autoexp_t::width.
Referenced by parse_cmd().
int camogm_stop | ( | void | ) |
Definition at line 618 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, and state.
Referenced by main(), and parse_cmd().
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 923 of file camogm.c.
References cmdbuf, cmdbufp, and cmdstrt.
Referenced by parse_cmd().
Definition at line 1085 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, CIRCLSEEK_WAIT, cmd, COMMAND_LOOP_DELAY, D0, D1, debug_file, ExifFileName, HeadFileName, imageParamsR, JPEG_HEADER_SIZE, parse_cmd(), sendImageFrame(), SensParsFileName, sstate, state, and usage.
int parse_cmd | ( | FILE * | npipe | ) |
Definition at line 960 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, DEFAULT_DURATION, DEFAULT_LENGTH, and getLineFromPipe().
Referenced by main().
void put_uint16 | ( | void * | buf, | |
u_int16_t | val | |||
) |
======================================================================================================
Definition at line 160 of file camogm.c.
Referenced by camogm_audio_init(), and camogm_start_ogm().
void put_uint32 | ( | void * | buf, | |
u_int32_t | val | |||
) |
void put_uint64 | ( | void * | buf, | |
u_int64_t | val | |||
) |
int sendImageFrame | ( | void | ) |
Definition at line 440 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, CIRCLSEEK_NEXT, CIRCLSEEK_READY, CIRCLSEEK_SETP, D0, D1, D3, debug_file, autoexp_t::height, memcpy(), PACKET_IS_SYNCPOINT, read, state, trailer, and autoexp_t::width.
Referenced by main().
Definition at line 98 of file camogm.c.
Referenced by listener_loop(), main(), PHP_FUNCTION(), sendImage(), and sendLastFrame().
unsigned long* ccam_dma_buf |
Definition at line 96 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(), jpeghead_lseek(), listener_loop(), main(), PHP_FUNCTION(), PHP_MSHUTDOWN_FUNCTION(), sendImage(), sendImageFrame(), and sendLastFrame().
char cmdbuf[1024] [static] |
FILE* debug_file |
Definition at line 117 of file camogm.c.
Referenced by camogm_audio_mov(), 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().
const char ExifFileName[] = "/dev/exif_exif" |
const char HeadFileName[] = "/dev/jpeghead" |
unsigned long* imageParamsR |
Definition at line 97 of file camogm.c.
Referenced by adjust_fps_2_compressor(), advance_imageParamsR(), camogm_start(), camogm_status(), camSeq_interrupt(), camSeqSetJPEG_rp(), camSeqStartClip(), camSeqStop(), ccam_DMA_ioctl(), cmoscam_poll(), compressorRun(), compressorSingle(), compressorStop(), framePointersXML(), get_imageParamsR(), init_autoexp_struct(), init_FPGA(), init_sens(), init_sensor(), main(), PHP_FUNCTION(), PHP_MSHUTDOWN_FUNCTION(), program_early_timestamp(), program_i2c(), program_sensor_exposition_just(), program_smart_irq(), program_trigger(), programSensor(), resetPointers(), set_imageParamsR(), setCamSeqCount(), setCamSeqState(), startAcquire(), updateJPEG_wp(), writeSensorDefaults(), x313_JPEG_cmd_wrapper(), x313_program_focus(), x313_senspars_lseek(), x313_senspars_mmap(), x313_senspars_read(), and x313_senspars_write().
const char SensParsFileName[] = "/dev/sensorpars" |
char trailer[TRAILER_SIZE] = {0xff,0xd9} |
Definition at line 90 of file camogm.c.
Referenced by send_hardware_image(), sendImage(), sendImageFrame(), and sendLastFrame().