apps/camogm2/camogm_mov.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_mov.h"
#include "camogm.h"

Include dependency graph for camogm_mov.c:

Go to the source code of this file.

Defines

#define QUICKTIME_MIN_HEADER   0x300
 Not all are needed, just copied from the camogm.c.

Functions

int quicktime_template_parser (const char *i_iFile, int i_ofd, int i_width, int i_height, int i_nframes, int i_sample_dur, int i_samplesPerChunk, int i_framesize, int i_timescale, int *i_sizes, int data_start)
void putBigEndian (unsigned long d, int l)
int parse_special (void)
int parse (int top)
int camogm_init_mov (void)
void camogm_free_mov (void)
int camogm_start_mov (void)
int camogm_frame_mov (void)
int camogm_audio_mov (void *buf, int len, int slen)
int camogm_end_mov (void)
 move to the start of the file and insert generated header
char * sfgets (char *str, int size, const char *stream, int *pos)
 temporary replacement for fgets to read from string

Variables

const char hexStr [] = "0123456789abcdef"
 for the parser
char qtSourceFileName_video [] = "/etc/qt_video"
 *
char qtSourceFileName_audio [] = "/etc/qt_audio"
char * qtSourceFileName = NULL
char comStr [1024]
int width = 1280
int height = 1024
int nframes = 100
int sample_dur = 80
int samplesPerChunk = 10
int framesize = 80000
int timescale = 600
intsizes
int iPos
int ofd
 position in the string "iFile"
int iFileLen
char * q_template = NULL
long headerSize = 0
const char * iFile = NULL
unsigned long audio_rate = 0
unsigned short audio_channels = 0
int audio_timescale
long audio_duration


Define Documentation

#define QUICKTIME_MIN_HEADER   0x300

Not all are needed, just copied from the camogm.c.

*************************************************************************** ! FILE NAME : camogm_mov.c ! DESCRIPTION: Provides writing to file compatible with Apple Quicktime(R) for camogm !TODO: Nothing yet here, will be added ASAP ! 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_mov.c,v
! Revision 1.5 2008/06/06 10:53:32 spectr_rain ! clean ! ! Revision 1.4 2008/06/02 19:49:41 spectr_rain ! fixed QuickTime compatibility - need to cleanup ! ! Revision 1.2 2008/05/23 13:09:49 spectr_rain ! QuickTime support ! ! Revision 1.1 2008/05/02 12:45:58 spectr_rain ! initial revision with the sound support ! ! Revision 1.4 2008/04/11 23:09:33 elphel ! modified to handle kml generation ! ! Revision 1.3 2007/11/19 17:00:20 elphel ! removed wrong dependency ! ! 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:57 elphel ! Initial release of camogm - program to record video/image to the camera hard drive (or other storage) !

Definition at line 78 of file camogm_mov.c.


Function Documentation

int camogm_audio_mov ( void *  buf,
int  len,
int  slen 
)

Definition at line 234 of file camogm_mov.c.

References CAMOGM_FRAME_FILE_ERR, D0, debug_file, state, and write.

Referenced by audio_process().

int camogm_end_mov ( void   ) 

move to the start of the file and insert generated header

frame period measured in 1/10000 of a second?

that was in old code. If that works - try to switch to microseconds

4-byte length+"mdat"

now - string containing header template

output file descriptor (opened)

width in pixels

frame size - will look in the table

array of frame lengths to build an index

free memory used for index

Definition at line 267 of file camogm_mov.c.

References D4, debug_file, free(), he, autoexp_t::height, q_template, quicktime_template_parser(), read, state, stderr, timescale, autoexp_t::width, and write.

int camogm_frame_mov ( void   ) 

Definition at line 204 of file camogm_mov.c.

References CAMOGM_FRAME_FILE_ERR, D0, debug_file, state, and stderr.

void camogm_free_mov ( void   ) 

Definition at line 161 of file camogm_mov.c.

References free(), and q_template.

