Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
839d1730
Commit
839d1730
authored
May 01, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: smooth: some streamindex have no fragments (fix #11377)
SteamIndex for Chapters have no stream, then no qlevels
parent
c021c39d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
41 deletions
+88
-41
modules/stream_filter/smooth/downloader.c
modules/stream_filter/smooth/downloader.c
+28
-22
modules/stream_filter/smooth/smooth.c
modules/stream_filter/smooth/smooth.c
+58
-18
modules/stream_filter/smooth/utils.c
modules/stream_filter/smooth/utils.c
+2
-1
No files found.
modules/stream_filter/smooth/downloader.c
View file @
839d1730
...
...
@@ -328,25 +328,28 @@ static int build_smoo_box( stream_t *s, uint8_t *smoo_box )
quality_level_t
*
qlvl
=
get_qlevel
(
sms
,
sms
->
download_qlvl
);
FourCC
=
qlvl
->
FourCC
?
qlvl
->
FourCC
:
sms
->
default_FourCC
;
((
uint32_t
*
)
stra_box
)[
16
]
=
bswap32
(
FourCC
);
((
uint32_t
*
)
stra_box
)[
17
]
=
bswap32
(
qlvl
->
Bitrate
);
((
uint32_t
*
)
stra_box
)[
18
]
=
bswap32
(
qlvl
->
MaxWidth
);
((
uint32_t
*
)
stra_box
)[
19
]
=
bswap32
(
qlvl
->
MaxHeight
);
((
uint32_t
*
)
stra_box
)[
20
]
=
bswap32
(
qlvl
->
SamplingRate
);
((
uint32_t
*
)
stra_box
)[
21
]
=
bswap32
(
qlvl
->
Channels
);
((
uint32_t
*
)
stra_box
)[
22
]
=
bswap32
(
qlvl
->
BitsPerSample
);
((
uint32_t
*
)
stra_box
)[
23
]
=
bswap32
(
qlvl
->
AudioTag
);
((
uint16_t
*
)
stra_box
)[
48
]
=
bswap16
(
qlvl
->
nBlockAlign
);
if
(
!
qlvl
->
CodecPrivateData
)
continue
;
stra_box
[
98
]
=
stra_box
[
99
]
=
stra_box
[
100
]
=
0
;
/* reserved */
assert
(
strlen
(
qlvl
->
CodecPrivateData
)
<
512
);
stra_box
[
101
]
=
strlen
(
qlvl
->
CodecPrivateData
)
/
2
;
uint8_t
*
binary_cpd
=
decode_string_hex_to_binary
(
qlvl
->
CodecPrivateData
);
memcpy
(
stra_box
+
102
,
binary_cpd
,
stra_box
[
101
]
);
free
(
binary_cpd
);
if
(
qlvl
)
{
FourCC
=
qlvl
->
FourCC
?
qlvl
->
FourCC
:
sms
->
default_FourCC
;
((
uint32_t
*
)
stra_box
)[
16
]
=
bswap32
(
FourCC
);
((
uint32_t
*
)
stra_box
)[
17
]
=
bswap32
(
qlvl
->
Bitrate
);
((
uint32_t
*
)
stra_box
)[
18
]
=
bswap32
(
qlvl
->
MaxWidth
);
((
uint32_t
*
)
stra_box
)[
19
]
=
bswap32
(
qlvl
->
MaxHeight
);
((
uint32_t
*
)
stra_box
)[
20
]
=
bswap32
(
qlvl
->
SamplingRate
);
((
uint32_t
*
)
stra_box
)[
21
]
=
bswap32
(
qlvl
->
Channels
);
((
uint32_t
*
)
stra_box
)[
22
]
=
bswap32
(
qlvl
->
BitsPerSample
);
((
uint32_t
*
)
stra_box
)[
23
]
=
bswap32
(
qlvl
->
AudioTag
);
((
uint16_t
*
)
stra_box
)[
48
]
=
bswap16
(
qlvl
->
nBlockAlign
);
if
(
!
qlvl
->
CodecPrivateData
)
continue
;
stra_box
[
98
]
=
stra_box
[
99
]
=
stra_box
[
100
]
=
0
;
/* reserved */
assert
(
strlen
(
qlvl
->
CodecPrivateData
)
<
512
);
stra_box
[
101
]
=
strlen
(
qlvl
->
CodecPrivateData
)
/
2
;
uint8_t
*
binary_cpd
=
decode_string_hex_to_binary
(
qlvl
->
CodecPrivateData
);
memcpy
(
stra_box
+
102
,
binary_cpd
,
stra_box
[
101
]
);
free
(
binary_cpd
);
}
}
return
VLC_SUCCESS
;
...
...
@@ -598,7 +601,7 @@ void* sms_Thread( void *p_this )
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
sms
=
SMS_GET_SELECTED_ST
(
index_to_es_cat
(
i
)
);
if
(
sms
)
if
(
sms
&&
vlc_array_count
(
sms
->
chunks
)
)
{
chunk
=
vlc_array_item_at_index
(
sms
->
chunks
,
0
);
p_sys
->
download
.
lead
[
i
]
=
chunk
->
start_time
+
p_sys
->
timescale
/
1000
;
...
...
@@ -676,8 +679,11 @@ void* sms_Thread( void *p_this )
vlc_mutex_unlock
(
&
p_sys
->
download
.
lock_wait
);
sms
=
SMS_GET_SELECTED_ST
(
next_track
(
s
)
);
if
(
Download
(
s
,
sms
)
!=
VLC_SUCCESS
)
goto
cancel
;
if
(
vlc_array_count
(
sms
->
chunks
)
)
{
if
(
Download
(
s
,
sms
)
!=
VLC_SUCCESS
)
goto
cancel
;
}
}
cancel:
...
...
modules/stream_filter/smooth/smooth.c
View file @
839d1730
...
...
@@ -172,12 +172,15 @@ static int parse_Manifest( stream_t *s )
p_sys
->
timescale
=
TIMESCALE
;
}
if
(
!
strcmp
(
node
,
"StreamIndex"
)
)
{
sms
=
sms_New
();
if
(
unlikely
(
!
sms
)
)
{
xml_ReaderDelete
(
vlc_reader
);
xml_Delete
(
vlc_xml
);
return
VLC_ENOMEM
;
}
sms
->
id
=
next_track_id
;
next_track_id
++
;
...
...
@@ -225,15 +228,21 @@ static int parse_Manifest( stream_t *s )
else
if
(
sms
->
type
==
SPU_ES
)
sms
->
name
=
strdup
(
"text"
);
}
vlc_array_append
(
p_sys
->
sms_streams
,
sms
);
}
if
(
!
strcmp
(
node
,
"QualityLevel"
)
)
{
if
(
!
sms
)
break
;
ql
=
ql_New
();
if
(
!
ql
)
{
sms_Free
(
sms
);
xml_ReaderDelete
(
vlc_reader
);
xml_Delete
(
vlc_xml
);
return
VLC_ENOMEM
;
}
ql
->
id
=
next_qid
;
next_qid
++
;
while
(
(
name
=
xml_ReaderNextAttr
(
vlc_reader
,
&
value
))
)
...
...
@@ -275,11 +284,21 @@ static int parse_Manifest( stream_t *s )
if
(
!
strcmp
(
name
,
"BitsPerSample"
)
)
ql
->
BitsPerSample
=
strtoul
(
value
,
NULL
,
10
);
}
vlc_array_append
(
sms
->
qlevels
,
ql
);
}
if
(
!
strcmp
(
node
,
"Content"
)
&&
sms
&&
!
sms
->
url_template
)
{
/* empty(@Url) && ./Content == manifest embedded content */
sms_Free
(
sms
);
sms
=
NULL
;
}
if
(
!
strcmp
(
node
,
"c"
)
)
{
if
(
!
sms
)
break
;
loop_count
++
;
start_time
=
duration
=
-
1
;
while
(
(
name
=
xml_ReaderNextAttr
(
vlc_reader
,
&
value
))
)
...
...
@@ -327,6 +346,9 @@ static int parse_Manifest( stream_t *s )
if
(
unlikely
(
chunk_New
(
sms
,
computed_duration
,
computed_start_time
)
==
NULL
)
)
{
sms_Free
(
sms
);
xml_ReaderDelete
(
vlc_reader
);
xml_Delete
(
vlc_xml
);
return
VLC_ENOMEM
;
}
if
(
b_weird
&&
start_time
!=
-
1
)
...
...
@@ -338,17 +360,29 @@ static int parse_Manifest( stream_t *s )
if
(
strcmp
(
node
,
"StreamIndex"
)
)
break
;
computed_start_time
=
0
;
computed_duration
=
0
;
loop_count
=
0
;
if
(
b_weird
&&
!
chunk_New
(
sms
,
computed_duration
,
computed_start_time
)
)
return
VLC_ENOMEM
;
if
(
sms
)
{
vlc_array_append
(
p_sys
->
sms_streams
,
sms
);
b_weird
=
false
;
next_qid
=
1
;
computed_start_time
=
0
;
computed_duration
=
0
;
loop_count
=
0
;
if
(
b_weird
&&
!
chunk_New
(
sms
,
computed_duration
,
computed_start_time
)
)
{
sms_Free
(
sms
);
xml_ReaderDelete
(
vlc_reader
);
xml_Delete
(
vlc_xml
);
return
VLC_ENOMEM
;
}
if
(
sms
->
qlevel_nb
==
0
)
sms
->
qlevel_nb
=
vlc_array_count
(
sms
->
qlevels
);
b_weird
=
false
;
next_qid
=
1
;
if
(
sms
->
qlevel_nb
==
0
)
sms
->
qlevel_nb
=
vlc_array_count
(
sms
->
qlevels
);
sms
=
NULL
;
}
break
;
case
XML_READER_NONE
:
...
...
@@ -356,6 +390,9 @@ static int parse_Manifest( stream_t *s )
case
XML_READER_TEXT
:
break
;
default:
sms_Free
(
sms
);
xml_ReaderDelete
(
vlc_reader
);
xml_Delete
(
vlc_xml
);
return
VLC_EGENERIC
;
}
}
...
...
@@ -437,14 +474,17 @@ static int Open( vlc_object_t *p_this )
{
wanted
=
qlvl
=
NULL
;
sms
=
vlc_array_item_at_index
(
p_sys
->
sms_streams
,
i
);
wanted
=
vlc_array_item_at_index
(
sms
->
qlevels
,
0
);
for
(
unsigned
i
=
1
;
i
<
sms
->
qlevel_nb
;
i
++
)
if
(
vlc_array_count
(
sms
->
qlevels
)
)
{
qlvl
=
vlc_array_item_at_index
(
sms
->
qlevels
,
i
);
if
(
qlvl
->
Bitrate
<
wanted
->
Bitrate
)
wanted
=
qlvl
;
wanted
=
vlc_array_item_at_index
(
sms
->
qlevels
,
0
);
for
(
unsigned
i
=
1
;
i
<
sms
->
qlevel_nb
;
i
++
)
{
qlvl
=
vlc_array_item_at_index
(
sms
->
qlevels
,
i
);
if
(
qlvl
->
Bitrate
<
wanted
->
Bitrate
)
wanted
=
qlvl
;
}
sms
->
download_qlvl
=
wanted
->
id
;
}
sms
->
download_qlvl
=
wanted
->
id
;
}
vlc_mutex_init
(
&
p_sys
->
download
.
lock_wait
);
...
...
modules/stream_filter/smooth/utils.c
View file @
839d1730
...
...
@@ -115,6 +115,8 @@ sms_stream_t * sms_New( void )
void
sms_Free
(
sms_stream_t
*
sms
)
{
if
(
!
sms
)
return
;
if
(
sms
->
qlevels
)
{
for
(
int
n
=
0
;
n
<
vlc_array_count
(
sms
->
qlevels
);
n
++
)
...
...
@@ -138,7 +140,6 @@ void sms_Free( sms_stream_t *sms )
free
(
sms
->
name
);
free
(
sms
->
url_template
);
free
(
sms
);
sms
=
NULL
;
}
quality_level_t
*
get_qlevel
(
sms_stream_t
*
sms
,
const
unsigned
qid
)
...
...
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