Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8db4ef3e
Commit
8db4ef3e
authored
Jan 21, 2018
by
Colin NG
Committed by
Steven Liu
Jan 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dashdec.c: Download dash content with byte range info
parent
1f48c5c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
6 deletions
+30
-6
dashdec.c
libavformat/dashdec.c
+30
-6
No files found.
libavformat/dashdec.c
View file @
8db4ef3e
...
@@ -552,6 +552,23 @@ static enum AVMediaType get_content_type(xmlNodePtr node)
...
@@ -552,6 +552,23 @@ static enum AVMediaType get_content_type(xmlNodePtr node)
return
type
;
return
type
;
}
}
static
struct
fragment
*
get_Fragment
(
char
*
range
)
{
struct
fragment
*
seg
=
av_mallocz
(
sizeof
(
struct
fragment
));
if
(
!
seg
)
return
NULL
;
seg
->
size
=
-
1
;
if
(
range
)
{
char
*
str_end_offset
;
char
*
str_offset
=
av_strtok
(
range
,
"-"
,
&
str_end_offset
);
seg
->
url_offset
=
strtoll
(
str_offset
,
NULL
,
10
);
seg
->
size
=
strtoll
(
str_end_offset
,
NULL
,
10
)
-
seg
->
url_offset
;
}
return
seg
;
}
static
int
parse_manifest_segmenturlnode
(
AVFormatContext
*
s
,
struct
representation
*
rep
,
static
int
parse_manifest_segmenturlnode
(
AVFormatContext
*
s
,
struct
representation
*
rep
,
xmlNodePtr
fragmenturl_node
,
xmlNodePtr
fragmenturl_node
,
xmlNodePtr
*
baseurl_nodes
,
xmlNodePtr
*
baseurl_nodes
,
...
@@ -560,13 +577,16 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
...
@@ -560,13 +577,16 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
{
{
char
*
initialization_val
=
NULL
;
char
*
initialization_val
=
NULL
;
char
*
media_val
=
NULL
;
char
*
media_val
=
NULL
;
char
*
range_val
=
NULL
;
if
(
!
av_strcasecmp
(
fragmenturl_node
->
name
,
(
const
char
*
)
"Initialization"
))
{
if
(
!
av_strcasecmp
(
fragmenturl_node
->
name
,
(
const
char
*
)
"Initialization"
))
{
initialization_val
=
xmlGetProp
(
fragmenturl_node
,
"sourceURL"
);
initialization_val
=
xmlGetProp
(
fragmenturl_node
,
"sourceURL"
);
if
(
initialization_val
)
{
range_val
=
xmlGetProp
(
fragmenturl_node
,
"range"
);
rep
->
init_section
=
av_mallocz
(
sizeof
(
struct
fragment
));
if
(
initialization_val
||
range_val
)
{
rep
->
init_section
=
get_Fragment
(
range_val
);
if
(
!
rep
->
init_section
)
{
if
(
!
rep
->
init_section
)
{
xmlFree
(
initialization_val
);
xmlFree
(
initialization_val
);
xmlFree
(
range_val
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
rep
->
init_section
->
url
=
get_content_url
(
baseurl_nodes
,
4
,
rep
->
init_section
->
url
=
get_content_url
(
baseurl_nodes
,
4
,
...
@@ -576,17 +596,20 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
...
@@ -576,17 +596,20 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
if
(
!
rep
->
init_section
->
url
)
{
if
(
!
rep
->
init_section
->
url
)
{
av_free
(
rep
->
init_section
);
av_free
(
rep
->
init_section
);
xmlFree
(
initialization_val
);
xmlFree
(
initialization_val
);
xmlFree
(
range_val
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
rep
->
init_section
->
size
=
-
1
;
xmlFree
(
initialization_val
);
xmlFree
(
initialization_val
);
xmlFree
(
range_val
);
}
}
}
else
if
(
!
av_strcasecmp
(
fragmenturl_node
->
name
,
(
const
char
*
)
"SegmentURL"
))
{
}
else
if
(
!
av_strcasecmp
(
fragmenturl_node
->
name
,
(
const
char
*
)
"SegmentURL"
))
{
media_val
=
xmlGetProp
(
fragmenturl_node
,
"media"
);
media_val
=
xmlGetProp
(
fragmenturl_node
,
"media"
);
if
(
media_val
)
{
range_val
=
xmlGetProp
(
fragmenturl_node
,
"mediaRange"
);
struct
fragment
*
seg
=
av_mallocz
(
sizeof
(
struct
fragment
));
if
(
media_val
||
range_val
)
{
struct
fragment
*
seg
=
get_Fragment
(
range_val
);
if
(
!
seg
)
{
if
(
!
seg
)
{
xmlFree
(
media_val
);
xmlFree
(
media_val
);
xmlFree
(
range_val
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
seg
->
url
=
get_content_url
(
baseurl_nodes
,
4
,
seg
->
url
=
get_content_url
(
baseurl_nodes
,
4
,
...
@@ -596,11 +619,12 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
...
@@ -596,11 +619,12 @@ static int parse_manifest_segmenturlnode(AVFormatContext *s, struct representati
if
(
!
seg
->
url
)
{
if
(
!
seg
->
url
)
{
av_free
(
seg
);
av_free
(
seg
);
xmlFree
(
media_val
);
xmlFree
(
media_val
);
xmlFree
(
range_val
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
seg
->
size
=
-
1
;
dynarray_add
(
&
rep
->
fragments
,
&
rep
->
n_fragments
,
seg
);
dynarray_add
(
&
rep
->
fragments
,
&
rep
->
n_fragments
,
seg
);
xmlFree
(
media_val
);
xmlFree
(
media_val
);
xmlFree
(
range_val
);
}
}
}
}
...
...
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