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
47834f84
Commit
47834f84
authored
Sep 28, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calculate total data size recorded to raw partition
parent
ac64468a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
camogm.c
src/camogm.c
+7
-5
camogm.h
src/camogm.h
+1
-0
camogm_jpeg.c
src/camogm_jpeg.c
+14
-0
No files found.
src/camogm.c
View file @
47834f84
...
...
@@ -942,7 +942,7 @@ void camogm_set_start_after_timestamp(camogm_state *state, double d)
*/
void
camogm_status
(
camogm_state
*
state
,
char
*
fn
,
int
xml
)
{
int
_len
=
0
;
int
64_t
_len
=
0
;
int
_dur
=
0
,
_udur
=
0
,
_dur_raw
,
_udur_raw
;
FILE
*
f
;
char
*
_state
,
*
_output_format
,
*
_using_exif
,
*
_using_global_pointer
,
*
_compressor_state
[
SENSOR_PORTS
];
...
...
@@ -999,8 +999,10 @@ void camogm_status(camogm_state *state, char * fn, int xml)
return
;
}
}
if
(
state
->
vf
)
_len
=
ftell
(
state
->
vf
);
// for ogm
else
if
((
state
->
ivf
)
>=
0
)
_len
=
lseek
(
state
->
ivf
,
0
,
SEEK_CUR
);
//for mov
if
(
state
->
rawdev_op
)
_len
=
state
->
rawdev
.
total_rec_len
;
else
if
(
state
->
vf
)
_len
=
(
int64_t
)
ftell
(
state
->
vf
);
// for ogm
else
if
((
state
->
ivf
)
>=
0
)
_len
=
(
int64_t
)
lseek
(
state
->
ivf
,
0
,
SEEK_CUR
);
//for mov
switch
(
state
->
prog_state
)
{
case
STATE_STOPPED
:
_state
=
"stopped"
;
...
...
@@ -1036,7 +1038,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
" <frame_number>%d</frame_number>
\n
"
\
" <start_after_timestamp>%f</start_after_timestamp>
\n
"
\
" <file_duration>%d.%06d</file_duration>
\n
"
\
" <file_length>%
d
</file_length>
\n
"
\
" <file_length>%
"
PRId64
"
</file_length>
\n
"
\
" <frames_skip_left>%d</frames_skip_left>
\n
"
\
" <seconds_skip_left>%d</seconds_skip_left>
\n
"
\
" <frame_width>%d</frame_width>
\n
"
\
...
...
@@ -1118,7 +1120,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
fprintf
(
f
,
"frame
\t
%d
\n
"
,
state
->
frameno
);
fprintf
(
f
,
"start_after_timestamp
\t
%f
\n
"
,
state
->
start_after_timestamp
);
fprintf
(
f
,
"file duration
\t
%d.%06d sec
\n
"
,
_dur
,
_udur
);
fprintf
(
f
,
"file length
\t
%
d B
\n
"
,
_len
);
fprintf
(
f
,
"file length
\t
%
"
PRId64
" B
\n
"
,
_len
);
fprintf
(
f
,
"width
\t
%d (0x%x)
\n
"
,
state
->
width
,
state
->
width
);
fprintf
(
f
,
"height
\t
%d (0x%x)
\n
"
,
state
->
height
,
state
->
height
);
fprintf
(
f
,
"
\n
"
);
...
...
src/camogm.h
View file @
47834f84
...
...
@@ -123,6 +123,7 @@ typedef struct {
uint64_t
mmap_current_size
;
uint64_t
mmap_offset
;
uint64_t
file_start
;
int64_t
total_rec_len
;
pthread_t
tid
;
volatile
int
thread_state
;
unsigned
char
*
disk_mmap
;
...
...
src/camogm_jpeg.c
View file @
47834f84
...
...
@@ -41,6 +41,18 @@ void camogm_free_jpeg(void)
{
}
/** Calculate the total length of current frame */
int64_t
camogm_get_jpeg_size
(
camogm_state
*
state
)
{
int64_t
len
=
0
;
for
(
int
i
=
0
;
i
<
state
->
chunk_index
-
1
;
i
++
)
{
len
+=
state
->
packetchunks
[
i
+
1
].
bytes
;
}
return
len
;
}
/**
* @brief Called every time the JPEG files recording is started.
*
...
...
@@ -135,6 +147,8 @@ int camogm_frame_jpeg(camogm_state *state)
D0
(
fprintf
(
debug_file
,
"Can not pass IO vector to driver: %s
\n
"
,
strerror
(
errno
)));
return
-
CAMOGM_FRAME_FILE_ERR
;
}
// update statistics
state
->
rawdev
.
total_rec_len
+=
camogm_get_jpeg_size
(
state
);
}
return
0
;
...
...
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