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
ebc54664
Commit
ebc54664
authored
Mar 28, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ts: add SL header decoding
parent
b209b71e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
+113
-0
modules/demux/mpeg4_iod.c
modules/demux/mpeg4_iod.c
+101
-0
modules/demux/mpeg4_iod.h
modules/demux/mpeg4_iod.h
+12
-0
No files found.
modules/demux/mpeg4_iod.c
View file @
ebc54664
...
@@ -454,3 +454,104 @@ void IODFree( iod_descriptor_t *p_iod )
...
@@ -454,3 +454,104 @@ void IODFree( iod_descriptor_t *p_iod )
}
}
free
(
p_iod
);
free
(
p_iod
);
}
}
/*****************************************************************************
* SL Packet Parser
*****************************************************************************/
sl_header_data
DecodeSLHeader
(
unsigned
i_data
,
const
uint8_t
*
p_data
,
const
sl_config_descriptor_t
*
sl
)
{
sl_header_data
ret
=
{
0
};
bs_t
s
;
bs_init
(
&
s
,
p_data
,
i_data
);
bool
b_has_ocr
=
false
;
bool
b_is_idle
=
false
;
bool
b_has_padding
=
false
;
uint8_t
i_padding
=
0
;
if
(
sl
->
i_flags
&
USE_ACCESS_UNIT_START_FLAG
)
ret
.
b_au_start
=
bs_read1
(
&
s
);
if
(
sl
->
i_flags
&
USE_ACCESS_UNIT_END_FLAG
)
ret
.
b_au_end
=
bs_read1
(
&
s
);
if
(
sl
->
i_OCR_length
>
0
)
b_has_ocr
=
bs_read1
(
&
s
);
if
(
sl
->
i_flags
&
USE_IDLE_FLAG
)
b_is_idle
=
bs_read1
(
&
s
);
if
(
sl
->
i_flags
&
USE_PADDING_FLAG
)
b_has_padding
=
bs_read1
(
&
s
);
if
(
ret
.
b_au_end
==
ret
.
b_au_start
&&
ret
.
b_au_start
==
false
)
ret
.
b_au_end
=
ret
.
b_au_start
=
true
;
if
(
b_has_padding
)
i_padding
=
bs_read
(
&
s
,
3
);
/* Optional fields */
if
(
!
b_is_idle
&&
(
!
b_has_padding
||
!
i_padding
)
)
/* When not idle and not only padding */
{
bool
b_has_dts
=
false
;
bool
b_has_cts
=
false
;
bool
b_has_instant_bitrate
=
false
;
struct
{
bool
*
p_b
;
mtime_t
*
p_t
;
}
const
timestamps
[
2
]
=
{
{
&
b_has_dts
,
&
ret
.
i_dts
},
{
&
b_has_cts
,
&
ret
.
i_pts
}
};
bs_read
(
&
s
,
sl
->
i_packet_seqnum_length
);
if
(
sl
->
i_degradation_priority_length
&&
bs_read1
(
&
s
)
)
bs_read
(
&
s
,
sl
->
i_degradation_priority_length
);
if
(
b_has_ocr
)
bs_read
(
&
s
,
sl
->
i_OCR_length
);
if
(
ret
.
b_au_start
)
{
if
(
sl
->
i_flags
&
USE_RANDOM_ACCESS_POINT_FLAG
)
bs_read1
(
&
s
);
bs_read
(
&
s
,
sl
->
i_AU_seqnum_length
);
if
(
sl
->
i_flags
&
USE_TIMESTAMPS_FLAG
)
{
b_has_dts
=
bs_read1
(
&
s
);
b_has_cts
=
bs_read1
(
&
s
);
}
if
(
sl
->
i_instant_bitrate_length
)
b_has_instant_bitrate
=
bs_read1
(
&
s
);
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
if
(
!*
(
timestamps
[
i
].
p_b
)
)
continue
;
uint64_t
i_read
=
bs_read
(
&
s
,
__MIN
(
32
,
sl
->
i_timestamp_length
)
);
if
(
sl
->
i_timestamp_length
>
32
)
{
uint8_t
i_bits
=
__MAX
(
1
,
sl
->
i_timestamp_length
-
32
);
i_read
=
i_read
<<
i_bits
;
i_read
|=
bs_read
(
&
s
,
i_bits
);
}
if
(
sl
->
i_timestamp_resolution
)
*
(
timestamps
[
i
].
p_t
)
=
VLC_TS_0
+
CLOCK_FREQ
*
i_read
/
sl
->
i_timestamp_resolution
;
}
bs_read
(
&
s
,
sl
->
i_AU_length
);
if
(
b_has_instant_bitrate
)
bs_read
(
&
s
,
sl
->
i_instant_bitrate_length
);
}
/* more to read if ExtSLConfigDescrTag */
}
if
(
b_has_padding
&&
!
i_padding
)
/* all padding */
ret
.
i_size
=
i_data
;
else
ret
.
i_size
=
(
bs_pos
(
&
s
)
+
7
)
/
8
;
return
ret
;
}
modules/demux/mpeg4_iod.h
View file @
ebc54664
...
@@ -52,6 +52,15 @@ typedef struct
...
@@ -52,6 +52,15 @@ typedef struct
uint64_t
i_startcomposition_timestamp
;
uint64_t
i_startcomposition_timestamp
;
}
sl_config_descriptor_t
;
}
sl_config_descriptor_t
;
typedef
struct
{
unsigned
i_size
;
bool
b_au_start
;
bool
b_au_end
;
mtime_t
i_dts
;
mtime_t
i_pts
;
}
sl_header_data
;
typedef
struct
typedef
struct
{
{
uint8_t
i_objectTypeIndication
;
uint8_t
i_objectTypeIndication
;
...
@@ -85,3 +94,6 @@ typedef struct
...
@@ -85,3 +94,6 @@ typedef struct
iod_descriptor_t
*
IODNew
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
);
iod_descriptor_t
*
IODNew
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
);
void
IODFree
(
iod_descriptor_t
*
p_iod
);
void
IODFree
(
iod_descriptor_t
*
p_iod
);
sl_header_data
DecodeSLHeader
(
unsigned
i_data
,
const
uint8_t
*
p_data
,
const
sl_config_descriptor_t
*
sl
);
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