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
7e3873de
Commit
7e3873de
authored
Mar 29, 2017
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset write pointer to start when disk end is reached
parent
84ebd545
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
camogm_align.c
src/camogm_align.c
+4
-1
camogm_jpeg.c
src/camogm_jpeg.c
+1
-10
No files found.
src/camogm_align.c
View file @
7e3873de
...
...
@@ -106,6 +106,7 @@ static inline size_t align_bytes_num(size_t data_len, size_t align_len)
return
align_len
-
rem
;
}
/** Remap vectors pointing to various buffers with frame data to vectors used during frame alignment */
static
void
remap_vectors
(
camogm_state
*
state
,
struct
iovec
*
chunks
)
{
int
chunk_index
=
1
;
...
...
@@ -177,6 +178,7 @@ static size_t get_blocks_num(struct iovec *sgl, size_t n_elem)
return
total
/
PHY_BLOCK_SIZE
;
}
/** Allocate and initialize buffers for frame alignment */
int
init_align_buffers
(
camogm_state
*
state
)
{
state
->
writer_params
.
data_chunks
=
(
struct
iovec
*
)
malloc
(
MAX_DATA_CHUNKS
*
sizeof
(
struct
iovec
));
...
...
@@ -211,6 +213,7 @@ int init_align_buffers(camogm_state *state)
return
0
;
}
/** Delete buffers for frame alignment */
void
deinit_align_buffers
(
camogm_state
*
state
)
{
struct
writer_params
*
params
=
&
state
->
writer_params
;
...
...
@@ -408,7 +411,6 @@ void align_frame(camogm_state *state)
}
else
{
/* the frame is aligned to sector boundary but some buffers may be not */
chunks
[
CHUNK_ALIGN
].
iov_base
=
vectrpos
(
cbuff
,
0
);
// chunks[CHUNK_ALIGN].iov_dma = cbuff->iov_dma + cbuff->iov_len;
chunks
[
CHUNK_ALIGN
].
iov_len
=
0
;
if
(
chunks
[
CHUNK_DATA_1
].
iov_len
==
0
)
{
data_len
=
chunks
[
CHUNK_DATA_0
].
iov_len
%
ALIGNMENT_SIZE
;
...
...
@@ -510,6 +512,7 @@ int prep_last_block(camogm_state *state)
return
ret
;
}
/** Convert LBA to byte offset used for lseek */
off64_t
lba_to_offset
(
uint64_t
lba
)
{
return
lba
*
PHY_BLOCK_SIZE
;
...
...
src/camogm_jpeg.c
View file @
7e3873de
...
...
@@ -329,6 +329,7 @@ int camogm_frame_jpeg(camogm_state *state)
align_frame
(
state
);
if
(
update_lba
(
state
)
==
1
)
{
D0
(
fprintf
(
debug_file
,
"The end of block device reached, continue recording from start
\n
"
));
lseek
(
state
->
writer_params
.
blockdev_fd
,
0
,
SEEK_SET
);
}
D6
(
fprintf
(
debug_file
,
"Block device positions: start = %llu, current = %llu, end = %llu
\n
"
,
state
->
writer_params
.
lba_start
,
state
->
writer_params
.
lba_current
,
state
->
writer_params
.
lba_end
));
...
...
@@ -342,10 +343,6 @@ int camogm_frame_jpeg(camogm_state *state)
if
(
state
->
writer_params
.
last_ret_val
!=
0
)
{
return
state
->
writer_params
.
last_ret_val
;
}
// update statistics
// state->rawdev.last_jpeg_size = camogm_get_jpeg_size(state);
// state->rawdev.total_rec_len += state->rawdev.last_jpeg_size;
}
return
0
;
...
...
@@ -424,12 +421,6 @@ void *jpeg_writer(void *thread_args)
if
(
params
->
data_ready
)
{
l
=
0
;
state
->
writer_params
.
last_ret_val
=
0
;
// for (int i = 0; i < (state->chunk_index) - 1; i++) {
// chunks_iovec[i].iov_base = state->packetchunks[i + 1].chunk;
// chunks_iovec[i].iov_len = state->packetchunks[i + 1].bytes;
// l += chunks_iovec[i].iov_len;
// }
// chunk_index = state->chunk_index;
chunk_index
=
get_data_buffers
(
state
,
&
chunks_iovec
,
FILE_CHUNKS_NUM
);
if
(
chunk_index
>
0
)
{
for
(
int
i
=
0
;
i
<
chunk_index
;
i
++
)
...
...
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