int camogm_init_mov ( void   ) 

called first time format is changed to this one (only once) recording is stopped read frame template from the file if it is not done yet

Definition at line 131 of file camogm_mov.c.

References context_audio_t::audio_present, CAMOGM_FRAME_FILE_ERR, CAMOGM_FRAME_MALLOC, ctx_a, D0, debug_file, free(), malloc(), q_template, qtSourceFileName, qtSourceFileName_audio, and qtSourceFileName_video.

int camogm_start_mov ( void   ) 

Definition at line 168 of file camogm_mov.c.

References context_audio_t::audio_present, CAMOGM_FRAME_FILE_ERR, CAMOGM_FRAME_MALLOC, ctx_a, D0, DA, debug_file, malloc(), QUICKTIME_MIN_HEADER, state, and stderr.

int parse ( int  top  ) 

Definition at line 95 of file qtime.c.

References comStr, D, hexStr, infile, outfile, parse(), parse_special(), and putBigEndian().

int parse_special ( void   ) 

Definition at line 38 of file qtime.c.

References D, framesize, headerSize, height, infile, nframes, putBigEndian(), sample_dur, samplesPerChunk, sizes, time, timescale, and width.

void putBigEndian ( unsigned long  d,
int  l 
)

Definition at line 31 of file qtime.c.

References outfile.

int quicktime_template_parser ( const char *  i_iFile,
int  i_ofd,
int  i_width,
int  i_height,
int  i_nframes,
int  i_sample_dur,
int  i_samplesPerChunk,
int  i_framesize,
int  i_timescale,
int i_sizes,
int  data_start 
)

Parameters:
i_ofd  now - string containing header template
i_width  output file descriptor (opened)

char* sfgets ( char *  str,
int  size,
const char *  stream,
int pos 
)

temporary replacement for fgets to read from string

pointer to last before

Definition at line 323 of file camogm_mov.c.

References eol, and memcpy().


Variable Documentation

unsigned short audio_channels = 0

Definition at line 109 of file camogm_mov.c.

long audio_duration

Definition at line 111 of file camogm_mov.c.

unsigned long audio_rate = 0

Definition at line 108 of file camogm_mov.c.

int audio_timescale

Definition at line 110 of file camogm_mov.c.

char comStr[1024]

Definition at line 91 of file camogm_mov.c.

int framesize = 80000

Definition at line 97 of file camogm_mov.c.

long headerSize = 0

Definition at line 105 of file camogm_mov.c.

int height = 1024

Definition at line 93 of file camogm_mov.c.

const char hexStr[] = "0123456789abcdef"

for the parser

Definition at line 85 of file camogm_mov.c.

const char* iFile = NULL

Definition at line 106 of file camogm_mov.c.

int iFileLen

Definition at line 103 of file camogm_mov.c.

int iPos

Definition at line 100 of file camogm_mov.c.

int nframes = 100

Definition at line 94 of file camogm_mov.c.

int ofd

position in the string "iFile"

Definition at line 102 of file camogm_mov.c.

char* q_template = NULL

Definition at line 104 of file camogm_mov.c.

char* qtSourceFileName = NULL

Definition at line 90 of file camogm_mov.c.

char qtSourceFileName_audio[] = "/etc/qt_audio"

Definition at line 88 of file camogm_mov.c.

Referenced by camogm_init_mov().

char qtSourceFileName_video[] = "/etc/qt_video"

*

Definition at line 87 of file camogm_mov.c.

Referenced by camogm_init_mov().

int sample_dur = 80

Definition at line 95 of file camogm_mov.c.

int samplesPerChunk = 10

Definition at line 96 of file camogm_mov.c.

int* sizes

Definition at line 99 of file camogm_mov.c.

int timescale = 600

Definition at line 98 of file camogm_mov.c.

int width = 1280

Definition at line 92 of file camogm_mov.c.


Generated on Thu Aug 7 16:19:29 2008 for elphel by  doxygen 1.5.1