Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
b66a5eef
Commit
b66a5eef
authored
Sep 11, 2015
by
François Grisez
Browse files
Fix MKV recorder: recorded files were not correctly closed
parent
ec510dc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
src/videofilters/mkv.c
src/videofilters/mkv.c
+31
-32
No files found.
src/videofilters/mkv.c
View file @
b66a5eef
...
...
@@ -1003,7 +1003,7 @@ static void matroska_set_doctype_version(Matroska *obj, int doctypeVersion, int
}
static
inline
void
matroska_write_ebml_header
(
Matroska
*
obj
)
{
EBML_ElementRender
((
ebml_element
*
)
obj
->
header
,
obj
->
output
,
WRITE_DEFAULT_ELEMENT
,
FALSE
,
FALSE
,
NULL
);
EBML_ElementRender
((
ebml_element
*
)
obj
->
header
,
obj
->
output
,
TRUE
,
FALSE
,
FALSE
,
NULL
);
}
static
int
matroska_set_segment_info
(
Matroska
*
obj
,
const
char
writingApp
[],
const
char
muxingApp
[],
double
duration
)
{
...
...
@@ -1883,42 +1883,41 @@ static int recorder_close(MSFilter *f, void *arg) {
goto
end
;
}
if
(
obj
->
state
==
MSRecorderRunning
)
{
for
(
i
=
0
;
i
<
f
->
desc
->
ninputs
;
i
++
)
{
if
(
obj
->
inputDescsList
[
i
]
!=
NULL
)
{
if
(
matroska_track_check_block_presence
(
&
obj
->
file
,
i
+
1
))
{
uint8_t
*
codecPrivateData
=
NULL
;
size_t
codecPrivateDataSize
;
module_get_private_data
(
obj
->
modulesList
[
i
],
&
codecPrivateData
,
&
codecPrivateDataSize
);
matroska_track_set_info
(
&
obj
->
file
,
i
+
1
,
obj
->
inputDescsList
[
i
]);
if
(
codecPrivateDataSize
>
0
)
{
matroska_track_set_codec_private
(
&
obj
->
file
,
i
+
1
,
codecPrivateData
,
codecPrivateDataSize
);
}
ms_free
(
codecPrivateData
);
}
else
{
matroska_del_track
(
&
obj
->
file
,
i
+
1
);
for
(
i
=
0
;
i
<
f
->
desc
->
ninputs
;
i
++
)
{
if
(
obj
->
inputDescsList
[
i
]
!=
NULL
)
{
if
(
matroska_track_check_block_presence
(
&
obj
->
file
,
i
+
1
))
{
uint8_t
*
codecPrivateData
=
NULL
;
size_t
codecPrivateDataSize
;
module_get_private_data
(
obj
->
modulesList
[
i
],
&
codecPrivateData
,
&
codecPrivateDataSize
);
matroska_track_set_info
(
&
obj
->
file
,
i
+
1
,
obj
->
inputDescsList
[
i
]);
if
(
codecPrivateDataSize
>
0
)
{
matroska_track_set_codec_private
(
&
obj
->
file
,
i
+
1
,
codecPrivateData
,
codecPrivateDataSize
);
}
ms_free
(
codecPrivateData
);
}
else
{
matroska_del_track
(
&
obj
->
file
,
i
+
1
);
}
}
matroska_close_cluster
(
&
obj
->
file
);
if
(
matroska_write_cues
(
&
obj
->
file
)
!=
0
)
{
ms_warning
(
"MKVRecorder: no cues written"
);
}
}
if
(
obj
->
openMode
==
MKV_OPEN_CREATE
)
{
matroska_go_to_segment_info_mark
(
&
obj
->
file
);
}
else
{
matroska_go_to_segment_info_begin
(
&
obj
->
file
);
}
obj
->
duration
++
;
matroska_set_segment_info
(
&
obj
->
file
,
"libmediastreamer2"
,
"libmediastreamer2"
,
obj
->
duration
);
matroska_write_segment_info
(
&
obj
->
file
);
matroska_write_tracks
(
&
obj
->
file
);
matroska_go_to_segment_begin
(
&
obj
->
file
);
matroska_write_metaSeek
(
&
obj
->
file
);
matroska_go_to_file_end
(
&
obj
->
file
);
matroska_close_segment
(
&
obj
->
file
);
matroska_close_cluster
(
&
obj
->
file
);
if
(
matroska_write_cues
(
&
obj
->
file
)
!=
0
)
{
ms_warning
(
"MKVRecorder: no cues written"
);
}
if
(
obj
->
openMode
==
MKV_OPEN_CREATE
)
{
matroska_go_to_segment_info_mark
(
&
obj
->
file
);
}
else
{
matroska_go_to_segment_info_begin
(
&
obj
->
file
);
}
obj
->
duration
++
;
matroska_set_segment_info
(
&
obj
->
file
,
"libmediastreamer2"
,
"libmediastreamer2"
,
obj
->
duration
);
matroska_write_segment_info
(
&
obj
->
file
);
matroska_write_tracks
(
&
obj
->
file
);
matroska_go_to_segment_begin
(
&
obj
->
file
);
matroska_write_metaSeek
(
&
obj
->
file
);
matroska_go_to_file_end
(
&
obj
->
file
);
matroska_close_segment
(
&
obj
->
file
);
matroska_close_file
(
&
obj
->
file
);
for
(
i
=
0
;
i
<
f
->
desc
->
ninputs
;
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