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
74b40b6b
Commit
74b40b6b
authored
Jun 16, 2017
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incorrect initialization between consequent files
parent
313f638e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
4 deletions
+9
-4
camogm.c
src/camogm.c
+2
-2
camogm.h
src/camogm.h
+1
-1
camogm_audio.c
src/camogm_audio.c
+2
-1
camogm_mov.c
src/camogm_mov.c
+4
-0
No files found.
src/camogm.c
View file @
74b40b6b
...
@@ -373,6 +373,7 @@ int camogm_start(camogm_state *state, bool restart)
...
@@ -373,6 +373,7 @@ int camogm_start(camogm_state *state, bool restart)
state
->
formats
|=
1
<<
(
state
->
format
);
state
->
formats
|=
1
<<
(
state
->
format
);
// exit on unknown formats?
// exit on unknown formats?
}
}
state
->
chunk_frame_cntr
=
state
->
frames_per_chunk
;
state
->
max_frames
=
state
->
set_max_frames
;
state
->
max_frames
=
state
->
set_max_frames
;
state
->
frames_per_chunk
=
state
->
set_frames_per_chunk
;
state
->
frames_per_chunk
=
state
->
set_frames_per_chunk
;
pthread_mutex_lock
(
&
state
->
mutex
);
pthread_mutex_lock
(
&
state
->
mutex
);
...
@@ -729,7 +730,6 @@ int sendImageFrame(camogm_state *state)
...
@@ -729,7 +730,6 @@ int sendImageFrame(camogm_state *state)
}
else
{
}
else
{
D6
(
fprintf
(
debug_file
,
"save video frame with time: %ld:%06ld
\n
"
,
state
->
audio
.
ts_video
.
tv_sec
,
state
->
audio
.
ts_video
.
tv_usec
));
D6
(
fprintf
(
debug_file
,
"save video frame with time: %ld:%06ld
\n
"
,
state
->
audio
.
ts_video
.
tv_sec
,
state
->
audio
.
ts_video
.
tv_usec
));
state
->
audio
.
begin_of_stream_with_audio
=
0
;
state
->
audio
.
begin_of_stream_with_audio
=
0
;
state
->
chunk_frame_cntr
=
state
->
frames_per_chunk
;
}
}
}
}
...
@@ -1812,7 +1812,7 @@ int listener_loop(camogm_state *state)
...
@@ -1812,7 +1812,7 @@ int listener_loop(camogm_state *state)
}
else
if
(
state
->
prog_state
==
STATE_STARTING
)
{
// no commands in queue,starting (but not started yet)
}
else
if
(
state
->
prog_state
==
STATE_STARTING
)
{
// no commands in queue,starting (but not started yet)
// retry starting
// retry starting
switch
((
rslt
=
-
camogm_start
(
state
,
tru
e
)))
{
switch
((
rslt
=
-
camogm_start
(
state
,
fals
e
)))
{
case
0
:
case
0
:
break
;
// file started OK, nothing to do
break
;
// file started OK, nothing to do
case
CAMOGM_TOO_EARLY
:
case
CAMOGM_TOO_EARLY
:
...
...
src/camogm.h
View file @
74b40b6b
...
@@ -226,7 +226,7 @@ typedef struct {
...
@@ -226,7 +226,7 @@ typedef struct {
unsigned
int
chunk_frame_cntr
;
///< QuickTime, number of video frames recorded in current chunk
unsigned
int
chunk_frame_cntr
;
///< QuickTime, number of video frames recorded in current chunk
int
set_frames_per_chunk
;
///< QuickTime, index for fast forward (sample-to-chunk atom)
int
set_frames_per_chunk
;
///< QuickTime, index for fast forward (sample-to-chunk atom)
int
frameno
;
///< total image frame counter, does not include audio samples
int
frameno
;
///< total image frame counter, does not include audio samples
unsigned
long
*
frame_lengths
;
///< QuickTime; pointer to an array of frame lengths wich includes both image frames
unsigned
long
*
frame_lengths
;
///< QuickTime; pointer to an array of frame lengths w
h
ich includes both image frames
///< and audio samples if audio recording is enabled. MSB of each entry indicates
///< and audio samples if audio recording is enabled. MSB of each entry indicates
///< the type of frame this length relates to: if MSB = 0 then this is images frame and
///< the type of frame this length relates to: if MSB = 0 then this is images frame and
///< if MSB = 1 then this is audio sample. Stealing one bit from the length field
///< if MSB = 1 then this is audio sample. Stealing one bit from the length field
...
...
src/camogm_audio.c
View file @
74b40b6b
...
@@ -170,7 +170,6 @@ void audio_init_sw(struct audio *audio, bool restart, int frames)
...
@@ -170,7 +170,6 @@ void audio_init_sw(struct audio *audio, bool restart, int frames)
audio
->
ctx_a
.
time_last
.
tv_sec
=
0
;
audio
->
ctx_a
.
time_last
.
tv_sec
=
0
;
audio
->
ctx_a
.
time_last
.
tv_usec
=
0
;
audio
->
ctx_a
.
time_last
.
tv_usec
=
0
;
audio
->
ctx_a
.
sample_time
=
SAMPLE_TIME
;
audio
->
ctx_a
.
sample_time
=
SAMPLE_TIME
;
audio
->
ctx_a
.
sbuffer_pos
=
0
;
if
(
audio
->
audio_enable
==
0
)
if
(
audio
->
audio_enable
==
0
)
return
;
return
;
...
@@ -182,6 +181,8 @@ void audio_init_sw(struct audio *audio, bool restart, int frames)
...
@@ -182,6 +181,8 @@ void audio_init_sw(struct audio *audio, bool restart, int frames)
assert
(
audio
->
ctx_a
.
sbuffer
==
NULL
);
assert
(
audio
->
ctx_a
.
sbuffer
==
NULL
);
audio
->
ctx_a
.
sbuffer_pos
=
0
;
/* decide if camogm can sleep using lseek into video buffer: if audio HW buffer size is less than
/* decide if camogm can sleep using lseek into video buffer: if audio HW buffer size is less than
* video frame period then we need to process audio stream between video frames and must use shorter
* video frame period then we need to process audio stream between video frames and must use shorter
* sleep periods to prevent buffer overflow, and we are good if audio HW buffer is bigger than
* sleep periods to prevent buffer overflow, and we are good if audio HW buffer is bigger than
...
...
src/camogm_mov.c
View file @
74b40b6b
...
@@ -266,6 +266,9 @@ static int camogm_audio_mov(struct audio *audio, void *buff, long len, long slen
...
@@ -266,6 +266,9 @@ static int camogm_audio_mov(struct audio *audio, void *buff, long len, long slen
/**
/**
* @brief Move to the start of the file and insert generated header
* @brief Move to the start of the file and insert generated header
* Asserts:
* array of frame lengths is not defined;
* array of sample-to-chunk audio atoms is not defined;
* @param[in] state pointer to the #camogm_state structure for current sensor port
* @param[in] state pointer to the #camogm_state structure for current sensor port
* @return this function is always successful and returns 0
* @return this function is always successful and returns 0
*/
*/
...
@@ -275,6 +278,7 @@ int camogm_end_mov(camogm_state *state)
...
@@ -275,6 +278,7 @@ int camogm_end_mov(camogm_state *state)
int
port
=
state
->
port_num
;
int
port
=
state
->
port_num
;
assert
(
state
->
frame_lengths
);
assert
(
state
->
frame_lengths
);
assert
(
state
->
audio
.
audio_samples_to_chunk
);
timescale
=
10000
;
// frame period measured in 1/10000 of a second?
timescale
=
10000
;
// frame period measured in 1/10000 of a second?
// that was in old code. If that works - try to switch to microseconds
// that was in old code. If that works - try to switch to microseconds
...
...
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