Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
2e89b4c0
Commit
2e89b4c0
authored
Jun 09, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: single threaded app
Record jpegs from all channels
parent
c4ef6af1
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
160 additions
and
151 deletions
+160
-151
camogm.c
camogm.c
+145
-137
camogm.h
camogm.h
+2
-2
camogm_jpeg.c
camogm_jpeg.c
+2
-1
camogm_kml.c
camogm_kml.c
+6
-6
camogm_mov.c
camogm_mov.c
+1
-1
camogm_ogm.c
camogm_ogm.c
+4
-4
No files found.
camogm.c
View file @
2e89b4c0
This diff is collapsed.
Click to expand it.
camogm.h
View file @
2e89b4c0
...
...
@@ -100,8 +100,8 @@ typedef struct {
int
head_size
[
SENSOR_PORTS
];
//! JPEG header size
unsigned
char
jpegHeader
[
SENSOR_PORTS
][
JPEG_HEADER_MAXSIZE
];
int
metadata_start
;
struct
interframe_params_t
frame_params
;
struct
interframe_params_t
this_frame_params
;
struct
interframe_params_t
frame_params
[
SENSOR_PORTS
]
;
struct
interframe_params_t
this_frame_params
[
SENSOR_PORTS
]
;
int
jpeg_len
;
int
frame_period
[
SENSOR_PORTS
];
//!in microseconds (1/10 of what is needed for the Ogm header)
int
width
;
...
...
camogm_jpeg.c
View file @
2e89b4c0
...
...
@@ -134,6 +134,7 @@ int camogm_frame_jpeg(camogm_state *state)
struct
iovec
chunks_iovec
[
8
];
unsigned
char
*
split_ptr
=
NULL
;
long
split_cntr
=
0
;
int
port
=
state
->
port_num
;
if
(
!
state
->
rawdev_op
)
{
l
=
0
;
...
...
@@ -143,7 +144,7 @@ int camogm_frame_jpeg(camogm_state *state)
l
+=
chunks_iovec
[
i
].
iov_len
;
}
sprintf
(
state
->
path
,
"%s%010ld_%06ld.jpeg"
,
state
->
path_prefix
,
state
->
this_frame_params
.
timestamp_sec
,
state
->
this_frame_params
.
timestamp_usec
);
sprintf
(
state
->
path
,
"%s%010ld_%06ld.jpeg"
,
state
->
path_prefix
,
state
->
this_frame_params
[
port
].
timestamp_sec
,
state
->
this_frame_params
[
port
]
.
timestamp_usec
);
if
(((
state
->
ivf
=
open
(
state
->
path
,
O_RDWR
|
O_CREAT
,
0777
)))
<
0
)
{
D0
(
fprintf
(
debug_file
,
"Error opening %s for writing, returned %d, errno=%d
\n
"
,
state
->
path
,
state
->
ivf
,
errno
));
return
-
CAMOGM_FRAME_FILE_ERR
;
...
...
camogm_kml.c
View file @
2e89b4c0
...
...
@@ -139,7 +139,7 @@ int camogm_start_kml(camogm_state *state)
}
}
close
(
fd_ExifDir
);
sprintf
(
state
->
kml_path
,
"%s%010ld_%06ld.kml"
,
state
->
path_prefix
,
state
->
this_frame_params
.
timestamp_sec
,
state
->
this_frame_params
.
timestamp_usec
);
sprintf
(
state
->
kml_path
,
"%s%010ld_%06ld.kml"
,
state
->
path_prefix
,
state
->
this_frame_params
[
state
->
port_num
].
timestamp_sec
,
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_usec
);
if
(
!
((
state
->
kml_file
=
fopen
(
state
->
kml_path
,
"w+"
)))
)
{
D0
(
fprintf
(
debug_file
,
"Error opening %s for writing
\n
"
,
state
->
kml_path
));
return
-
CAMOGM_FRAME_FILE_ERR
;
...
...
@@ -168,15 +168,15 @@ int camogm_frame_kml(camogm_state *state)
int
port
=
state
->
port_num
;
if
(
state
->
kml_file
)
{
// probably not needed
i
=
state
->
this_frame_params
.
timestamp_sec
-
(
state
->
kml_last_ts
+
state
->
kml_period
);
if
((
i
>
1
)
||
((
i
==
0
)
&&
(
state
->
this_frame_params
.
timestamp_usec
>
state
->
kml_last_uts
)))
{
i
=
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_sec
-
(
state
->
kml_last_ts
+
state
->
kml_period
);
if
((
i
>
1
)
||
((
i
==
0
)
&&
(
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_usec
>
state
->
kml_last_uts
)))
{
// if (state->this_frame_params.timestamp_sec > (state->kml_last_ts + state->kml_period)) { // this way it is safe to put kml_period=1000, then kml_period=1
state
->
kml_last_ts
=
state
->
this_frame_params
.
timestamp_sec
;
state
->
kml_last_uts
=
state
->
this_frame_params
.
timestamp_usec
;
state
->
kml_last_ts
=
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_sec
;
state
->
kml_last_uts
=
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_usec
;
if
(
state
->
format
==
CAMOGM_FORMAT_JPEG
)
{
strcpy
(
JPEGFileName
,
state
->
path
);
}
else
{
sprintf
(
JPEGFileName
,
"%s%010ld_%06ld.jpeg"
,
state
->
path_prefix
,
state
->
this_frame_params
.
timestamp_sec
,
state
->
this_frame_params
.
timestamp_usec
);
sprintf
(
JPEGFileName
,
"%s%010ld_%06ld.jpeg"
,
state
->
path_prefix
,
state
->
this_frame_params
[
state
->
port_num
].
timestamp_sec
,
state
->
this_frame_params
[
state
->
port_num
]
.
timestamp_usec
);
if
(((
fd_JPEG
=
open
(
JPEGFileName
,
O_RDWR
|
O_CREAT
,
0777
)))
>=
0
)
{
l
=
0
;
for
(
i
=
0
;
i
<
(
state
->
chunk_index
)
-
1
;
i
++
)
{
...
...
camogm_mov.c
View file @
2e89b4c0
...
...
@@ -153,7 +153,7 @@ int camogm_start_mov(camogm_state *state)
//! allocate memory for the frame index table
if
(
!
((
state
->
frame_lengths
=
malloc
(
4
*
state
->
max_frames
))))
return
-
CAMOGM_FRAME_MALLOC
;
//! open file for writing
sprintf
(
state
->
path
,
"%s%010ld_%06ld.mov"
,
state
->
path_prefix
,
state
->
frame_params
.
timestamp_sec
,
state
->
frame_params
.
timestamp_usec
);
sprintf
(
state
->
path
,
"%s%010ld_%06ld.mov"
,
state
->
path_prefix
,
state
->
frame_params
[
state
->
port_num
].
timestamp_sec
,
state
->
frame_params
[
state
->
port_num
]
.
timestamp_usec
);
if
(((
state
->
ivf
=
open
(
state
->
path
,
O_RDWR
|
O_CREAT
,
0777
)))
<
0
)
{
D0
(
fprintf
(
debug_file
,
"Error opening %s for writing, returned %d, errno=%d
\n
"
,
state
->
path
,
state
->
ivf
,
errno
));
return
-
CAMOGM_FRAME_FILE_ERR
;
...
...
camogm_ogm.c
View file @
2e89b4c0
...
...
@@ -73,10 +73,10 @@ int camogm_start_ogm(camogm_state *state)
char
vendor
[]
=
"ElphelOgm v 0.1"
;
int
pos
;
stream_header
sh
;
char
hdbuf
[
sizeof
(
sh
)
+
1
];
unsigned
char
hdbuf
[
sizeof
(
sh
)
+
1
];
ogg_packet
ogg_header
;
sprintf
(
state
->
path
,
"%s%010ld_%06ld.ogm"
,
state
->
path_prefix
,
state
->
frame_params
.
timestamp_sec
,
state
->
frame_params
.
timestamp_usec
);
sprintf
(
state
->
path
,
"%s%010ld_%06ld.ogm"
,
state
->
path_prefix
,
state
->
frame_params
[
state
->
port_num
].
timestamp_sec
,
state
->
frame_params
[
state
->
port_num
]
.
timestamp_usec
);
if
(
!
((
state
->
vf
=
fopen
(
state
->
path
,
"w+"
)))
)
{
D0
(
fprintf
(
debug_file
,
"Error opening %s for writing
\n
"
,
state
->
path
));
return
-
CAMOGM_FRAME_FILE_ERR
;
...
...
@@ -153,8 +153,8 @@ int camogm_start_ogm(camogm_state *state)
*/
//! calculate initial absolute granulepos (from 1970), then increment with each frame. Later try calculating granulepos of each frame
//! from the absolute time (actual timestamp)
state
->
granulepos
=
(
ogg_int64_t
)(
(((
double
)
state
->
frame_params
.
timestamp_usec
)
+
(((
double
)
1000000
)
*
((
double
)
state
->
frame_params
.
timestamp_sec
)))
*
state
->
granulepos
=
(
ogg_int64_t
)(
(((
double
)
state
->
frame_params
[
state
->
port_num
]
.
timestamp_usec
)
+
(((
double
)
1000000
)
*
((
double
)
state
->
frame_params
[
state
->
port_num
]
.
timestamp_sec
)))
*
((
double
)
10
)
/
((
double
)
state
->
time_unit
)
*
((
double
)
state
->
timescale
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment