Commit c5b381e3 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Prepare code for audio recording

Now, state->frame_lengths contains not only video frames lengths but audio
sample lengths as well if audio recording is enabled.
parent 697be65d
...@@ -222,10 +222,17 @@ typedef struct { ...@@ -222,10 +222,17 @@ typedef struct {
double start_after_timestamp; ///< delay recording start to after frame timestamp double start_after_timestamp; ///< delay recording start to after frame timestamp
int max_frames; int max_frames;
int set_max_frames; int set_max_frames;
int frames_per_chunk; int frames_per_chunk; ///< QuickTime, the number of samples (images or audio samples) in a chunk
int set_frames_per_chunk; ///< quicktime - index for fast forward? int set_frames_per_chunk; ///< QuickTime, index for fast forward (sample-to-chunk atom)
int frameno; int frameno; ///< total image frame counter, does not include audio samples
int *frame_lengths; unsigned long *frame_lengths; ///< QuickTime; pointer to an array of frame lengths wich includes both image frames
///< 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
///< if MSB = 1 then this is audio sample. Stealing one bit from the length field
///< effectively limits the size of one frame to 2 GiB which should be more than enough
///< for all purposes.
long frame_index; ///< QuickTime; total frame counter including audio samples (if enabled), this is used
///< as an index for frame_lengths array
off_t frame_data_start; ///< Quicktime (and else?) - frame data start (0xff 0xd8...) off_t frame_data_start; ///< Quicktime (and else?) - frame data start (0xff 0xd8...)
ogg_int64_t time_unit; ogg_int64_t time_unit;
int formats; ///< bitmask of used (initialized) formats int formats; ///< bitmask of used (initialized) formats
......
...@@ -50,7 +50,7 @@ void audio_init(struct audio *audio, bool restart) ...@@ -50,7 +50,7 @@ void audio_init(struct audio *audio, bool restart)
} }
// set up audio device // set up audio device
if (restart) { if (restart) {
int err; int err = 0;
bool init_ok = false; bool init_ok = false;
unsigned int t = audio->audio_rate; unsigned int t = audio->audio_rate;
unsigned int period_time = 40 * 1000; unsigned int period_time = 40 * 1000;
......
This diff is collapsed.
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
# 0017 # 0017
# 0020 # 0020
# } # }
# 00000000 # ??? # 00000000 # optional terminating 32-bit value, see description of User Data Atom
# } # }
} }
!data_size !data_size
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
0017 0017
0020 0020
} }
00000000 # ??? 00000000 # optional terminating 32-bit value, see description of User Data Atom
} }
} }
!data_size !data_size
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment