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
fe544788
Commit
fe544788
authored
Feb 10, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS Mux: cosmetics / goto
parent
fb225b64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
84 deletions
+72
-84
modules/mux/mpeg/ts.c
modules/mux/mpeg/ts.c
+72
-84
No files found.
modules/mux/mpeg/ts.c
View file @
fe544788
...
@@ -803,10 +803,9 @@ static int ChangeKeyCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -803,10 +803,9 @@ static int ChangeKeyCallback( vlc_object_t *p_this, char const *psz_cmd,
sout_mux_sys_t
*
p_sys
=
p_mux
->
p_sys
;
sout_mux_sys_t
*
p_sys
=
p_mux
->
p_sys
;
int
ret
;
int
ret
;
vlc_mutex_lock
(
&
p_sys
->
csa_lock
);
vlc_mutex_lock
(
&
p_sys
->
csa_lock
);
ret
=
csa_SetCW
(
p_this
,
p_sys
->
csa
,
newval
.
psz_string
,
ret
=
csa_SetCW
(
p_this
,
p_sys
->
csa
,
newval
.
psz_string
,
!!
(
intptr_t
)
p_data
);
!!
(
intptr_t
)
p_data
);
vlc_mutex_unlock
(
&
p_sys
->
csa_lock
);
vlc_mutex_unlock
(
&
p_sys
->
csa_lock
);
return
ret
;
return
ret
;
}
}
...
@@ -906,8 +905,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -906,8 +905,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
ts_stream_t
*
p_stream
;
ts_stream_t
*
p_stream
;
p_input
->
p_sys
=
p_stream
=
calloc
(
1
,
sizeof
(
ts_stream_t
)
);
p_input
->
p_sys
=
p_stream
=
calloc
(
1
,
sizeof
(
ts_stream_t
)
);
if
(
!
p_
input
->
p_sys
)
if
(
!
p_
stream
)
return
VLC_ENOMEM
;
goto
oom
;
if
(
p_sys
->
b_es_id_pid
)
if
(
p_sys
->
b_es_id_pid
)
p_stream
->
i_pid
=
p_input
->
p_fmt
->
i_id
&
0x1fff
;
p_stream
->
i_pid
=
p_input
->
p_fmt
->
i_id
&
0x1fff
;
...
@@ -1022,10 +1021,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -1022,10 +1021,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_stream
->
i_langs
=
1
+
p_input
->
p_fmt
->
i_extra_languages
;
p_stream
->
i_langs
=
1
+
p_input
->
p_fmt
->
i_extra_languages
;
p_stream
->
lang
=
calloc
(
1
,
p_stream
->
i_langs
*
4
);
p_stream
->
lang
=
calloc
(
1
,
p_stream
->
i_langs
*
4
);
if
(
!
p_stream
->
lang
)
if
(
!
p_stream
->
lang
)
{
goto
oom
;
free
(
p_stream
);
return
VLC_ENOMEM
;
}
msg_Dbg
(
p_mux
,
"adding input codec=%4.4s pid=%d"
,
msg_Dbg
(
p_mux
,
"adding input codec=%4.4s pid=%d"
,
(
char
*
)
&
p_stream
->
i_codec
,
p_stream
->
i_pid
);
(
char
*
)
&
p_stream
->
i_codec
,
p_stream
->
i_pid
);
...
@@ -1052,8 +1048,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -1052,8 +1048,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
{
{
p_stream
->
i_extra
=
55
;
p_stream
->
i_extra
=
55
;
p_stream
->
p_extra
=
malloc
(
p_stream
->
i_extra
);
p_stream
->
p_extra
=
malloc
(
p_stream
->
i_extra
);
if
(
p_stream
->
p_extra
)
if
(
!
p_stream
->
p_extra
)
{
goto
oom
;
uint8_t
*
p
=
p_stream
->
p_extra
;
uint8_t
*
p
=
p_stream
->
p_extra
;
p
[
0
]
=
0x10
;
/* textFormat, 0x10 for 3GPP TS 26.245 */
p
[
0
]
=
0x10
;
/* textFormat, 0x10 for 3GPP TS 26.245 */
p
[
1
]
=
0x00
;
/* flags: 1b: associated video info flag
p
[
1
]
=
0x00
;
/* flags: 1b: associated video info flag
...
@@ -1093,24 +1090,18 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -1093,24 +1090,18 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
*
p
++
=
9
;
/* font name length */
*
p
++
=
9
;
/* font name length */
memcpy
(
p
,
"Helvetica"
,
9
);
/* font name */
memcpy
(
p
,
"Helvetica"
,
9
);
/* font name */
}
}
else
p_stream
->
i_extra
=
0
;
}
else
else
{
{
/* Copy extra data (VOL for MPEG-4 and extra BitMapInfoHeader for VFW */
/* Copy extra data (VOL for MPEG-4 and extra BitMapInfoHeader for VFW */
p_stream
->
i_extra
=
p_input
->
p_fmt
->
i_extra
;
es_format_t
*
fmt
=
p_input
->
p_fmt
;
if
(
p_stream
->
i_extra
>
0
)
if
(
fmt
->
i_extra
>
0
)
{
{
p_stream
->
p_extra
=
malloc
(
p_stream
->
i_extra
);
p_stream
->
i_extra
=
fmt
->
i_extra
;
if
(
p_stream
->
p_extra
)
p_stream
->
p_extra
=
malloc
(
fmt
->
i_extra
);
{
if
(
!
p_stream
->
p_extra
)
memcpy
(
p_stream
->
p_extra
,
goto
oom
;
p_input
->
p_fmt
->
p_extra
,
p_input
->
p_fmt
->
i_extra
);
memcpy
(
p_stream
->
p_extra
,
fmt
->
p_extra
,
fmt
->
i_extra
);
}
else
p_stream
->
i_extra
=
0
;
}
}
}
}
...
@@ -1136,6 +1127,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -1136,6 +1127,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
oom:
free
(
p_stream
->
lang
);
free
(
p_stream
);
return
VLC_ENOMEM
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -1808,19 +1804,17 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1808,19 +1804,17 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
{
{
VLC_UNUSED
(
p_mux
);
VLC_UNUSED
(
p_mux
);
block_t
*
p_pes
=
p_stream
->
chain_pes
.
p_first
;
block_t
*
p_pes
=
p_stream
->
chain_pes
.
p_first
;
block_t
*
p_ts
;
bool
b_new_pes
=
false
;
bool
b_new_pes
=
false
;
bool
b_adaptation_field
=
false
;
bool
b_adaptation_field
=
false
;
int
i_payload_max
=
184
-
(
b_pcr
?
8
:
0
);
int
i_payload_max
=
184
-
(
b_pcr
?
8
:
0
);
int
i_payload
;
if
(
p_stream
->
i_pes_used
<=
0
)
if
(
p_stream
->
i_pes_used
<=
0
)
{
{
b_new_pes
=
true
;
b_new_pes
=
true
;
}
}
i_payload
=
__MIN
(
(
int
)
p_pes
->
i_buffer
-
p_stream
->
i_pes_used
,
i
nt
i
_payload
=
__MIN
(
(
int
)
p_pes
->
i_buffer
-
p_stream
->
i_pes_used
,
i_payload_max
);
i_payload_max
);
if
(
b_pcr
||
i_payload
<
i_payload_max
)
if
(
b_pcr
||
i_payload
<
i_payload_max
)
...
@@ -1828,7 +1822,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1828,7 +1822,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
b_adaptation_field
=
true
;
b_adaptation_field
=
true
;
}
}
p_ts
=
block_New
(
p_mux
,
188
);
block_t
*
p_ts
=
block_New
(
p_mux
,
188
);
if
(
b_new_pes
&&
!
(
p_pes
->
i_flags
&
BLOCK_FLAG_NO_KEYFRAME
)
&&
p_pes
->
i_flags
&
BLOCK_FLAG_TYPE_I
)
if
(
b_new_pes
&&
!
(
p_pes
->
i_flags
&
BLOCK_FLAG_NO_KEYFRAME
)
&&
p_pes
->
i_flags
&
BLOCK_FLAG_TYPE_I
)
{
{
...
@@ -1845,14 +1839,13 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1845,14 +1839,13 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
p_stream
->
i_continuity_counter
;
p_stream
->
i_continuity_counter
;
p_stream
->
i_continuity_counter
=
(
p_stream
->
i_continuity_counter
+
1
)
%
16
;
p_stream
->
i_continuity_counter
=
(
p_stream
->
i_continuity_counter
+
1
)
%
16
;
p_stream
->
b_discontinuity
=
(
p_pes
->
i_flags
&
BLOCK_FLAG_DISCONTINUITY
)
;
p_stream
->
b_discontinuity
=
p_pes
->
i_flags
&
BLOCK_FLAG_DISCONTINUITY
;
if
(
b_adaptation_field
)
if
(
b_adaptation_field
)
{
{
int
i_stuffing
=
i_payload_max
-
i_payload
;
if
(
b_pcr
)
if
(
b_pcr
)
{
{
int
i_stuffing
=
i_payload_max
-
i_payload
;
p_ts
->
i_flags
|=
BLOCK_FLAG_CLOCK
;
p_ts
->
i_flags
|=
BLOCK_FLAG_CLOCK
;
p_ts
->
p_buffer
[
4
]
=
7
+
i_stuffing
;
p_ts
->
p_buffer
[
4
]
=
7
+
i_stuffing
;
...
@@ -1862,11 +1855,11 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1862,11 +1855,11 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
p_ts
->
p_buffer
[
5
]
|=
0x80
;
/* flag TS dicontinuity */
p_ts
->
p_buffer
[
5
]
|=
0x80
;
/* flag TS dicontinuity */
p_stream
->
b_discontinuity
=
false
;
p_stream
->
b_discontinuity
=
false
;
}
}
p_ts
->
p_buffer
[
6
]
=
(
0
)
&
0xff
;
p_ts
->
p_buffer
[
6
]
=
0
&
0xff
;
p_ts
->
p_buffer
[
7
]
=
(
0
)
&
0xff
;
p_ts
->
p_buffer
[
7
]
=
0
&
0xff
;
p_ts
->
p_buffer
[
8
]
=
(
0
)
&
0xff
;
p_ts
->
p_buffer
[
8
]
=
0
&
0xff
;
p_ts
->
p_buffer
[
9
]
=
(
0
)
&
0xff
;
p_ts
->
p_buffer
[
9
]
=
0
&
0xff
;
p_ts
->
p_buffer
[
10
]
=
(
(
0
)
&
0x80
)
|
0x7e
;
p_ts
->
p_buffer
[
10
]
=
(
0
&
0x80
)
|
0x7e
;
p_ts
->
p_buffer
[
11
]
=
0
;
p_ts
->
p_buffer
[
11
]
=
0
;
for
(
int
i
=
12
;
i
<
12
+
i_stuffing
;
i
++
)
for
(
int
i
=
12
;
i
<
12
+
i_stuffing
;
i
++
)
...
@@ -1876,8 +1869,6 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1876,8 +1869,6 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
}
}
else
else
{
{
int
i_stuffing
=
i_payload_max
-
i_payload
;
p_ts
->
p_buffer
[
4
]
=
i_stuffing
-
1
;
p_ts
->
p_buffer
[
4
]
=
i_stuffing
-
1
;
if
(
i_stuffing
>
1
)
if
(
i_stuffing
>
1
)
{
{
...
@@ -1901,25 +1892,22 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
...
@@ -1901,25 +1892,22 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
if
(
p_stream
->
i_pes_used
>=
(
int
)
p_pes
->
i_buffer
)
if
(
p_stream
->
i_pes_used
>=
(
int
)
p_pes
->
i_buffer
)
{
{
p_pes
=
BufferChainGet
(
&
p_stream
->
chain_pes
);
block_Release
(
BufferChainGet
(
&
p_stream
->
chain_pes
));
block_Release
(
p_pes
);
p_pes
=
p_stream
->
chain_pes
.
p_first
;
p_pes
=
p_stream
->
chain_pes
.
p_first
;
p_stream
->
i_pes_length
=
0
;
if
(
p_pes
)
if
(
p_pes
)
{
{
p_stream
->
i_pes_dts
=
p_pes
->
i_dts
;
p_stream
->
i_pes_dts
=
p_pes
->
i_dts
;
p_stream
->
i_pes_length
=
0
;
while
(
p_pes
)
while
(
p_pes
)
{
{
p_stream
->
i_pes_length
+=
p_pes
->
i_length
;
p_stream
->
i_pes_length
+=
p_pes
->
i_length
;
p_pes
=
p_pes
->
p_next
;
p_pes
=
p_pes
->
p_next
;
}
}
}
}
else
else
{
{
p_stream
->
i_pes_dts
=
0
;
p_stream
->
i_pes_dts
=
0
;
p_stream
->
i_pes_length
=
0
;
}
}
p_stream
->
i_pes_used
=
0
;
p_stream
->
i_pes_used
=
0
;
}
}
...
...
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