Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
c972a28f
Unverified
Commit
c972a28f
authored
Apr 08, 2016
by
Rodger Combs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/dashenc: add deinit function
parent
e83d5d7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
34 deletions
+17
-34
dashenc.c
libavformat/dashenc.c
+17
-34
No files found.
libavformat/dashenc.c
View file @
c972a28f
...
@@ -580,16 +580,12 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -580,16 +580,12 @@ static int dash_write_header(AVFormatContext *s)
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
oformat
=
av_guess_format
(
"mp4"
,
NULL
,
NULL
);
oformat
=
av_guess_format
(
"mp4"
,
NULL
,
NULL
);
if
(
!
oformat
)
{
if
(
!
oformat
)
ret
=
AVERROR_MUXER_NOT_FOUND
;
return
AVERROR_MUXER_NOT_FOUND
;
goto
fail
;
}
c
->
streams
=
av_mallocz
(
sizeof
(
*
c
->
streams
)
*
s
->
nb_streams
);
c
->
streams
=
av_mallocz
(
sizeof
(
*
c
->
streams
)
*
s
->
nb_streams
);
if
(
!
c
->
streams
)
{
if
(
!
c
->
streams
)
ret
=
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
goto
fail
;
}
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
OutputStream
*
os
=
&
c
->
streams
[
i
];
OutputStream
*
os
=
&
c
->
streams
[
i
];
...
@@ -606,17 +602,13 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -606,17 +602,13 @@ static int dash_write_header(AVFormatContext *s)
int
level
=
s
->
strict_std_compliance
>=
FF_COMPLIANCE_STRICT
?
int
level
=
s
->
strict_std_compliance
>=
FF_COMPLIANCE_STRICT
?
AV_LOG_ERROR
:
AV_LOG_WARNING
;
AV_LOG_ERROR
:
AV_LOG_WARNING
;
av_log
(
s
,
level
,
"No bit rate set for stream %d
\n
"
,
i
);
av_log
(
s
,
level
,
"No bit rate set for stream %d
\n
"
,
i
);
if
(
s
->
strict_std_compliance
>=
FF_COMPLIANCE_STRICT
)
{
if
(
s
->
strict_std_compliance
>=
FF_COMPLIANCE_STRICT
)
ret
=
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
goto
fail
;
}
}
}
ctx
=
avformat_alloc_context
();
ctx
=
avformat_alloc_context
();
if
(
!
ctx
)
{
if
(
!
ctx
)
ret
=
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
goto
fail
;
}
os
->
ctx
=
ctx
;
os
->
ctx
=
ctx
;
ctx
->
oformat
=
oformat
;
ctx
->
oformat
=
oformat
;
ctx
->
interrupt_callback
=
s
->
interrupt_callback
;
ctx
->
interrupt_callback
=
s
->
interrupt_callback
;
...
@@ -624,10 +616,8 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -624,10 +616,8 @@ static int dash_write_header(AVFormatContext *s)
ctx
->
io_close
=
s
->
io_close
;
ctx
->
io_close
=
s
->
io_close
;
ctx
->
io_open
=
s
->
io_open
;
ctx
->
io_open
=
s
->
io_open
;
if
(
!
(
st
=
avformat_new_stream
(
ctx
,
NULL
)))
{
if
(
!
(
st
=
avformat_new_stream
(
ctx
,
NULL
)))
ret
=
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
goto
fail
;
}
avcodec_parameters_copy
(
st
->
codecpar
,
s
->
streams
[
i
]
->
codecpar
);
avcodec_parameters_copy
(
st
->
codecpar
,
s
->
streams
[
i
]
->
codecpar
);
st
->
sample_aspect_ratio
=
s
->
streams
[
i
]
->
sample_aspect_ratio
;
st
->
sample_aspect_ratio
=
s
->
streams
[
i
]
->
sample_aspect_ratio
;
st
->
time_base
=
s
->
streams
[
i
]
->
time_base
;
st
->
time_base
=
s
->
streams
[
i
]
->
time_base
;
...
@@ -635,10 +625,8 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -635,10 +625,8 @@ static int dash_write_header(AVFormatContext *s)
ctx
->
flags
=
s
->
flags
;
ctx
->
flags
=
s
->
flags
;
ctx
->
pb
=
avio_alloc_context
(
os
->
iobuf
,
sizeof
(
os
->
iobuf
),
AVIO_FLAG_WRITE
,
os
,
NULL
,
dash_write
,
NULL
);
ctx
->
pb
=
avio_alloc_context
(
os
->
iobuf
,
sizeof
(
os
->
iobuf
),
AVIO_FLAG_WRITE
,
os
,
NULL
,
dash_write
,
NULL
);
if
(
!
ctx
->
pb
)
{
if
(
!
ctx
->
pb
)
ret
=
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
goto
fail
;
}
if
(
c
->
single_file
)
{
if
(
c
->
single_file
)
{
if
(
c
->
single_file_name
)
if
(
c
->
single_file_name
)
...
@@ -651,13 +639,12 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -651,13 +639,12 @@ static int dash_write_header(AVFormatContext *s)
snprintf
(
filename
,
sizeof
(
filename
),
"%s%s"
,
c
->
dirname
,
os
->
initfile
);
snprintf
(
filename
,
sizeof
(
filename
),
"%s%s"
,
c
->
dirname
,
os
->
initfile
);
ret
=
s
->
io_open
(
s
,
&
os
->
out
,
filename
,
AVIO_FLAG_WRITE
,
NULL
);
ret
=
s
->
io_open
(
s
,
&
os
->
out
,
filename
,
AVIO_FLAG_WRITE
,
NULL
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
fail
;
return
ret
;
os
->
init_start_pos
=
0
;
os
->
init_start_pos
=
0
;
av_dict_set
(
&
opts
,
"movflags"
,
"frag_custom+dash+delay_moov"
,
0
);
av_dict_set
(
&
opts
,
"movflags"
,
"frag_custom+dash+delay_moov"
,
0
);
if
((
ret
=
avformat_write_header
(
ctx
,
&
opts
))
<
0
)
{
if
((
ret
=
avformat_write_header
(
ctx
,
&
opts
))
<
0
)
goto
fail
;
return
ret
;
}
os
->
ctx_inited
=
1
;
os
->
ctx_inited
=
1
;
avio_flush
(
ctx
->
pb
);
avio_flush
(
ctx
->
pb
);
av_dict_free
(
&
opts
);
av_dict_free
(
&
opts
);
...
@@ -693,15 +680,11 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -693,15 +680,11 @@ static int dash_write_header(AVFormatContext *s)
if
(
!
c
->
has_video
&&
c
->
min_seg_duration
<=
0
)
{
if
(
!
c
->
has_video
&&
c
->
min_seg_duration
<=
0
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"no video stream and no min seg duration set
\n
"
);
av_log
(
s
,
AV_LOG_WARNING
,
"no video stream and no min seg duration set
\n
"
);
ret
=
AVERROR
(
EINVAL
);
ret
urn
AVERROR
(
EINVAL
);
}
}
ret
=
write_manifest
(
s
,
0
);
ret
=
write_manifest
(
s
,
0
);
if
(
!
ret
)
if
(
!
ret
)
av_log
(
s
,
AV_LOG_VERBOSE
,
"Manifest written to: %s
\n
"
,
s
->
filename
);
av_log
(
s
,
AV_LOG_VERBOSE
,
"Manifest written to: %s
\n
"
,
s
->
filename
);
fail:
if
(
ret
)
dash_free
(
s
);
return
ret
;
return
ret
;
}
}
...
@@ -992,7 +975,6 @@ static int dash_write_trailer(AVFormatContext *s)
...
@@ -992,7 +975,6 @@ static int dash_write_trailer(AVFormatContext *s)
unlink
(
s
->
filename
);
unlink
(
s
->
filename
);
}
}
dash_free
(
s
);
return
0
;
return
0
;
}
}
...
@@ -1029,6 +1011,7 @@ AVOutputFormat ff_dash_muxer = {
...
@@ -1029,6 +1011,7 @@ AVOutputFormat ff_dash_muxer = {
.
write_header
=
dash_write_header
,
.
write_header
=
dash_write_header
,
.
write_packet
=
dash_write_packet
,
.
write_packet
=
dash_write_packet
,
.
write_trailer
=
dash_write_trailer
,
.
write_trailer
=
dash_write_trailer
,
.
deinit
=
dash_free
,
.
codec_tag
=
(
const
AVCodecTag
*
const
[]){
ff_mp4_obj_type
,
0
},
.
codec_tag
=
(
const
AVCodecTag
*
const
[]){
ff_mp4_obj_type
,
0
},
.
priv_class
=
&
dash_class
,
.
priv_class
=
&
dash_class
,
};
};
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