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
0c9f38b8
Commit
0c9f38b8
authored
Nov 09, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: smooth: merge trackid fix with chunk read
And drop all unused and useless code
parent
0d862d0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
98 deletions
+26
-98
modules/stream_filter/smooth/downloader.c
modules/stream_filter/smooth/downloader.c
+26
-61
modules/stream_filter/smooth/smooth.c
modules/stream_filter/smooth/smooth.c
+0
-6
modules/stream_filter/smooth/smooth.h
modules/stream_filter/smooth/smooth.h
+0
-31
No files found.
modules/stream_filter/smooth/downloader.c
View file @
0c9f38b8
...
@@ -135,39 +135,6 @@ static chunk_t * chunk_Get( sms_stream_t *sms, const uint64_t start_time )
...
@@ -135,39 +135,6 @@ static chunk_t * chunk_Get( sms_stream_t *sms, const uint64_t start_time )
return
p_chunk
;
return
p_chunk
;
}
}
static
unsigned
set_track_id
(
chunk_t
*
chunk
,
const
unsigned
tid
)
{
uint32_t
size
,
type
;
if
(
!
chunk
->
data
||
chunk
->
size
<
32
)
return
0
;
uint8_t
*
slice
=
chunk
->
data
;
if
(
!
slice
)
return
0
;
SMS_GET4BYTES
(
size
);
SMS_GETFOURCC
(
type
);
assert
(
type
==
ATOM_moof
);
SMS_GET4BYTES
(
size
);
SMS_GETFOURCC
(
type
);
assert
(
type
==
ATOM_mfhd
);
slice
+=
size
-
8
;
SMS_GET4BYTES
(
size
);
SMS_GETFOURCC
(
type
);
assert
(
type
==
ATOM_traf
);
SMS_GET4BYTES
(
size
);
SMS_GETFOURCC
(
type
);
if
(
type
!=
ATOM_tfhd
)
return
0
;
unsigned
ret
=
bswap32
(
((
uint32_t
*
)
slice
)[
1
]
);
((
uint32_t
*
)
slice
)[
1
]
=
bswap32
(
tid
);
return
ret
;
}
static
int
sms_Download
(
stream_t
*
s
,
chunk_t
*
chunk
,
char
*
url
)
static
int
sms_Download
(
stream_t
*
s
,
chunk_t
*
chunk
,
char
*
url
)
{
{
stream_t
*
p_ts
=
stream_UrlNew
(
s
,
url
);
stream_t
*
p_ts
=
stream_UrlNew
(
s
,
url
);
...
@@ -295,7 +262,7 @@ BandwidthAdaptation( stream_t *s, sms_stream_t *sms,
...
@@ -295,7 +262,7 @@ BandwidthAdaptation( stream_t *s, sms_stream_t *sms,
}
}
#endif
#endif
static
int
get_new_chunks
(
stream_t
*
s
,
chunk_t
*
ck
,
sms_stream_t
*
sms
)
static
int
parse_chunk
(
stream_t
*
s
,
chunk_t
*
ck
,
sms_stream_t
*
sms
)
{
{
if
(
ck
->
size
<
24
)
if
(
ck
->
size
<
24
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -316,25 +283,33 @@ static int get_new_chunks( stream_t *s, chunk_t *ck, sms_stream_t *sms )
...
@@ -316,25 +283,33 @@ static int get_new_chunks( stream_t *s, chunk_t *ck, sms_stream_t *sms )
MP4_BoxDumpStructure
(
ck_s
,
&
root_box
);
MP4_BoxDumpStructure
(
ck_s
,
&
root_box
);
#endif
#endif
const
MP4_Box_t
*
uuid_box
=
MP4_BoxGet
(
&
root_box
,
"moof/traf/uuid"
);
/* Do track ID fixup */
while
(
uuid_box
&&
uuid_box
->
i_type
==
ATOM_uuid
)
const
MP4_Box_t
*
tfhd_box
=
MP4_BoxGet
(
&
root_box
,
"moof/traf/tfhd"
);
{
if
(
tfhd_box
)
if
(
!
CmpUUID
(
&
uuid_box
->
i_uuid
,
&
TfrfBoxUUID
)
)
SetDWBE
(
&
ck
->
data
[
tfhd_box
->
i_pos
+
8
+
4
],
sms
->
id
);
break
;
uuid_box
=
uuid_box
->
p_next
;
}
if
(
uuid_box
)
if
(
s
->
p_sys
->
b_live
)
{
{
const
MP4_Box_data_tfrf_t
*
p_tfrfdata
=
uuid_box
->
data
.
p_tfrf
;
const
MP4_Box_t
*
uuid_box
=
MP4_BoxGet
(
&
root_box
,
"moof/traf/uuid"
);
for
(
uint8_t
i
=
0
;
i
<
p_tfrfdata
->
i_fragment_count
;
i
++
)
while
(
uuid_box
&&
uuid_box
->
i_type
==
ATOM_uuid
)
{
if
(
!
CmpUUID
(
&
uuid_box
->
i_uuid
,
&
TfrfBoxUUID
)
)
break
;
uuid_box
=
uuid_box
->
p_next
;
}
if
(
uuid_box
)
{
{
uint64_t
dur
=
p_tfrfdata
->
p_tfrf_data_fields
[
i
].
i_fragment_duration
;
const
MP4_Box_data_tfrf_t
*
p_tfrfdata
=
uuid_box
->
data
.
p_tfrf
;
uint64_t
stime
=
p_tfrfdata
->
p_tfrf_data_fields
[
i
].
i_fragment_abs_time
;
for
(
uint8_t
i
=
0
;
i
<
p_tfrfdata
->
i_fragment_count
;
i
++
)
msg_Dbg
(
s
,
"
\"
tfrf
\"
fragment duration %"
PRIu64
", "
{
"fragment abs time %"
PRIu64
,
dur
,
stime
);
uint64_t
dur
=
p_tfrfdata
->
p_tfrf_data_fields
[
i
].
i_fragment_duration
;
if
(
!
chunk_Get
(
sms
,
stime
+
dur
)
)
uint64_t
stime
=
p_tfrfdata
->
p_tfrf_data_fields
[
i
].
i_fragment_abs_time
;
chunk_AppendNew
(
sms
,
dur
,
stime
);
msg_Dbg
(
s
,
"
\"
tfrf
\"
fragment duration %"
PRIu64
", "
"fragment abs time %"
PRIu64
,
dur
,
stime
);
if
(
!
chunk_Get
(
sms
,
stime
+
dur
)
)
chunk_AppendNew
(
sms
,
dur
,
stime
);
}
}
}
}
}
...
@@ -506,17 +481,7 @@ static int Download( stream_t *s, sms_stream_t *sms )
...
@@ -506,17 +481,7 @@ static int Download( stream_t *s, sms_stream_t *sms )
}
}
duration
=
mdate
()
-
duration
;
duration
=
mdate
()
-
duration
;
unsigned
real_id
=
set_track_id
(
chunk
,
sms
->
id
);
parse_chunk
(
s
,
chunk
,
sms
);
if
(
real_id
==
0
)
{
msg_Err
(
s
,
"tfhd box not found or invalid chunk"
);
return
VLC_EGENERIC
;
}
if
(
p_sys
->
b_live
)
{
get_new_chunks
(
s
,
chunk
,
sms
);
}
msg_Info
(
s
,
"downloaded chunk @%"
PRIu64
" from stream %s at quality %u"
,
msg_Info
(
s
,
"downloaded chunk @%"
PRIu64
" from stream %s at quality %u"
,
chunk
->
start_time
,
sms
->
name
,
sms
->
current_qlvl
->
Bitrate
);
chunk
->
start_time
,
sms
->
name
,
sms
->
current_qlvl
->
Bitrate
);
...
...
modules/stream_filter/smooth/smooth.c
View file @
0c9f38b8
...
@@ -761,12 +761,6 @@ static unsigned int sms_Read( stream_t *s, uint8_t *p_read, unsigned int i_read
...
@@ -761,12 +761,6 @@ static unsigned int sms_Read( stream_t *s, uint8_t *p_read, unsigned int i_read
const
char
*
verb
=
p_read
==
NULL
?
"skipping"
:
"reading"
;
const
char
*
verb
=
p_read
==
NULL
?
"skipping"
:
"reading"
;
msg_Dbg
(
s
,
"%s chunk time %"
PRIu64
" (%u bytes), type %i"
,
msg_Dbg
(
s
,
"%s chunk time %"
PRIu64
" (%u bytes), type %i"
,
verb
,
chunk
->
start_time
,
i_read
,
chunk
->
type
);
verb
,
chunk
->
start_time
,
i_read
,
chunk
->
type
);
/* check integrity */
uint32_t
type
;
uint8_t
*
slice
=
chunk
->
data
;
SMS_GET4BYTES
(
type
);
SMS_GETFOURCC
(
type
);
assert
(
type
==
ATOM_moof
||
type
==
ATOM_uuid
);
}
}
uint64_t
len
=
0
;
uint64_t
len
=
0
;
...
...
modules/stream_filter/smooth/smooth.h
View file @
0c9f38b8
...
@@ -141,37 +141,6 @@ struct stream_sys_t
...
@@ -141,37 +141,6 @@ struct stream_sys_t
bool
b_close
;
/* set by Close() */
bool
b_close
;
/* set by Close() */
};
};
#define SMS_GET4BYTES( dst ) do { \
dst = U32_AT( slice ); \
slice += 4; \
} while(0)
#define SMS_GET1BYTE( dst ) do { \
dst = *slice; \
slice += 1; \
} while(0)
#define SMS_GET3BYTES( dst ) do { \
dst = Get24bBE( slice ); \
slice += 3; \
} while(0)
#define SMS_GET8BYTES( dst ) do { \
dst = U64_AT( slice ); \
slice += 8; \
} while(0)
#define SMS_GET4or8BYTES( dst ) \
if( (version) == 0 ) \
SMS_GET4BYTES( dst ); \
else \
SMS_GET8BYTES( dst ); \
#define SMS_GETFOURCC( dst ) do { \
memcpy( &dst, slice, 4 ); \
slice += 4; \
} while(0)
#define SMS_GET_SELECTED_ST( cat ) \
#define SMS_GET_SELECTED_ST( cat ) \
sms_get_stream_by_cat( p_sys, cat )
sms_get_stream_by_cat( p_sys, cat )
...
...
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