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
5aad8ebb
Commit
5aad8ebb
authored
Nov 20, 2015
by
Steve Lhomme
Committed by
Thomas Guillem
Nov 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packetizer: use a custom flush callback
Signed-off-by:
Thomas Guillem
<
thomas@gllm.fr
>
parent
2b38ec86
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
3 deletions
+99
-3
modules/packetizer/avparser.c
modules/packetizer/avparser.c
+34
-3
modules/packetizer/copy.c
modules/packetizer/copy.c
+12
-0
modules/packetizer/h264.c
modules/packetizer/h264.c
+9
-0
modules/packetizer/hevc.c
modules/packetizer/hevc.c
+9
-0
modules/packetizer/mpeg4video.c
modules/packetizer/mpeg4video.c
+9
-0
modules/packetizer/mpegvideo.c
modules/packetizer/mpegvideo.c
+9
-0
modules/packetizer/packetizer_helper.h
modules/packetizer/packetizer_helper.h
+8
-0
modules/packetizer/vc1.c
modules/packetizer/vc1.c
+9
-0
No files found.
modules/packetizer/avparser.c
View file @
5aad8ebb
...
...
@@ -58,6 +58,22 @@ struct decoder_sys_t
};
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
block_t
*
PacketizeClosed
(
decoder_t
*
,
block_t
**
);
/*****************************************************************************
* FlushPacketizer: reopen as there's no clean way to flush avparser
*****************************************************************************/
static
void
FlushPacketizer
(
decoder_t
*
p_dec
)
{
ClosePacketizer
(
VLC_OBJECT
(
p_dec
)
);
p_dec
->
p_sys
=
NULL
;
int
res
=
OpenPacketizer
(
VLC_OBJECT
(
p_dec
)
);
if
(
res
!=
VLC_SUCCESS
)
{
msg_Err
(
p_dec
,
"failed to flush with error %d"
,
res
);
p_dec
->
pf_packetize
=
PacketizeClosed
;
}
}
/*****************************************************************************
* OpenPacketizer: probe the packetizer and return score
...
...
@@ -110,6 +126,7 @@ int OpenPacketizer( vlc_object_t *p_this )
return
VLC_ENOMEM
;
}
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
FlushPacketizer
;
p_sys
->
p_parser_ctx
=
p_ctx
;
p_sys
->
p_codec_ctx
=
p_codec_ctx
;
p_sys
->
i_offset
=
0
;
...
...
@@ -124,10 +141,13 @@ int OpenPacketizer( vlc_object_t *p_this )
void
ClosePacketizer
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
if
(
likely
(
p_dec
->
p_sys
!=
NULL
))
{
avcodec_free_context
(
&
p_dec
->
p_sys
->
p_codec_ctx
);
av_parser_close
(
p_dec
->
p_sys
->
p_parser_ctx
);
es_format_Clean
(
&
p_dec
->
fmt_out
);
free
(
p_dec
->
p_sys
);
}
es_format_Clean
(
&
p_dec
->
fmt_out
);
}
/*****************************************************************************
...
...
@@ -182,3 +202,14 @@ out:
return
NULL
;
}
/*****************************************************************************
* PacketizeClosed: packetizer called after a flush failed
*****************************************************************************/
static
block_t
*
PacketizeClosed
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
(
void
)
p_dec
;
if
(
pp_block
!=
NULL
&&
*
pp_block
!=
NULL
)
block_Release
(
*
pp_block
);
return
NULL
;
}
modules/packetizer/copy.c
View file @
5aad8ebb
...
...
@@ -61,6 +61,7 @@ struct decoder_sys_t
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
block_t
*
PacketizeSub
(
decoder_t
*
,
block_t
**
);
static
void
Flush
(
decoder_t
*
);
static
void
ParseWMV3
(
decoder_t
*
,
block_t
*
);
...
...
@@ -87,6 +88,7 @@ static int Open( vlc_object_t *p_this )
p_dec
->
pf_packetize
=
PacketizeSub
;
else
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
Flush
;
/* Create the output format */
es_format_Copy
(
&
p_dec
->
fmt_out
,
&
p_dec
->
fmt_in
);
...
...
@@ -134,6 +136,16 @@ static void Close( vlc_object_t *p_this )
free
(
p_dec
->
p_sys
);
}
static
void
Flush
(
decoder_t
*
p_dec
)
{
block_t
*
p_ret
=
p_dec
->
p_sys
->
p_block
;
if
(
p_ret
)
{
block_Release
(
p_ret
);
p_dec
->
p_sys
->
p_block
=
NULL
;
}
}
/*****************************************************************************
* Packetize: packetize an unit (here copy a complete block )
*****************************************************************************/
...
...
modules/packetizer/h264.c
View file @
5aad8ebb
...
...
@@ -150,6 +150,7 @@ struct decoder_sys_t
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
block_t
*
PacketizeAVC1
(
decoder_t
*
,
block_t
**
);
static
block_t
*
GetCc
(
decoder_t
*
p_dec
,
bool
pb_present
[
4
]
);
static
void
PacketizeFlush
(
decoder_t
*
);
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
);
static
block_t
*
PacketizeParse
(
void
*
p_private
,
bool
*
pb_ts_used
,
block_t
*
);
...
...
@@ -354,6 +355,7 @@ static int Open( vlc_object_t *p_this )
/* CC are the same for H264/AVC in T35 sections (ETSI TS 101 154) */
p_dec
->
pf_get_cc
=
GetCc
;
p_dec
->
pf_flush
=
PacketizeFlush
;
/* */
p_sys
->
i_cc_pts
=
VLC_TS_INVALID
;
...
...
@@ -394,6 +396,13 @@ static void Close( vlc_object_t *p_this )
free
(
p_sys
);
}
static
void
PacketizeFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
packetizer_Flush
(
&
p_sys
->
packetizer
);
}
/****************************************************************************
* Packetize: the whole thing
* Search for the startcodes 3 or more bytes
...
...
modules/packetizer/hevc.c
View file @
5aad8ebb
...
...
@@ -57,6 +57,7 @@ vlc_module_end ()
* Local prototypes
****************************************************************************/
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
void
PacketizeFlush
(
decoder_t
*
);
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
);
static
block_t
*
PacketizeParse
(
void
*
p_private
,
bool
*
pb_ts_used
,
block_t
*
);
static
int
PacketizeValidate
(
void
*
p_private
,
block_t
*
);
...
...
@@ -132,6 +133,7 @@ static int Open(vlc_object_t *p_this)
/* Set callback */
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
PacketizeFlush
;
return
VLC_SUCCESS
;
...
...
@@ -159,6 +161,13 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
return
packetizer_Packetize
(
&
p_sys
->
packetizer
,
pp_block
);
}
static
void
PacketizeFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
packetizer_Flush
(
&
p_sys
->
packetizer
);
}
/****************************************************************************
* Packetizer Helpers
****************************************************************************/
...
...
modules/packetizer/mpeg4video.c
View file @
5aad8ebb
...
...
@@ -91,6 +91,7 @@ struct decoder_sys_t
};
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
void
PacketizeFlush
(
decoder_t
*
);
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
);
static
block_t
*
PacketizeParse
(
void
*
p_private
,
bool
*
pb_ts_used
,
block_t
*
);
...
...
@@ -175,6 +176,7 @@ static int Open( vlc_object_t *p_this )
/* Set callback */
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
PacketizeFlush
;
return
VLC_SUCCESS
;
}
...
...
@@ -203,6 +205,13 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
return
packetizer_Packetize
(
&
p_sys
->
packetizer
,
pp_block
);
}
static
void
PacketizeFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
packetizer_Flush
(
&
p_sys
->
packetizer
);
}
/*****************************************************************************
* Helpers:
*****************************************************************************/
...
...
modules/packetizer/mpegvideo.c
View file @
5aad8ebb
...
...
@@ -135,6 +135,7 @@ struct decoder_sys_t
};
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
void
PacketizeFlush
(
decoder_t
*
);
static
block_t
*
GetCc
(
decoder_t
*
p_dec
,
bool
pb_present
[
4
]
);
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
);
...
...
@@ -209,6 +210,7 @@ static int Open( vlc_object_t *p_this )
cc_Init
(
&
p_sys
->
cc
);
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
PacketizeFlush
;
p_dec
->
pf_get_cc
=
GetCc
;
return
VLC_SUCCESS
;
...
...
@@ -251,6 +253,13 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
return
packetizer_Packetize
(
&
p_sys
->
packetizer
,
pp_block
);
}
static
void
PacketizeFlush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
packetizer_Flush
(
&
p_sys
->
packetizer
);
}
/*****************************************************************************
* GetCc:
*****************************************************************************/
...
...
modules/packetizer/packetizer_helper.h
View file @
5aad8ebb
...
...
@@ -93,6 +93,14 @@ static inline void packetizer_Clean( packetizer_t *p_pack )
block_BytestreamRelease
(
&
p_pack
->
bytestream
);
}
static
inline
void
packetizer_Flush
(
packetizer_t
*
p_pack
)
{
p_pack
->
i_state
=
STATE_NOSYNC
;
block_BytestreamEmpty
(
&
p_pack
->
bytestream
);
p_pack
->
i_offset
=
0
;
p_pack
->
pf_reset
(
p_pack
->
p_private
,
true
);
}
static
inline
block_t
*
packetizer_Packetize
(
packetizer_t
*
p_pack
,
block_t
**
pp_block
)
{
if
(
!
pp_block
||
!*
pp_block
)
...
...
modules/packetizer/vc1.c
View file @
5aad8ebb
...
...
@@ -120,6 +120,7 @@ typedef enum
}
idu_type_t
;
static
block_t
*
Packetize
(
decoder_t
*
p_dec
,
block_t
**
pp_block
);
static
void
Flush
(
decoder_t
*
);
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
);
static
block_t
*
PacketizeParse
(
void
*
p_private
,
bool
*
pb_ts_used
,
block_t
*
);
...
...
@@ -144,6 +145,7 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
p_dec
->
pf_packetize
=
Packetize
;
p_dec
->
pf_flush
=
Flush
;
p_dec
->
pf_get_cc
=
GetCc
;
/* Create the output format */
...
...
@@ -257,6 +259,13 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
return
p_au
;
}
static
void
Flush
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
packetizer_Flush
(
&
p_sys
->
packetizer
);
}
static
void
PacketizeReset
(
void
*
p_private
,
bool
b_broken
)
{
decoder_t
*
p_dec
=
p_private
;
...
...
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