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
1c9f6db4
Commit
1c9f6db4
authored
Nov 22, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* copy: removed the old spu packetizer.
parent
aa1ca803
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
92 deletions
+8
-92
modules/packetizer/copy.c
modules/packetizer/copy.c
+8
-92
No files found.
modules/packetizer/copy.c
View file @
1c9f6db4
...
...
@@ -2,7 +2,7 @@
* copy.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: copy.c,v 1.
19 2003/11/20 18:27:4
4 fenrir Exp $
* $Id: copy.c,v 1.
20 2003/11/22 20:17:1
4 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
...
...
@@ -48,14 +48,10 @@ vlc_module_end();
*****************************************************************************/
struct
decoder_sys_t
{
int
i_spu_size
;
int
i_spu
;
block_t
*
p_block
;
};
static
block_t
*
PacketizeAV
(
decoder_t
*
,
block_t
**
);
static
block_t
*
PacketizeSPU
(
decoder_t
*
,
block_t
**
);
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
/*****************************************************************************
* Open: probe the packetizer and return score
...
...
@@ -68,28 +64,16 @@ static int Open( vlc_object_t *p_this )
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_sys_t
*
p_sys
;
if
(
p_dec
->
fmt_in
.
i_cat
==
AUDIO_ES
||
p_dec
->
fmt_in
.
i_cat
==
VIDEO_ES
)
{
p_dec
->
pf_packetize
=
PacketizeAV
;
}
else
if
(
p_dec
->
fmt_in
.
i_cat
==
SPU_ES
)
{
if
(
p_dec
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
' '
)
||
p_dec
->
fmt_in
.
i_codec
==
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
'b'
)
)
{
p_dec
->
pf_packetize
=
PacketizeSPU
;
}
else
{
p_dec
->
pf_packetize
=
PacketizeAV
;
}
}
else
if
(
p_dec
->
fmt_in
.
i_cat
!=
AUDIO_ES
&&
p_dec
->
fmt_in
.
i_cat
!=
VIDEO_ES
&&
p_dec
->
fmt_in
.
i_cat
!=
SPU_ES
)
{
msg_Err
(
p_dec
,
"invalid ES type"
);
return
VLC_EGENERIC
;
}
p_dec
->
pf_packetize
=
Packetize
;
/* Create the output format */
memcpy
(
&
p_dec
->
fmt_out
,
&
p_dec
->
fmt_in
,
sizeof
(
es_format_t
)
);
if
(
p_dec
->
fmt_in
.
i_extra
>
0
)
...
...
@@ -239,16 +223,9 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
break
;
/* subtitles */
case
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
'b'
):
p_dec
->
fmt_out
.
i_codec
=
VLC_FOURCC
(
's'
,
'p'
,
'u'
,
' '
);
break
;
}
p_dec
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
block_t
)
);
p_sys
->
i_spu_size
=
0
;
p_sys
->
i_spu
=
0
;
p_sys
->
p_block
=
NULL
;
return
VLC_SUCCESS
;
...
...
@@ -272,7 +249,7 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* PacketizeStd: packetize an unit (here copy a complete block )
*****************************************************************************/
static
block_t
*
Packetize
AV
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
static
block_t
*
Packetize
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
block_t
*
p_block
;
block_t
*
p_ret
=
p_dec
->
p_sys
->
p_block
;
...
...
@@ -300,64 +277,3 @@ static block_t *PacketizeAV ( decoder_t *p_dec, block_t **pp_block )
return
p_ret
;
}
/*****************************************************************************
* PacketizeSPU: packetize an SPU unit (so gather all PES of one subtitle)
*****************************************************************************/
static
block_t
*
PacketizeSPU
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
block_t
*
p_block
;
if
(
pp_block
==
NULL
||
*
pp_block
==
NULL
)
{
return
NULL
;
}
p_block
=
*
pp_block
;
*
pp_block
=
NULL
;
if
(
p_sys
->
i_spu_size
<=
0
&&
(
p_block
->
i_pts
<=
0
||
p_block
->
i_buffer
<
4
)
)
{
msg_Dbg
(
p_dec
,
"invalid starting packet (size < 4 or pts <=0)"
);
block_Release
(
p_block
);
return
NULL
;
}
block_ChainAppend
(
&
p_sys
->
p_block
,
p_block
);
p_sys
->
i_spu
+=
p_block
->
i_buffer
;
if
(
p_sys
->
i_spu_size
<=
0
)
{
int
i_rle
=
(
(
p_block
->
p_buffer
[
2
]
<<
8
)
|
p_block
->
p_buffer
[
3
]
)
-
4
;
p_sys
->
i_spu_size
=
(
p_block
->
p_buffer
[
0
]
<<
8
)
|
p_block
->
p_buffer
[
1
];
msg_Dbg
(
p_dec
,
"i_spu_size=%d i_rle=%d"
,
p_sys
->
i_spu_size
,
i_rle
);
if
(
p_sys
->
i_spu_size
<=
0
||
i_rle
>=
p_sys
->
i_spu_size
)
{
p_sys
->
i_spu_size
=
0
;
p_sys
->
i_spu
=
0
;
p_sys
->
p_block
=
NULL
;
block_Release
(
p_block
);
return
NULL
;
}
}
if
(
p_sys
->
i_spu
>=
p_sys
->
i_spu_size
)
{
/* We have a complete sub */
block_t
*
p_ret
=
p_sys
->
p_block
;
msg_Dbg
(
p_dec
,
"SPU packets size=%d should be %d"
,
p_sys
->
i_spu
,
p_sys
->
i_spu_size
);
p_sys
->
i_spu_size
=
0
;
p_sys
->
i_spu
=
0
;
p_sys
->
p_block
=
NULL
;
return
p_ret
;
}
return
NULL
;
}
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