Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
43d82520
Commit
43d82520
authored
Oct 01, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/recorder, test/*: invoke encoder_read() after _open()
Make sure the file header gets written at the beginning, before _write() gets called.
parent
674b4ab6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
encoder_plugin.h
src/encoder_plugin.h
+4
-0
recorder_output_plugin.c
src/output/recorder_output_plugin.c
+7
-0
run_encoder.c
test/run_encoder.c
+2
-0
test_vorbis_encoder.c
test/test_vorbis_encoder.c
+2
-0
No files found.
src/encoder_plugin.h
View file @
43d82520
...
@@ -119,6 +119,10 @@ encoder_finish(struct encoder *encoder)
...
@@ -119,6 +119,10 @@ encoder_finish(struct encoder *encoder)
* Before you free it, you must call encoder_close(). You may open
* Before you free it, you must call encoder_close(). You may open
* and close (reuse) one encoder any number of times.
* and close (reuse) one encoder any number of times.
*
*
* After this function returns successfully and before the first
* encoder_write() call, you should invoke encoder_read() to obtain
* the file header.
*
* @param encoder the encoder
* @param encoder the encoder
* @param audio_format the encoder's input audio format; the plugin
* @param audio_format the encoder's input audio format; the plugin
* may modify the struct to adapt it to its abilities
* may modify the struct to adapt it to its abilities
...
...
src/output/recorder_output_plugin.c
View file @
43d82520
...
@@ -192,6 +192,13 @@ recorder_output_open(struct audio_output *ao,
...
@@ -192,6 +192,13 @@ recorder_output_open(struct audio_output *ao,
return
false
;
return
false
;
}
}
if
(
!
recorder_output_encoder_to_file
(
recorder
,
error_r
))
{
encoder_close
(
recorder
->
encoder
);
close
(
recorder
->
fd
);
unlink
(
recorder
->
path
);
return
false
;
}
return
true
;
return
true
;
}
}
...
...
test/run_encoder.c
View file @
43d82520
...
@@ -106,6 +106,8 @@ int main(int argc, char **argv)
...
@@ -106,6 +106,8 @@ int main(int argc, char **argv)
return
1
;
return
1
;
}
}
encoder_to_stdout
(
encoder
);
/* do it */
/* do it */
while
((
nbytes
=
read
(
0
,
buffer
,
sizeof
(
buffer
)))
>
0
)
{
while
((
nbytes
=
read
(
0
,
buffer
,
sizeof
(
buffer
)))
>
0
)
{
...
...
test/test_vorbis_encoder.c
View file @
43d82520
...
@@ -67,6 +67,8 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
...
@@ -67,6 +67,8 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
success
=
encoder_open
(
encoder
,
&
audio_format
,
NULL
);
success
=
encoder_open
(
encoder
,
&
audio_format
,
NULL
);
assert
(
success
);
assert
(
success
);
encoder_to_stdout
(
encoder
);
/* write a block of data */
/* write a block of data */
success
=
encoder_write
(
encoder
,
zero
,
sizeof
(
zero
),
NULL
);
success
=
encoder_write
(
encoder
,
zero
,
sizeof
(
zero
),
NULL
);
...
...
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