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
470602d5
Commit
470602d5
authored
Apr 03, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rawvideo: avoid casting function pointers
parent
1e697c0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
62 deletions
+53
-62
modules/codec/rawvideo.c
modules/codec/rawvideo.c
+53
-62
No files found.
modules/codec/rawvideo.c
View file @
470602d5
...
...
@@ -37,9 +37,6 @@
*****************************************************************************/
struct
decoder_sys_t
{
/* Module mode */
bool
b_packetizer
;
/*
* Input properties
*/
...
...
@@ -60,12 +57,7 @@ struct decoder_sys_t
****************************************************************************/
static
int
OpenDecoder
(
vlc_object_t
*
);
static
int
OpenPacketizer
(
vlc_object_t
*
);
static
void
CloseDecoder
(
vlc_object_t
*
);
static
void
*
DecodeBlock
(
decoder_t
*
,
block_t
**
);
static
picture_t
*
DecodeFrame
(
decoder_t
*
,
block_t
*
);
static
block_t
*
SendFrame
(
decoder_t
*
,
block_t
*
);
static
void
CloseCommon
(
vlc_object_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -75,21 +67,19 @@ vlc_module_begin ()
set_capability
(
"decoder"
,
50
)
set_category
(
CAT_INPUT
)
set_subcategory
(
SUBCAT_INPUT_VCODEC
)
set_callbacks
(
OpenDecoder
,
Close
Decoder
)
set_callbacks
(
OpenDecoder
,
Close
Common
)
add_submodule
()
set_description
(
N_
(
"Pseudo raw video packetizer"
)
)
set_capability
(
"packetizer"
,
100
)
set_callbacks
(
OpenPacketizer
,
Close
Decoder
)
set_callbacks
(
OpenPacketizer
,
Close
Common
)
vlc_module_end
()
/**
***************************************************************************
*
OpenDecoder: probe the decoder and return score
*
****************************************************************************
/
static
int
Open
Decoder
(
vlc_object_t
*
p_this
)
/**
*
Common initialization for decoder and packetizer
*/
static
int
Open
Common
(
decoder_t
*
p_dec
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
const
vlc_chroma_description_t
*
dsc
=
vlc_fourcc_GetChromaDescription
(
p_dec
->
fmt_in
.
i_codec
);
if
(
dsc
==
NULL
||
dsc
->
plane_count
==
0
)
...
...
@@ -144,27 +134,10 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys
->
size
+=
pitch
*
lines
;
}
/* Set callbacks */
p_dec
->
pf_decode_video
=
(
picture_t
*
(
*
)(
decoder_t
*
,
block_t
**
))
DecodeBlock
;
p_dec
->
pf_packetize
=
(
block_t
*
(
*
)(
decoder_t
*
,
block_t
**
))
DecodeBlock
;
p_dec
->
p_sys
=
p_sys
;
return
VLC_SUCCESS
;
}
static
int
OpenPacketizer
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
int
i_ret
=
OpenDecoder
(
p_this
);
if
(
i_ret
==
VLC_SUCCESS
)
p_dec
->
p_sys
->
b_packetizer
=
true
;
return
i_ret
;
}
/****************************************************************************
* DecodeBlock: the whole thing
****************************************************************************
...
...
@@ -173,13 +146,11 @@ static int OpenPacketizer( vlc_object_t *p_this )
static
void
*
DecodeBlock
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
block_t
*
p_block
;
void
*
p_buf
;
if
(
!
pp_block
||
!*
pp_block
)
return
NULL
;
p_block
=
*
pp_block
;
if
(
pp_block
==
NULL
||
*
pp_block
==
NULL
)
return
NULL
;
block_t
*
p_block
=
*
pp_block
;
if
(
p_block
->
i_pts
<=
VLC_TS_INVALID
&&
p_block
->
i_dts
<=
VLC_TS_INVALID
&&
!
date_Get
(
&
p_sys
->
pts
)
)
...
...
@@ -212,20 +183,8 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
}
if
(
p_sys
->
b_packetizer
)
{
p_buf
=
SendFrame
(
p_dec
,
p_block
);
}
else
{
p_buf
=
DecodeFrame
(
p_dec
,
p_block
);
}
/* Date management: 1 frame per packet */
date_Increment
(
&
p_sys
->
pts
,
1
);
*
pp_block
=
NULL
;
return
p_buf
;
return
p_block
;
}
/*****************************************************************************
...
...
@@ -272,14 +231,17 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
/*****************************************************************************
* DecodeFrame: decodes a video frame.
*****************************************************************************/
static
picture_t
*
DecodeFrame
(
decoder_t
*
p_dec
,
block_t
*
p_block
)
static
picture_t
*
DecodeFrame
(
decoder_t
*
p_dec
,
block_t
*
*
p
p_block
)
{
block_t
*
p_block
=
DecodeBlock
(
p_dec
,
pp_block
);
if
(
p_block
==
NULL
)
return
NULL
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
picture_t
*
p_pic
;
/* Get a new picture */
p_pic
=
decoder_NewPicture
(
p_dec
);
if
(
!
p_pic
)
p
icture_t
*
p
_pic
=
decoder_NewPicture
(
p_dec
);
if
(
p_pic
==
NULL
)
{
block_Release
(
p_block
);
return
NULL
;
...
...
@@ -287,7 +249,10 @@ static picture_t *DecodeFrame( decoder_t *p_dec, block_t *p_block )
FillPicture
(
p_dec
,
p_block
,
p_pic
);
p_pic
->
date
=
date_Get
(
&
p_sys
->
pts
);
/* Date management: 1 frame per packet */
p_pic
->
date
=
date_Get
(
&
p_dec
->
p_sys
->
pts
);
date_Increment
(
&
p_sys
->
pts
,
1
);
if
(
p_block
->
i_flags
&
BLOCK_FLAG_INTERLACED_MASK
)
{
p_pic
->
b_progressive
=
false
;
...
...
@@ -304,14 +269,30 @@ static picture_t *DecodeFrame( decoder_t *p_dec, block_t *p_block )
return
p_pic
;
}
static
int
OpenDecoder
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
int
ret
=
OpenCommon
(
p_dec
);
if
(
ret
==
VLC_SUCCESS
)
p_dec
->
pf_decode_video
=
DecodeFrame
;
return
ret
;
}
/*****************************************************************************
* SendFrame: send a video frame to the stream output.
*****************************************************************************/
static
block_t
*
SendFrame
(
decoder_t
*
p_dec
,
block_t
*
p_block
)
static
block_t
*
SendFrame
(
decoder_t
*
p_dec
,
block_t
*
*
p
p_block
)
{
block_t
*
p_block
=
DecodeBlock
(
p_dec
,
pp_block
);
if
(
p_block
==
NULL
)
return
NULL
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
/* Date management: 1 frame per packet */
p_block
->
i_dts
=
p_block
->
i_pts
=
date_Get
(
&
p_sys
->
pts
);
date_Increment
(
&
p_sys
->
pts
,
1
);
if
(
p_sys
->
b_invert
)
{
...
...
@@ -344,10 +325,20 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block )
return
p_block
;
}
/*****************************************************************************
* CloseDecoder: decoder destruction
*****************************************************************************/
static
void
CloseDecoder
(
vlc_object_t
*
p_this
)
static
int
OpenPacketizer
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
int
ret
=
OpenCommon
(
p_dec
);
if
(
ret
==
VLC_SUCCESS
)
p_dec
->
pf_packetize
=
SendFrame
;
return
ret
;
}
/**
* Common deinitialization
*/
static
void
CloseCommon
(
vlc_object_t
*
p_this
)
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
free
(
p_dec
->
p_sys
);
...
...
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