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
1bc2d77b
Commit
1bc2d77b
authored
Mar 30, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ts: decode object stream commands
parent
4541bee2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
15 deletions
+100
-15
modules/demux/mpeg4_iod.c
modules/demux/mpeg4_iod.c
+98
-15
modules/demux/mpeg4_iod.h
modules/demux/mpeg4_iod.h
+2
-0
No files found.
modules/demux/mpeg4_iod.c
View file @
1bc2d77b
...
@@ -107,6 +107,7 @@ static char* ODGetURL( unsigned *pi_data, const uint8_t **pp_data )
...
@@ -107,6 +107,7 @@ static char* ODGetURL( unsigned *pi_data, const uint8_t **pp_data )
typedef
union
typedef
union
{
{
od_descriptor_t
*
p_od
;
od_descriptor_t
*
p_od
;
od_descriptor_t
**
pp_ods
;
es_mpeg4_descriptor_t
*
es_descr
;
es_mpeg4_descriptor_t
*
es_descr
;
decoder_config_descriptor_t
*
p_dec_config
;
decoder_config_descriptor_t
*
p_dec_config
;
sl_config_descriptor_t
*
sl_descr
;
sl_config_descriptor_t
*
sl_descr
;
...
@@ -373,18 +374,28 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
...
@@ -373,18 +374,28 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
{
{
case
ODTag_ObjectDescr
:
case
ODTag_ObjectDescr
:
{
{
od_descriptor_t
*
p_od
=
calloc
(
1
,
sizeof
(
od_descriptor_t
)
);
if
(
!
p_od
)
break
;
od_read_params_t
childparams
;
childparams
.
p_od
=
params
.
pp_ods
[
i_read_count
]
=
p_od
;
/* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
/* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
if
(
!
ODObjectDescriptorRead
(
p_object
,
i_descriptor_data
,
if
(
!
ODObjectDescriptorRead
(
p_object
,
i_descriptor_data
,
p_descriptor_data
,
params
)
)
p_descriptor_data
,
child
params
)
)
{};
{};
break
;
break
;
}
}
case
ODTag_InitialObjectDescr
:
case
ODTag_InitialObjectDescr
:
{
{
od_descriptor_t
*
p_iod
=
calloc
(
1
,
sizeof
(
od_descriptor_t
)
);
if
(
!
p_iod
)
break
;
od_read_params_t
childparams
;
childparams
.
p_od
=
params
.
pp_ods
[
i_read_count
]
=
p_iod
;
/* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
/* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
if
(
!
OD_InitialObjectDesc_Read
(
p_object
,
i_descriptor_data
,
if
(
!
OD_InitialObjectDesc_Read
(
p_object
,
i_descriptor_data
,
p_descriptor_data
,
params
)
)
p_descriptor_data
,
child
params
)
)
{};
{};
break
;
break
;
}
}
...
@@ -438,24 +449,19 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
...
@@ -438,24 +449,19 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
return
i_read_count
;
return
i_read_count
;
}
}
static
od_descriptor_t
*
ODInit
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
,
static
uint8_t
ODInit
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
,
uint8_t
i_start_tag
,
uint8_t
i_min
,
uint8_t
i_max
)
uint8_t
i_start_tag
,
uint8_t
i_min
,
uint8_t
i_max
,
od_descriptor_t
**
pp_ods
)
{
{
/* Initial Object Descriptor must follow */
od_descriptor_t
*
p_iod
=
calloc
(
1
,
sizeof
(
od_descriptor_t
)
);
if
(
!
p_iod
)
return
NULL
;
od_read_params_t
params
;
od_read_params_t
params
;
params
.
p_od
=
p_iod
;
params
.
pp_ods
=
pp_ods
;
if
(
OD_Desc_Read
(
p_object
,
&
i_data
,
&
p_data
,
i_start_tag
,
i_max
,
params
)
<
i_min
)
uint8_t
i_read
=
OD_Desc_Read
(
p_object
,
&
i_data
,
&
p_data
,
i_start_tag
,
i_max
,
params
);
if
(
i_read
<
i_min
)
{
{
od_debug
(
p_object
,
" cannot read first tag 0x%"
PRIx8
,
i_start_tag
);
od_debug
(
p_object
,
" cannot read first tag 0x%"
PRIx8
,
i_start_tag
);
free
(
p_iod
);
return
0
;
return
NULL
;
}
}
return
p_io
d
;
return
i_rea
d
;
}
}
od_descriptor_t
*
IODNew
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
)
od_descriptor_t
*
IODNew
(
vlc_object_t
*
p_object
,
unsigned
i_data
,
const
uint8_t
*
p_data
)
...
@@ -481,7 +487,14 @@ od_descriptor_t *IODNew( vlc_object_t *p_object, unsigned i_data, const uint8_t
...
@@ -481,7 +487,14 @@ od_descriptor_t *IODNew( vlc_object_t *p_object, unsigned i_data, const uint8_t
return
NULL
;
return
NULL
;
}
}
return
ODInit
(
p_object
,
i_data
,
p_data
,
ODTag_InitialObjectDescr
,
1
,
1
);
od_descriptor_t
*
ods
[
1
];
uint8_t
i_count
=
ODInit
(
p_object
,
i_data
,
p_data
,
ODTag_InitialObjectDescr
,
1
,
1
,
ods
);
if
(
!
i_count
)
{
ODFree
(
ods
[
0
]
);
return
NULL
;
}
return
ods
[
0
];
}
}
void
ODFree
(
od_descriptor_t
*
p_iod
)
void
ODFree
(
od_descriptor_t
*
p_iod
)
...
@@ -608,3 +621,73 @@ sl_header_data DecodeSLHeader( unsigned i_data, const uint8_t *p_data,
...
@@ -608,3 +621,73 @@ sl_header_data DecodeSLHeader( unsigned i_data, const uint8_t *p_data,
return
ret
;
return
ret
;
}
}
/*****************************************************************************
* OD Commands Parser
*****************************************************************************/
#define ODTag_ObjectDescrUpdate 0x01
#define ODTag_ObjectDescrRemove 0x02
static
void
ObjectDescrUpdateCommandRead
(
vlc_object_t
*
p_object
,
od_descriptors_t
*
p_ods
,
unsigned
i_data
,
const
uint8_t
*
p_data
)
{
od_descriptor_t
*
p_odsread
[
255
];
uint8_t
i_count
=
ODInit
(
p_object
,
i_data
,
p_data
,
ODTag_ObjectDescr
,
1
,
255
,
p_odsread
);
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
{
od_descriptor_t
*
p_od
=
p_odsread
[
i
];
int
i_pos
=
-
1
;
ARRAY_BSEARCH
(
p_ods
->
objects
,
->
i_ID
,
int
,
p_od
->
i_ID
,
i_pos
);
if
(
i_pos
>
-
1
)
{
ODFree
(
p_ods
->
objects
.
p_elems
[
i_pos
]
);
p_ods
->
objects
.
p_elems
[
i_pos
]
=
p_od
;
}
else
{
ARRAY_APPEND
(
p_ods
->
objects
,
p_od
);
}
}
}
static
void
ObjectDescrRemoveCommandRead
(
vlc_object_t
*
p_object
,
od_descriptors_t
*
p_ods
,
unsigned
i_data
,
const
uint8_t
*
p_data
)
{
VLC_UNUSED
(
p_object
);
bs_t
s
;
bs_init
(
&
s
,
p_data
,
i_data
);
for
(
unsigned
i
=
0
;
i
<
(
i_data
*
8
/
10
);
i
++
)
{
uint16_t
i_id
=
bs_read
(
&
s
,
10
);
int
i_pos
=
-
1
;
ARRAY_BSEARCH
(
p_ods
->
objects
,
->
i_ID
,
int
,
i_id
,
i_pos
);
if
(
i_pos
>
-
1
)
ARRAY_REMOVE
(
p_ods
->
objects
,
i_pos
);
}
}
void
DecodeODCommand
(
vlc_object_t
*
p_object
,
od_descriptors_t
*
p_ods
,
unsigned
i_data
,
const
uint8_t
*
p_data
)
{
while
(
i_data
)
{
const
uint8_t
i_tag
=
ODGetBytes
(
&
i_data
,
&
p_data
,
1
);
const
unsigned
i_length
=
ODDescriptorLength
(
&
i_data
,
&
p_data
);
if
(
!
i_length
||
i_length
>
i_data
)
break
;
od_debug
(
p_object
,
"Decode tag 0x%x length %d"
,
i_tag
,
i_length
);
switch
(
i_tag
)
{
case
ODTag_ObjectDescrUpdate
:
ObjectDescrUpdateCommandRead
(
p_object
,
p_ods
,
i_data
,
p_data
);
break
;
case
ODTag_ObjectDescrRemove
:
ObjectDescrRemoveCommandRead
(
p_object
,
p_ods
,
i_data
,
p_data
);
break
;
default:
break
;
}
p_data
+=
i_length
;
i_data
-=
i_data
;
}
}
modules/demux/mpeg4_iod.h
View file @
1bc2d77b
...
@@ -103,3 +103,5 @@ void ODFree( od_descriptor_t *p_od );
...
@@ -103,3 +103,5 @@ void ODFree( od_descriptor_t *p_od );
sl_header_data
DecodeSLHeader
(
unsigned
i_data
,
const
uint8_t
*
p_data
,
sl_header_data
DecodeSLHeader
(
unsigned
i_data
,
const
uint8_t
*
p_data
,
const
sl_config_descriptor_t
*
sl
);
const
sl_config_descriptor_t
*
sl
);
void
DecodeODCommand
(
vlc_object_t
*
p_object
,
od_descriptors_t
*
,
unsigned
i_data
,
const
uint8_t
*
p_data
);
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