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
Hide 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)
...
@@ -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
)
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
;
int
_dur
=
0
,
_udur
=
0
,
_dur_raw
,
_udur_raw
;
FILE
*
f
;
FILE
*
f
;
char
*
_state
,
*
_output_format
,
*
_using_exif
,
*
_using_global_pointer
,
*
_compressor_state
[
SENSOR_PORTS
];
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)
...
@@ -999,8 +999,10 @@ void camogm_status(camogm_state *state, char * fn, int xml)
return
;
return
;
}
}
}
}
if
(
state
->
vf
)
_len
=
ftell
(
state
->
vf
);
// for ogm
if
(
state
->
rawdev_op
)
else
if
((
state
->
ivf
)
>=
0
)
_len
=
lseek
(
state
->
ivf
,
0
,
SEEK_CUR
);
//for mov
_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
)
{
switch
(
state
->
prog_state
)
{
case
STATE_STOPPED
:
case
STATE_STOPPED
:
_state
=
"stopped"
;
_state
=
"stopped"
;
...
@@ -1036,7 +1038,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
...
@@ -1036,7 +1038,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
" <frame_number>%d</frame_number>
\n
"
\
" <frame_number>%d</frame_number>
\n
"
\
" <start_after_timestamp>%f</start_after_timestamp>
\n
"
\
" <start_after_timestamp>%f</start_after_timestamp>
\n
"
\
" <file_duration>%d.%06d</file_duration>
\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
"
\
" <frames_skip_left>%d</frames_skip_left>
\n
"
\
" <seconds_skip_left>%d</seconds_skip_left>
\n
"
\
" <seconds_skip_left>%d</seconds_skip_left>
\n
"
\
" <frame_width>%d</frame_width>
\n
"
\
" <frame_width>%d</frame_width>
\n
"
\
...
@@ -1118,7 +1120,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
...
@@ -1118,7 +1120,7 @@ void camogm_status(camogm_state *state, char * fn, int xml)
fprintf
(
f
,
"frame
\t
%d
\n
"
,
state
->
frameno
);
fprintf
(
f
,
"frame
\t
%d
\n
"
,
state
->
frameno
);
fprintf
(
f
,
"start_after_timestamp
\t
%f
\n
"
,
state
->
start_after_timestamp
);
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 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
,
"width
\t
%d (0x%x)
\n
"
,
state
->
width
,
state
->
width
);
fprintf
(
f
,
"height
\t
%d (0x%x)
\n
"
,
state
->
height
,
state
->
height
);
fprintf
(
f
,
"height
\t
%d (0x%x)
\n
"
,
state
->
height
,
state
->
height
);
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"
\n
"
);
...
...
src/camogm.h
View file @
47834f84
...
@@ -123,6 +123,7 @@ typedef struct {
...
@@ -123,6 +123,7 @@ typedef struct {
uint64_t
mmap_current_size
;
uint64_t
mmap_current_size
;
uint64_t
mmap_offset
;
uint64_t
mmap_offset
;
uint64_t
file_start
;
uint64_t
file_start
;
int64_t
total_rec_len
;
pthread_t
tid
;
pthread_t
tid
;
volatile
int
thread_state
;
volatile
int
thread_state
;
unsigned
char
*
disk_mmap
;
unsigned
char
*
disk_mmap
;
...
...
src/camogm_jpeg.c
View file @
47834f84
...
@@ -41,6 +41,18 @@ void camogm_free_jpeg(void)
...
@@ -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.
* @brief Called every time the JPEG files recording is started.
*
*
...
@@ -135,6 +147,8 @@ int camogm_frame_jpeg(camogm_state *state)
...
@@ -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
)));
D0
(
fprintf
(
debug_file
,
"Can not pass IO vector to driver: %s
\n
"
,
strerror
(
errno
)));
return
-
CAMOGM_FRAME_FILE_ERR
;
return
-
CAMOGM_FRAME_FILE_ERR
;
}
}
// update statistics
state
->
rawdev
.
total_rec_len
+=
camogm_get_jpeg_size
(
state
);
}
}
return
0
;
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