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
f5668e61
Commit
f5668e61
authored
Mar 04, 2015
by
Timo Rothenpieler
Committed by
Michael Niedermayer
Mar 05, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dashenc: Update extradata for mov muxer
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
63ea3a86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
dashenc.c
libavformat/dashenc.c
+28
-15
No files found.
libavformat/dashenc.c
View file @
f5668e61
...
@@ -72,7 +72,6 @@ typedef struct OutputStream {
...
@@ -72,7 +72,6 @@ typedef struct OutputStream {
int
bit_rate
;
int
bit_rate
;
char
bandwidth_str
[
64
];
char
bandwidth_str
[
64
];
int
codec_str_extradata_size
;
char
codec_str
[
100
];
char
codec_str
[
100
];
}
OutputStream
;
}
OutputStream
;
...
@@ -503,12 +502,6 @@ static int write_manifest(AVFormatContext *s, int final)
...
@@ -503,12 +502,6 @@ static int write_manifest(AVFormatContext *s, int final)
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_VIDEO
)
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_VIDEO
)
continue
;
continue
;
if
(
os
->
codec_str_extradata_size
!=
st
->
codec
->
extradata_size
)
{
memset
(
os
->
codec_str
,
0
,
sizeof
(
os
->
codec_str
));
set_codec_str
(
s
,
st
->
codec
,
os
->
codec_str
,
sizeof
(
os
->
codec_str
));
os
->
codec_str_extradata_size
=
st
->
codec
->
extradata_size
;
}
avio_printf
(
out
,
"
\t\t\t
<Representation id=
\"
%d
\"
mimeType=
\"
video/mp4
\"
codecs=
\"
%s
\"
%s width=
\"
%d
\"
height=
\"
%d
\"
>
\n
"
,
i
,
os
->
codec_str
,
os
->
bandwidth_str
,
st
->
codec
->
width
,
st
->
codec
->
height
);
avio_printf
(
out
,
"
\t\t\t
<Representation id=
\"
%d
\"
mimeType=
\"
video/mp4
\"
codecs=
\"
%s
\"
%s width=
\"
%d
\"
height=
\"
%d
\"
>
\n
"
,
i
,
os
->
codec_str
,
os
->
bandwidth_str
,
st
->
codec
->
width
,
st
->
codec
->
height
);
output_segment_list
(
&
c
->
streams
[
i
],
out
,
c
);
output_segment_list
(
&
c
->
streams
[
i
],
out
,
c
);
avio_printf
(
out
,
"
\t\t\t
</Representation>
\n
"
);
avio_printf
(
out
,
"
\t\t\t
</Representation>
\n
"
);
...
@@ -524,12 +517,6 @@ static int write_manifest(AVFormatContext *s, int final)
...
@@ -524,12 +517,6 @@ static int write_manifest(AVFormatContext *s, int final)
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
)
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
)
continue
;
continue
;
if
(
os
->
codec_str_extradata_size
!=
st
->
codec
->
extradata_size
)
{
memset
(
os
->
codec_str
,
0
,
sizeof
(
os
->
codec_str
));
set_codec_str
(
s
,
st
->
codec
,
os
->
codec_str
,
sizeof
(
os
->
codec_str
));
os
->
codec_str_extradata_size
=
st
->
codec
->
extradata_size
;
}
avio_printf
(
out
,
"
\t\t\t
<Representation id=
\"
%d
\"
mimeType=
\"
audio/mp4
\"
codecs=
\"
%s
\"
%s audioSamplingRate=
\"
%d
\"
>
\n
"
,
i
,
os
->
codec_str
,
os
->
bandwidth_str
,
st
->
codec
->
sample_rate
);
avio_printf
(
out
,
"
\t\t\t
<Representation id=
\"
%d
\"
mimeType=
\"
audio/mp4
\"
codecs=
\"
%s
\"
%s audioSamplingRate=
\"
%d
\"
>
\n
"
,
i
,
os
->
codec_str
,
os
->
bandwidth_str
,
st
->
codec
->
sample_rate
);
avio_printf
(
out
,
"
\t\t\t\t
<AudioChannelConfiguration schemeIdUri=
\"
urn:mpeg:dash:23003:3:audio_channel_configuration:2011
\"
value=
\"
%d
\"
/>
\n
"
,
st
->
codec
->
channels
);
avio_printf
(
out
,
"
\t\t\t\t
<AudioChannelConfiguration schemeIdUri=
\"
urn:mpeg:dash:23003:3:audio_channel_configuration:2011
\"
value=
\"
%d
\"
/>
\n
"
,
st
->
codec
->
channels
);
output_segment_list
(
&
c
->
streams
[
i
],
out
,
c
);
output_segment_list
(
&
c
->
streams
[
i
],
out
,
c
);
...
@@ -664,8 +651,7 @@ static int dash_write_header(AVFormatContext *s)
...
@@ -664,8 +651,7 @@ static int dash_write_header(AVFormatContext *s)
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
c
->
has_audio
=
1
;
c
->
has_audio
=
1
;
set_codec_str
(
s
,
s
->
streams
[
i
]
->
codec
,
os
->
codec_str
,
sizeof
(
os
->
codec_str
));
set_codec_str
(
s
,
st
->
codec
,
os
->
codec_str
,
sizeof
(
os
->
codec_str
));
os
->
codec_str_extradata_size
=
s
->
streams
[
i
]
->
codec
->
extradata_size
;
os
->
first_pts
=
AV_NOPTS_VALUE
;
os
->
first_pts
=
AV_NOPTS_VALUE
;
os
->
max_pts
=
AV_NOPTS_VALUE
;
os
->
max_pts
=
AV_NOPTS_VALUE
;
os
->
segment_index
=
1
;
os
->
segment_index
=
1
;
...
@@ -750,6 +736,29 @@ static void find_index_range(AVFormatContext *s, const char *full_path,
...
@@ -750,6 +736,29 @@ static void find_index_range(AVFormatContext *s, const char *full_path,
*
index_length
=
AV_RB32
(
&
buf
[
0
]);
*
index_length
=
AV_RB32
(
&
buf
[
0
]);
}
}
static
int
update_stream_extradata
(
AVFormatContext
*
s
,
OutputStream
*
os
,
AVCodecContext
*
codec
)
{
uint8_t
*
extradata
;
if
(
os
->
ctx
->
streams
[
0
]
->
codec
->
extradata_size
||
!
codec
->
extradata_size
)
return
0
;
extradata
=
av_malloc
(
codec
->
extradata_size
);
if
(
!
extradata
)
return
AVERROR
(
ENOMEM
);
memcpy
(
extradata
,
codec
->
extradata
,
codec
->
extradata_size
);
os
->
ctx
->
streams
[
0
]
->
codec
->
extradata
=
extradata
;
os
->
ctx
->
streams
[
0
]
->
codec
->
extradata_size
=
codec
->
extradata_size
;
set_codec_str
(
s
,
codec
,
os
->
codec_str
,
sizeof
(
os
->
codec_str
));
return
0
;
}
static
int
dash_flush
(
AVFormatContext
*
s
,
int
final
,
int
stream
)
static
int
dash_flush
(
AVFormatContext
*
s
,
int
final
,
int
stream
)
{
{
DASHContext
*
c
=
s
->
priv_data
;
DASHContext
*
c
=
s
->
priv_data
;
...
@@ -853,6 +862,10 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -853,6 +862,10 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t
seg_end_duration
=
(
os
->
segment_index
)
*
(
int64_t
)
c
->
min_seg_duration
;
int64_t
seg_end_duration
=
(
os
->
segment_index
)
*
(
int64_t
)
c
->
min_seg_duration
;
int
ret
;
int
ret
;
ret
=
update_stream_extradata
(
s
,
os
,
st
->
codec
);
if
(
ret
<
0
)
return
ret
;
// If forcing the stream to start at 0, the mp4 muxer will set the start
// If forcing the stream to start at 0, the mp4 muxer will set the start
// timestamps to 0. Do the same here, to avoid mismatches in duration/timestamps.
// timestamps to 0. Do the same here, to avoid mismatches in duration/timestamps.
if
(
os
->
first_pts
==
AV_NOPTS_VALUE
&&
if
(
os
->
first_pts
==
AV_NOPTS_VALUE
&&
...
...
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