Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
458dc05c
Commit
458dc05c
authored
Sep 17, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add sequence number to all segments
parent
f5bbc438
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
modules/demux/adaptative/playlist/Segment.cpp
modules/demux/adaptative/playlist/Segment.cpp
+14
-0
modules/demux/adaptative/playlist/Segment.h
modules/demux/adaptative/playlist/Segment.h
+5
-0
modules/demux/hls/playlist/HLSSegment.cpp
modules/demux/hls/playlist/HLSSegment.cpp
+8
-8
modules/demux/hls/playlist/HLSSegment.hpp
modules/demux/hls/playlist/HLSSegment.hpp
+0
-1
No files found.
modules/demux/adaptative/playlist/Segment.cpp
View file @
458dc05c
...
...
@@ -34,6 +34,9 @@
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
playlist
;
const
int
ISegment
::
SEQUENCE_INVALID
=
0
;
const
int
ISegment
::
SEQUENCE_FIRST
=
1
;
ISegment
::
ISegment
(
const
ICanonicalUrl
*
parent
)
:
ICanonicalUrl
(
parent
),
startByte
(
0
),
...
...
@@ -44,6 +47,7 @@ ISegment::ISegment(const ICanonicalUrl *parent):
startTime
.
Set
(
0
);
duration
.
Set
(
0
);
chunksuse
.
Set
(
0
);
sequence
=
SEQUENCE_INVALID
;
}
ISegment
::~
ISegment
()
...
...
@@ -92,6 +96,16 @@ void ISegment::setByteRange(size_t start, size_t end)
endByte
=
end
;
}
void
ISegment
::
setSequenceNumber
(
uint64_t
seq
)
{
sequence
=
SEQUENCE_FIRST
+
seq
;
}
uint64_t
ISegment
::
getSequenceNumber
()
const
{
return
sequence
;
}
size_t
ISegment
::
getOffset
()
const
{
return
startByte
;
...
...
modules/demux/adaptative/playlist/Segment.h
View file @
458dc05c
...
...
@@ -55,6 +55,8 @@ namespace adaptative
*/
virtual
SegmentChunk
*
toChunk
(
size_t
,
BaseRepresentation
*
=
NULL
);
virtual
void
setByteRange
(
size_t
start
,
size_t
end
);
virtual
void
setSequenceNumber
(
uint64_t
);
virtual
uint64_t
getSequenceNumber
()
const
;
virtual
size_t
getOffset
()
const
;
virtual
std
::
vector
<
ISegment
*>
subSegments
()
=
0
;
virtual
void
addSubSegment
(
SubSegment
*
)
=
0
;
...
...
@@ -75,6 +77,9 @@ namespace adaptative
size_t
endByte
;
std
::
string
debugName
;
int
classId
;
uint64_t
sequence
;
static
const
int
SEQUENCE_INVALID
;
static
const
int
SEQUENCE_FIRST
;
virtual
SegmentChunk
*
getChunk
(
const
std
::
string
&
);
};
...
...
modules/demux/hls/playlist/HLSSegment.cpp
View file @
458dc05c
...
...
@@ -38,7 +38,7 @@ SegmentEncryption::SegmentEncryption()
HLSSegment
::
HLSSegment
(
ICanonicalUrl
*
parent
,
uint64_t
seq
)
:
Segment
(
parent
)
{
sequence
=
seq
;
se
tSe
quence
Number
(
seq
)
;
#ifdef HAVE_GCRYPT
ctx
=
NULL
;
#endif
...
...
@@ -85,10 +85,10 @@ void HLSSegment::onChunkDownload(block_t **pp_block, SegmentChunk *chunk, BaseRe
{
encryption
.
iv
.
clear
();
encryption
.
iv
.
resize
(
16
);
encryption
.
iv
[
15
]
=
s
equence
&
0xff
;
encryption
.
iv
[
14
]
=
(
s
equence
>>
8
)
&
0xff
;
encryption
.
iv
[
13
]
=
(
s
equence
>>
16
)
&
0xff
;
encryption
.
iv
[
12
]
=
(
s
equence
>>
24
)
&
0xff
;
encryption
.
iv
[
15
]
=
(
getS
equence
Number
()
-
Segment
::
SEQUENCE_FIRST
)
&
0xff
;
encryption
.
iv
[
14
]
=
(
(
getS
equence
Number
()
-
Segment
::
SEQUENCE_FIRST
)
>>
8
)
&
0xff
;
encryption
.
iv
[
13
]
=
(
(
getS
equence
Number
()
-
Segment
::
SEQUENCE_FIRST
)
>>
16
)
&
0xff
;
encryption
.
iv
[
12
]
=
(
(
getS
equence
Number
()
-
Segment
::
SEQUENCE_FIRST
)
>>
24
)
&
0xff
;
}
if
(
gcry_cipher_open
(
&
ctx
,
GCRY_CIPHER_AES
,
GCRY_CIPHER_MODE_CBC
,
0
)
||
...
...
@@ -148,7 +148,7 @@ void HLSSegment::debug(vlc_object_t *obj, int indent) const
{
std
::
stringstream
ss
;
ss
<<
std
::
string
(
indent
,
' '
)
<<
debugName
<<
" #"
<<
s
equence
<<
" #"
<<
(
getS
equence
Number
()
-
Segment
::
SEQUENCE_FIRST
)
<<
" url="
<<
getUrlSegment
().
toString
();
if
(
startByte
!=
endByte
)
ss
<<
" @"
<<
startByte
<<
".."
<<
endByte
;
...
...
@@ -160,9 +160,9 @@ int HLSSegment::compare(ISegment *segment) const
HLSSegment
*
hlssegment
=
dynamic_cast
<
HLSSegment
*>
(
segment
);
if
(
hlssegment
)
{
if
(
s
equence
>
hlssegment
->
s
equence
)
if
(
getS
equence
Number
()
>
hlssegment
->
getS
equence
Number
()
)
return
1
;
else
if
(
s
equence
<
hlssegment
->
s
equence
)
else
if
(
getS
equence
Number
()
<
hlssegment
->
getS
equence
Number
()
)
return
-
1
;
else
return
0
;
...
...
modules/demux/hls/playlist/HLSSegment.hpp
View file @
458dc05c
...
...
@@ -63,7 +63,6 @@ namespace hls
virtual
void
onChunkDownload
(
block_t
**
,
SegmentChunk
*
,
BaseRepresentation
*
);
/* reimpl */
void
checkFormat
(
block_t
*
,
SegmentChunk
*
,
BaseRepresentation
*
);
uint64_t
sequence
;
SegmentEncryption
encryption
;
#ifdef HAVE_GCRYPT
gcry_cipher_hd_t
ctx
;
...
...
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