#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 <sched.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 "camogm_wav.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 600 |
#define | DEFAULT_LENGTH (700 * 1024 * 1024) |
#define | DEFAULT_FRAMES 16384 |
Next 2 for Quicktime (mostly). | |
#define | DEFAULT_FRAMES_PER_CHUNK 1 |
#define | DEFAULT_EXIF 1 |
#define | DEFAULT_AUDIO_RATE 44100 |
#define | DEFAULT_AUDIO_CHANNELS 2 |
#define | AUDIO_RATE_MAX 44100 |
#define | AUDIO_RATE_MIN 11025 |
#define | AUDIO_CHANNELS_MAX 2 |
#define | AUDIO_CHANNELS_MIN 1 |
#define | COMMAND_LOOP_DELAY 500000 |
Functions | |
int | camogm_init (void) |
int | camogm_start (int by_command) |
int | camogm_stop (int by_command) |
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 | camogm_set_audio_state (char *args) |
void | camogm_set_audio_format (char *args) |
void | camogm_set_sync_state (char *args) |
void | audio_process (void) |
void | audio_init (int by_command) |
void | audio_start (int by_command) |
void | audio_end (int by_command) |
void | audio_free (void) |
void | camogm_audio_initialize (void) |
int | time_comp (struct timeval *t1, struct timeval *t2) |
====================================================================================================== | |
void | time_normalize (struct timeval *tv) |
timeval | time_delta (struct timeval *t1, struct timeval *t2) |
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 | audio_finish (int by_command) |
void | camogm_free () |
void | camogm_status (char *fn, int xml) |
int | main (int argc, char *argv[]) |
void | audio_init (by_command) |
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 |
timeval | v_ts |
#define AUDIO_CHANNELS_MAX 2 |
#define AUDIO_CHANNELS_MIN 1 |
#define AUDIO_RATE_MAX 44100 |
#define AUDIO_RATE_MIN 11025 |
#define COMMAND_LOOP_DELAY 500000 |
#define DEFAULT_FRAMES 16384 |
#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/>. ! -----------------------------------------------------------------------------** ! !
void audio_end | ( | int | by_command | ) |
Definition at line 1882 of file camogm.c.
References context_audio_t::audio_present, context_audio_t::audio_set, CAMOGM_FORMAT_JPEG, context_audio_t::capture_handle, ctx_a, DA, free(), context_audio_t::sbuffer, state, and stderr.
Referenced by audio_finish().
void audio_finish | ( | int | by_command | ) |
Definition at line 770 of file camogm.c.
References audio_end(), audio_process(), ctx_a, DA, EXT_GET_TIME_SYNC, fd_stream, context_audio_t::movie_start, state, stderr, context_audio_t::time_last, time_normalize(), and context_audio_t::to_finish_samples.
Referenced by camogm_stop().
void audio_init | ( | by_command | ) |
Definition at line 1738 of file camogm.c.
References context_audio_t::audio_count, context_audio_t::audio_present, AUDIO_SBUFFER_PREFIX, context_audio_t::audio_set, context_audio_t::audio_skip_samples, context_audio_t::begin_of_stream_with_audio, context_audio_t::begin_of_stream_with_audio_trigger, CAMOGM_FORMAT_JPEG, context_audio_t::capture_handle, ctx_a, DA, EXT_GET_TIME_SYNC, fd_stream, malloc(), context_audio_t::sample_time, context_audio_t::sbuffer, context_audio_t::sbuffer_len, state, stderr, and time_normalize().
void audio_init | ( | int | by_command | ) |
Referenced by camogm_start().
void audio_process | ( | void | ) |
Definition at line 1606 of file camogm.c.
References context_audio_t::audio_count, context_audio_t::audio_present, AUDIO_SBUFFER_PREFIX, context_audio_t::audio_skip_samples, camogm_audio_mov(), camogm_audio_ogm_push(), CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_OGM, context_audio_t::capture_handle, ctx_a, DA, context_audio_t::movie_start, context_audio_t::sample_time, context_audio_t::sbuffer, context_audio_t::sbuffer_len, state, stderr, time_comp(), context_audio_t::time_last, time_normalize(), and context_audio_t::to_finish_samples.
Referenced by audio_finish(), and main().
void audio_start | ( | int | by_command | ) |
Definition at line 1857 of file camogm.c.
References context_audio_t::audio_count, CAMOGM_FORMAT_JPEG, ctx_a, DA, state, stderr, context_audio_t::time_last, and context_audio_t::to_finish_samples.
Referenced by camogm_start().
void camogm_audio_initialize | ( | void | ) |
Definition at line 1598 of file camogm.c.
References context_audio_t::audio_present, context_audio_t::audio_set, context_audio_t::capture_handle, ctx_a, context_audio_t::sample_time, and context_audio_t::sbuffer.
int camogm_debug | ( | const char * | fname | ) |
reset circbuf read pointer
void camogm_free | ( | ) |
Definition at line 864 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.
int camogm_init | ( | void | ) |
void camogm_kml_set_enable | ( | int | d | ) |
kml stuff
void camogm_kml_set_height | ( | double | dd | ) |
void camogm_kml_set_height_mode | ( | int | d | ) |
void camogm_kml_set_horHalfFov | ( | double | dd | ) |
void camogm_kml_set_near | ( | double | dd | ) |
void camogm_kml_set_period | ( | int | d | ) |
void camogm_kml_set_vertHalfFov | ( | double | dd | ) |
int camogm_reset | ( | void | ) |
void camogm_set_audio_format | ( | char * | args | ) |
Definition at line 1565 of file camogm.c.
References AUDIO_CHANNELS_MAX, AUDIO_CHANNELS_MIN, AUDIO_RATE_MAX, AUDIO_RATE_MIN, buf, DA, state, and stderr.
void camogm_set_audio_state | ( | char * | args | ) |
void camogm_set_exif | ( | int | d | ) |
void camogm_set_format | ( | int | d | ) |
set number of frames to skip, if negative - seconds between frames
void camogm_set_frames_per_chunk | ( | int | d | ) |
void camogm_set_frames_skip | ( | int | d | ) |
set timescale, default=1.0
void camogm_set_max_frames | ( | int | d | ) |
needed for Quicktime - maybe something else?
void camogm_set_prefix | ( | const char * | p | ) |
void camogm_set_save_gp | ( | int | d | ) |
void camogm_set_segment_duration | ( | int | sd | ) |
void camogm_set_segment_length | ( | int | sl | ) |
void camogm_set_sync_state | ( | char * | args | ) |
void camogm_set_timescale | ( | double | d | ) |
Definition at line 371 of file camogm.c.
References audio_init(), audio_start(), 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.
void camogm_status | ( | char * | fn, | |
int | xml | |||
) |
Definition at line 978 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_level, autoexp_t::height, imageParamsR, P_CAMSEQSTATE, P_CIRCBUFSIZE, P_FREECIRCBUF, state, stderr, stdout, and autoexp_t::width.
Definition at line 826 of file camogm.c.
References audio_finish(), context_audio_t::audio_present, camogm_end_jpeg(), camogm_end_kml(), camogm_end_mov(), camogm_end_ogm(), CAMOGM_FORMAT_JPEG, CAMOGM_FORMAT_MOV, CAMOGM_FORMAT_NONE, CAMOGM_FORMAT_OGM, ctx_a, D1, D2, and state.
char* getLineFromPipe | ( | FILE * | npipe | ) |
will read from pipe, return pointer to null terminated string if available, NULL otherwise
Definition at line 1332 of file camogm.c.
References audio_process(), 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, COMMAND_LOOP_DELAY, D0, D1, ExifFileName, HeadFileName, imageParamsR, JPEG_HEADER_SIZE, parse_cmd(), sendImageFrame(), SensParsFileName, sstate, state, stderr, and usage.
int parse_cmd | ( | FILE * | npipe | ) |
void put_uint16 | ( | void * | buf, | |
u_int16_t | val | |||
) |
int sendImageFrame | ( | void | ) |
int time_comp | ( | struct timeval * | t1, | |
struct timeval * | t2 | |||
) |
======================================================================================================
Definition at line 199 of file camogm.c.
Referenced by audio_process().
struct timeval time_delta | ( | struct timeval * | t1, | |
struct timeval * | t2 | |||
) |
void time_normalize | ( | struct timeval * | tv | ) |
Definition at line 211 of file camogm.c.
Referenced by audio_finish(), audio_init(), and audio_process().
unsigned long* ccam_dma_buf |
FILE* debug_file |
const char ExifFileName[] = "/dev/exif_exif" |
const char HeadFileName[] = "/dev/jpeghead" |
unsigned long* imageParamsR |
const char SensParsFileName[] = "/dev/sensorpars" |