Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
2e2178f7
Commit
2e2178f7
authored
May 26, 2008
by
dionoea
Browse files
Chroma API change. Chromas are now normal video filters (almost).
parent
efc57198
Changes
21
Hide whitespace changes
Inline
Side-by-side
include/vlc_common.h
View file @
2e2178f7
...
...
@@ -221,7 +221,6 @@ typedef struct aout_filter_t aout_filter_t;
/* Video */
typedef
struct
vout_thread_t
vout_thread_t
;
typedef
struct
vout_sys_t
vout_sys_t
;
typedef
struct
chroma_sys_t
chroma_sys_t
;
typedef
video_format_t
video_frame_format_t
;
typedef
struct
picture_t
picture_t
;
...
...
include/vlc_es.h
View file @
2e2178f7
...
...
@@ -28,6 +28,10 @@
#ifndef _VLC_ES_H
#define _VLC_ES_H 1
/* FIXME: i'm not too sure about this include but it fixes compilation of
* video chromas -- dionoea */
#include
"vlc_common.h"
/**
* \file
* This file defines the elementary streams format types
...
...
@@ -130,6 +134,9 @@ struct video_format_t
unsigned
int
i_frame_rate_base
;
/**< frame rate denominator */
int
i_rmask
,
i_gmask
,
i_bmask
;
/**< color masks for RGB chroma */
int
i_rrshift
,
i_lrshift
;
int
i_rgshift
,
i_lgshift
;
int
i_rbshift
,
i_lbshift
;
video_palette_t
*
p_palette
;
/**< video palette from demuxer */
};
...
...
include/vlc_filter.h
View file @
2e2178f7
...
...
@@ -60,6 +60,7 @@ struct filter_t
config_chain_t
*
p_cfg
;
picture_t
*
(
*
pf_video_filter
)
(
filter_t
*
,
picture_t
*
);
void
(
*
pf_video_filter_io
)
(
filter_t
*
,
picture_t
*
,
picture_t
*
);
/* Used by video filters with a preallocated output buffer (ie chroma conversion modules) */
block_t
*
(
*
pf_audio_filter
)
(
filter_t
*
,
block_t
*
);
void
(
*
pf_video_blend
)
(
filter_t
*
,
picture_t
*
,
picture_t
*
,
picture_t
*
,
...
...
include/vlc_objects.h
View file @
2e2178f7
...
...
@@ -68,6 +68,7 @@
#define VLC_OBJECT_HTTPD_HOST (-30)
#define VLC_OBJECT_INTERACTION (-32)
#define VLC_OBJECT_CHROMA (-33)
#define VLC_OBJECT_GENERIC (-666)
...
...
include/vlc_vout.h
View file @
2e2178f7
/*****************************************************************************
* vlc_video.h: common video definitions
*****************************************************************************
* Copyright (C) 1999 - 200
5
the VideoLAN team
* Copyright (C) 1999 - 200
8
the VideoLAN team
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
...
...
@@ -365,31 +365,6 @@ VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic
* @{
*/
/**
* Chroma conversion function
*
* This is the prototype common to all conversion functions.
* \param p_vout video output thread
* \param p_source source picture
* \param p_dest destination picture
* Picture width and source dimensions must be multiples of 16.
*/
typedef
void
(
vout_chroma_convert_t
)(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
typedef
struct
vout_chroma_t
{
/** conversion functions */
vout_chroma_convert_t
*
pf_convert
;
/** Private module-dependent data */
chroma_sys_t
*
p_sys
;
/* private data */
/** Plugin used and shortcuts to access its capabilities */
module_t
*
p_module
;
}
vout_chroma_t
;
/** Maximum numbers of video filters2 that can be attached to a vout */
#define MAX_VFILTERS 10
...
...
@@ -462,7 +437,7 @@ struct vout_thread_t
picture_heap_t
render
;
/**< rendered pictures */
picture_heap_t
output
;
/**< direct buffers */
bool
b_direct
;
/**< rendered are like direct ? */
vout_chroma
_t
chroma
;
/**< translation tables */
filter
_t
*
p_
chroma
;
/**< translation tables */
video_format_t
fmt_render
;
/* render format (from the decoder) */
video_format_t
fmt_in
;
/* input (modified render) format */
...
...
modules/codec/ffmpeg/chroma.c
View file @
2e2178f7
...
...
@@ -57,7 +57,7 @@ static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * );
* This structure is part of the chroma transformation descriptor, it
* describes the chroma plugin specific properties.
*****************************************************************************/
struct
chroma
_sys_t
struct
filter
_sys_t
{
int
i_src_vlc_chroma
;
int
i_src_ffmpeg_chroma
;
...
...
@@ -74,50 +74,53 @@ struct chroma_sys_t
*****************************************************************************/
int
OpenChroma
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread
_t
*
)
p_this
;
filter_t
*
p_filter
=
(
filter
_t
*
)
p_this
;
int
i_ffmpeg_chroma
[
2
],
i_vlc_chroma
[
2
],
i
;
/*
* Check the source chroma first, then the destination chroma
*/
i_vlc_chroma
[
0
]
=
p_
vout
->
ren
de
r
.
i_chroma
;
i_vlc_chroma
[
1
]
=
p_
vout
->
output
.
i_chroma
;
i_vlc_chroma
[
0
]
=
p_
filter
->
fmt_in
.
vi
de
o
.
i_chroma
;
i_vlc_chroma
[
1
]
=
p_
filter
->
fmt_out
.
video
.
i_chroma
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
i_ffmpeg_chroma
[
i
]
=
GetFfmpegChroma
(
i_vlc_chroma
[
i
]
);
if
(
i_ffmpeg_chroma
[
i
]
<
0
)
return
VLC_EGENERIC
;
}
p_
vout
->
chroma
.
pf_convert
=
ChromaConversion
;
p_
filter
->
pf_video_filter_io
=
ChromaConversion
;
p_
vout
->
chroma
.
p_sys
=
malloc
(
sizeof
(
chroma
_sys_t
)
);
if
(
p_
vout
->
chroma
.
p_sys
==
NULL
)
p_
filter
->
p_sys
=
malloc
(
sizeof
(
filter
_sys_t
)
);
if
(
p_
filter
->
p_sys
==
NULL
)
{
return
VLC_ENOMEM
;
}
p_
vout
->
chroma
.
p_sys
->
i_src_vlc_chroma
=
p_vout
->
render
.
i_chroma
;
p_
vout
->
chroma
.
p_sys
->
i_dst_vlc_chroma
=
p_vout
->
output
.
i_chroma
;
p_
vout
->
chroma
.
p_sys
->
i_src_ffmpeg_chroma
=
i_ffmpeg_chroma
[
0
];
p_
vout
->
chroma
.
p_sys
->
i_dst_ffmpeg_chroma
=
i_ffmpeg_chroma
[
1
];
p_
filter
->
.
p_sys
->
i_src_vlc_chroma
=
p_vout
->
render
.
i_chroma
;
p_
filter
->
p_sys
->
i_dst_vlc_chroma
=
p_vout
->
output
.
i_chroma
;
p_
filter
->
p_sys
->
i_src_ffmpeg_chroma
=
i_ffmpeg_chroma
[
0
];
p_
filter
->
p_sys
->
i_dst_ffmpeg_chroma
=
i_ffmpeg_chroma
[
1
];
if
(
(
p_
vout
->
ren
de
r
.
i_height
!=
p_
vout
->
output
.
i_height
||
p_
vout
->
ren
de
r
.
i_width
!=
p_
vout
->
output
.
i_width
)
&&
(
p_
vout
->
chroma
.
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
)
||
p_
vout
->
chroma
.
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
))
if
(
(
p_
filter
->
fmt_in
.
vi
de
o
.
i_height
!=
p_
filter
->
fmt_out
.
video
.
i_height
||
p_
filter
->
fmt_in
.
vi
de
o
.
i_width
!=
p_
filter
->
fmt_out
.
video
.
i_width
)
&&
(
p_
filter
->
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
)
||
p_
filter
->
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
))
{
msg_Dbg
(
p_vout
,
"preparing to resample picture"
);
p_vout
->
chroma
.
p_sys
->
p_rsc
=
img_resample_init
(
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_height
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
);
avpicture_alloc
(
&
p_vout
->
chroma
.
p_sys
->
tmp_pic
,
p_vout
->
chroma
.
p_sys
->
i_dst_ffmpeg_chroma
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
);
msg_Dbg
(
p_filter
,
"preparing to resample picture"
);
p_filter
->
p_sys
->
p_rsc
=
img_resample_init
(
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
avpicture_alloc
(
&
p_filter
->
p_sys
->
tmp_pic
,
p_filter
->
p_sys
->
i_dst_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
}
else
{
msg_Dbg
(
p_
vout
,
"no resampling"
);
p_
vout
->
chroma
.
p_sys
->
p_rsc
=
NULL
;
msg_Dbg
(
p_
filter
,
"no resampling"
);
p_
filter
->
p_sys
->
p_rsc
=
NULL
;
}
/* libavcodec needs to be initialized for some chroma conversions */
...
...
@@ -129,7 +132,7 @@ int OpenChroma( vlc_object_t *p_this )
/*****************************************************************************
* ChromaConversion: actual chroma conversion function
*****************************************************************************/
static
void
ChromaConversion
(
vout_thread_t
*
p_vout
,
static
void
ChromaConversion
(
filter_t
*
p_filter
,
picture_t
*
p_src
,
picture_t
*
p_dest
)
{
AVPicture
src_pic
;
...
...
@@ -149,38 +152,40 @@ static void ChromaConversion( vout_thread_t *p_vout,
}
/* Special cases */
if
(
p_
vout
->
chroma
.
p_sys
->
i_src_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
||
p_
vout
->
chroma
.
p_sys
->
i_src_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'U'
,
'9'
)
)
if
(
p_
filter
->
p_sys
->
i_src_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
||
p_
filter
->
p_sys
->
i_src_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'U'
,
'9'
)
)
{
/* Invert U and V */
src_pic
.
data
[
1
]
=
p_src
->
p
[
2
].
p_pixels
;
src_pic
.
data
[
2
]
=
p_src
->
p
[
1
].
p_pixels
;
}
if
(
p_
vout
->
chroma
.
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
||
p_
vout
->
chroma
.
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'U'
,
'9'
)
)
if
(
p_
filter
->
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'1'
,
'2'
)
||
p_
filter
->
p_sys
->
i_dst_vlc_chroma
==
VLC_FOURCC
(
'Y'
,
'V'
,
'U'
,
'9'
)
)
{
/* Invert U and V */
dest_pic
.
data
[
1
]
=
p_dest
->
p
[
2
].
p_pixels
;
dest_pic
.
data
[
2
]
=
p_dest
->
p
[
1
].
p_pixels
;
}
if
(
p_
vout
->
chroma
.
p_sys
->
i_src_ffmpeg_chroma
==
PIX_FMT_RGB24
)
if
(
p_
vout
->
ren
de
r
.
i_bmask
==
0x00ff0000
)
p_
vout
->
chroma
.
p_sys
->
i_src_ffmpeg_chroma
=
PIX_FMT_BGR24
;
if
(
p_
filter
->
p_sys
->
i_src_ffmpeg_chroma
==
PIX_FMT_RGB24
)
if
(
p_
filter
->
fmt_in
.
vi
de
o
.
i_bmask
==
0x00ff0000
)
p_
filter
->
p_sys
->
i_src_ffmpeg_chroma
=
PIX_FMT_BGR24
;
if
(
p_
vout
->
chroma
.
p_sys
->
p_rsc
)
if
(
p_
filter
->
p_sys
->
p_rsc
)
{
img_convert
(
&
p_vout
->
chroma
.
p_sys
->
tmp_pic
,
p_vout
->
chroma
.
p_sys
->
i_dst_ffmpeg_chroma
,
&
src_pic
,
p_vout
->
chroma
.
p_sys
->
i_src_ffmpeg_chroma
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
);
img_resample
(
p_vout
->
chroma
.
p_sys
->
p_rsc
,
&
dest_pic
,
&
p_vout
->
chroma
.
p_sys
->
tmp_pic
);
img_convert
(
&
p_filter
->
p_sys
->
tmp_pic
,
p_filter
->
p_sys
->
i_dst_ffmpeg_chroma
,
&
src_pic
,
p_filter
->
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
img_resample
(
p_filter
->
p_sys
->
p_rsc
,
&
dest_pic
,
&
p_filter
->
p_sys
->
tmp_pic
);
}
else
{
img_convert
(
&
dest_pic
,
p_vout
->
chroma
.
p_sys
->
i_dst_ffmpeg_chroma
,
&
src_pic
,
p_vout
->
chroma
.
p_sys
->
i_src_ffmpeg_chroma
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
);
img_convert
(
&
dest_pic
,
p_filter
->
p_sys
->
i_dst_ffmpeg_chroma
,
&
src_pic
,
p_filter
->
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
}
}
...
...
@@ -191,176 +196,12 @@ static void ChromaConversion( vout_thread_t *p_vout,
*****************************************************************************/
void
CloseChroma
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread
_t
*
)
p_this
;
if
(
p_
vout
->
chroma
.
p_sys
->
p_rsc
)
filter_t
*
p_filter
=
(
filter
_t
*
)
p_this
;
if
(
p_
filter
->
p_sys
->
p_rsc
)
{
img_resample_close
(
p_
vout
->
chroma
.
p_sys
->
p_rsc
);
avpicture_free
(
&
p_
vout
->
chroma
.
p_sys
->
tmp_pic
);
img_resample_close
(
p_
filter
->
p_sys
->
p_rsc
);
avpicture_free
(
&
p_
filter
->
p_sys
->
tmp_pic
);
}
free
(
p_
vout
->
chroma
.
p_sys
);
free
(
p_
filter
->
p_sys
);
}
#else
static
void
ChromaConversion
(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
/*****************************************************************************
* chroma_sys_t: chroma method descriptor
*****************************************************************************
* This structure is part of the chroma transformation descriptor, it
* describes the chroma plugin specific properties.
*****************************************************************************/
struct
chroma_sys_t
{
filter_t
*
p_swscaler
;
};
/*****************************************************************************
* Video Filter2 functions
*****************************************************************************/
struct
filter_owner_sys_t
{
vout_thread_t
*
p_vout
;
};
static
void
PictureRelease
(
picture_t
*
p_pic
)
{
free
(
p_pic
->
p_data_orig
);
}
static
picture_t
*
video_new_buffer_filter
(
filter_t
*
p_filter
)
{
picture_t
*
p_picture
=
malloc
(
sizeof
(
picture_t
)
);
if
(
!
p_picture
)
return
NULL
;
if
(
vout_AllocatePicture
(
p_filter
,
p_picture
,
p_filter
->
fmt_out
.
video
.
i_chroma
,
p_filter
->
fmt_out
.
video
.
i_width
,
p_filter
->
fmt_out
.
video
.
i_height
,
p_filter
->
fmt_out
.
video
.
i_aspect
)
!=
VLC_SUCCESS
)
{
free
(
p_picture
);
return
NULL
;
}
p_picture
->
pf_release
=
PictureRelease
;
return
p_picture
;
}
static
void
video_del_buffer_filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
VLC_UNUSED
(
p_filter
);
if
(
p_pic
)
{
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
);
}
}
/*****************************************************************************
* OpenChroma: allocate a chroma function
*****************************************************************************
* This function allocates and initializes a chroma function
*****************************************************************************/
int
OpenChroma
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
chroma_sys_t
*
p_sys
=
p_vout
->
chroma
.
p_sys
;
p_vout
->
chroma
.
p_sys
=
p_sys
=
malloc
(
sizeof
(
chroma_sys_t
)
);
if
(
p_vout
->
chroma
.
p_sys
==
NULL
)
{
return
VLC_ENOMEM
;
}
p_vout
->
chroma
.
pf_convert
=
ChromaConversion
;
p_sys
->
p_swscaler
=
vlc_object_create
(
p_vout
,
VLC_OBJECT_FILTER
);
vlc_object_attach
(
p_sys
->
p_swscaler
,
p_vout
);
p_sys
->
p_swscaler
->
pf_vout_buffer_new
=
video_new_buffer_filter
;
p_sys
->
p_swscaler
->
pf_vout_buffer_del
=
video_del_buffer_filter
;
p_sys
->
p_swscaler
->
fmt_out
.
video
.
i_x_offset
=
p_sys
->
p_swscaler
->
fmt_out
.
video
.
i_y_offset
=
0
;
p_sys
->
p_swscaler
->
fmt_in
.
video
=
p_vout
->
fmt_in
;
p_sys
->
p_swscaler
->
fmt_out
.
video
=
p_vout
->
fmt_out
;
p_sys
->
p_swscaler
->
fmt_out
.
video
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_sys
->
p_swscaler
->
fmt_in
.
video
.
i_chroma
=
p_vout
->
render
.
i_chroma
;
p_sys
->
p_swscaler
->
fmt_out
.
video
.
i_chroma
=
p_vout
->
output
.
i_chroma
;
p_sys
->
p_swscaler
->
p_module
=
module_Need
(
p_sys
->
p_swscaler
,
"video filter2"
,
0
,
0
);
if
(
p_sys
->
p_swscaler
->
p_module
)
{
p_sys
->
p_swscaler
->
p_owner
=
malloc
(
sizeof
(
filter_owner_sys_t
)
);
if
(
p_sys
->
p_swscaler
->
p_owner
)
p_sys
->
p_swscaler
->
p_owner
->
p_vout
=
p_vout
;
}
if
(
!
p_sys
->
p_swscaler
->
p_module
||
!
p_sys
->
p_swscaler
->
p_owner
)
{
vlc_object_detach
(
p_sys
->
p_swscaler
);
vlc_object_release
(
p_sys
->
p_swscaler
);
free
(
p_vout
->
chroma
.
p_sys
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
/*****************************************************************************
* ChromaConversion: actual chroma conversion function
*****************************************************************************/
static
void
ChromaConversion
(
vout_thread_t
*
p_vout
,
picture_t
*
p_src
,
picture_t
*
p_dest
)
{
chroma_sys_t
*
p_sys
=
(
chroma_sys_t
*
)
p_vout
->
chroma
.
p_sys
;
if
(
p_sys
&&
p_src
&&
p_dest
&&
p_sys
->
p_swscaler
&&
p_sys
->
p_swscaler
->
p_module
)
{
picture_t
*
p_pic
;
p_sys
->
p_swscaler
->
fmt_in
.
video
=
p_vout
->
fmt_in
;
p_sys
->
p_swscaler
->
fmt_out
.
video
=
p_vout
->
fmt_out
;
#if 0
msg_Dbg( p_vout, "chroma %4.4s (%d) to %4.4s (%d)",
(char *)&p_vout->fmt_in.i_chroma, p_src->i_planes,
(char *)&p_vout->fmt_out.i_chroma, p_dest->i_planes );
#endif
p_pic
=
p_sys
->
p_swscaler
->
pf_vout_buffer_new
(
p_sys
->
p_swscaler
);
if
(
p_pic
)
{
picture_t
*
p_dst_pic
;
vout_CopyPicture
(
p_vout
,
p_pic
,
p_src
);
p_dst_pic
=
p_sys
->
p_swscaler
->
pf_video_filter
(
p_sys
->
p_swscaler
,
p_pic
);
vout_CopyPicture
(
p_vout
,
p_dest
,
p_dst_pic
);
p_dst_pic
->
pf_release
(
p_dst_pic
);
}
}
}
/*****************************************************************************
* CloseChroma: free the chroma function
*****************************************************************************
* This function frees the previously allocated chroma function
*****************************************************************************/
void
CloseChroma
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
chroma_sys_t
*
p_sys
=
(
chroma_sys_t
*
)
p_vout
->
chroma
.
p_sys
;
if
(
p_sys
->
p_swscaler
&&
p_sys
->
p_swscaler
->
p_module
)
{
free
(
p_sys
->
p_swscaler
->
p_owner
);
module_Unneed
(
p_sys
->
p_swscaler
,
p_sys
->
p_swscaler
->
p_module
);
vlc_object_detach
(
p_sys
->
p_swscaler
);
vlc_object_release
(
p_sys
->
p_swscaler
);
p_sys
->
p_swscaler
=
NULL
;
}
free
(
p_vout
->
chroma
.
p_sys
);
}
#endif
/* !defined(HAVE_LIBSWSCALE_SWSCALE_H) && !defined(HAVE_FFMPEG_SWSCALE_H) */
modules/codec/ffmpeg/ffmpeg.c
View file @
2e2178f7
...
...
@@ -252,13 +252,13 @@ vlc_module_begin();
set_capability
(
"crop padd"
,
10
);
set_callbacks
(
OpenCropPadd
,
CloseFilter
);
set_description
(
N_
(
"FFmpeg crop padd filter"
)
);
#endif
/* chroma conversion submodule */
add_submodule
();
set_capability
(
"chroma"
,
50
);
set_callbacks
(
OpenChroma
,
CloseChroma
);
set_description
(
N_
(
"FFmpeg chroma conversion"
)
);
#endif
/* video filter submodule */
add_submodule
();
...
...
modules/video_chroma/chain.c
View file @
2e2178f7
/*****************************************************************************
* chain.c : chain multiple chroma modules as a last resort solution
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* Copyright (C) 2007
-2008
the VideoLAN team
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
...
...
@@ -31,6 +31,7 @@
#include
<vlc_common.h>
#include
<vlc_plugin.h>
#include
<vlc_filter.h>
#include
<vlc_vout.h>
/*****************************************************************************
...
...
@@ -38,7 +39,7 @@
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
);
static
void
Destroy
(
vlc_object_t
*
);
static
void
Chain
(
vout_thread
_t
*
,
picture_t
*
,
picture_t
*
);
static
void
Chain
(
filter
_t
*
,
picture_t
*
,
picture_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -51,19 +52,21 @@ vlc_module_end();
#define MAX_CHROMAS 2
struct
chroma
_sys_t
struct
filter
_sys_t
{
vlc_fourcc_t
i_chroma
;
vout_chroma_t
chroma1
;
vout_chroma_t
chroma2
;
filter_t
*
p_
chroma1
;
filter_t
*
p_
chroma2
;
picture_t
*
p_tmp
;
picture_t
*
p_tmp
;
};
static
const
vlc_fourcc_t
pi_allowed_chromas
[]
=
{
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
),
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'2'
),
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
),
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
),
0
};
...
...
@@ -74,8 +77,9 @@ static const vlc_fourcc_t pi_allowed_chromas[] = {
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
p_this
)
{
#if 0
static int hack = 1;
vout_thread_t
*
p_vout
=
(
vout_thread
_t
*
)
p_this
;
filter_t *p_filter = (filter
_t *)p_this;
hack++;
if( hack > MAX_CHROMAS )
...
...
@@ -86,25 +90,25 @@ static int Activate( vlc_object_t *p_this )
return VLC_EGENERIC;
}
chroma
_sys_t
*
p_sys
=
(
chroma
_sys_t
*
)
malloc
(
sizeof
(
chroma
_sys_t
)
);
filter
_sys_t *p_sys = (
filter
_sys_t *)malloc( sizeof(
filter
_sys_t ) );
if( !p_sys )
{
hack--;
return VLC_ENOMEM;
}
memset
(
p_sys
,
0
,
sizeof
(
chroma
_sys_t
)
);
memset( p_sys, 0, sizeof(
filter
_sys_t ) );
int i;
vlc_fourcc_t
i_output_chroma
=
p_
vout
->
output
.
i_chroma
;
vlc_fourcc_t
i_render_chroma
=
p_
vout
->
ren
de
r
.
i_chroma
;
vlc_fourcc_t i_output_chroma = p_
filter->fmt_in.video
.i_chroma;
vlc_fourcc_t i_render_chroma = p_
filter->fmt_out.vi
de
o
.i_chroma;
for( i = 0; pi_allowed_chromas[i]; i++ )
{
msg_Warn
(
p_
vout
,
"Trying %4s as a chroma chain"
,
msg_Warn( p_
filter
, "Trying %4s as a chroma chain",
(const char *)&pi_allowed_chromas[i] );
p_
vout
->
output
.
i_chroma
=
pi_allowed_chromas
[
i
];
p_
vout
->
chroma
.
p_module
=
module_Need
(
p_vout
,
"chroma"
,
NULL
,
0
);
p_
vout
->
output
.
i_chroma
=
i_output_chroma
;
p_
filter
->output.i_chroma = pi_allowed_chromas[i];
p_
filter->p_
chroma
1
.p_module = module_Need( p_vout, "chroma", NULL, 0 );
p_
filter
->output.i_chroma = i_output_chroma;
if( !p_vout->chroma.p_module )
continue;
...
...
@@ -136,15 +140,16 @@ static int Activate( vlc_object_t *p_this )
free( p_sys );
hack--;
#endif
return
VLC_EGENERIC
;
}
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
#if 0
filter_t *p_filter = (filter_t *)p_this;
vout_chroma_t chroma = p_vout->chroma;
p_vout->chroma = chroma.p_sys->chroma1;
module_Unneed( p_vout, p_vout->chroma.p_module );
p_vout->chroma = chroma.p_sys->chroma2;
...
...
@@ -158,14 +163,16 @@ static void Destroy( vlc_object_t *p_this )
}
free( chroma.p_sys );
chroma.p_sys = NULL;
#endif
}
/*****************************************************************************
* Chain
*****************************************************************************/
static
void
Chain
(
vout_thread_t
*
p_vout
,
picture_t
*
p_source
,
static
void
Chain
(
filter_t
*
p_filter
,
picture_t
*
p_source
,
picture_t
*
p_dest
)
{
#if 0
chroma_sys_t *p_sys = p_vout->chroma.p_sys;
if( !p_sys->p_tmp )
...
...
@@ -190,4 +197,5 @@ static void Chain( vout_thread_t *p_vout, picture_t *p_source,
p_vout->chroma = p_sys->chroma2;
p_sys->chroma2.pf_convert( p_vout, p_sys->p_tmp, p_dest );
p_vout->chroma = chroma;
#endif
}
modules/video_chroma/grey_yuv.c
View file @
2e2178f7
/*****************************************************************************
* grey_yuv.c : grayscale to others conversion module for vlc
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* Copyright (C) 2007
, 2008
the VideoLAN team
* $Id$
*
* Authors: Sam Hocevar <sam@zoy.org>
...
...
@@ -31,6 +31,7 @@
#include
<vlc_common.h>
#include
<vlc_plugin.h>
#include
<vlc_filter.h>
#include
<vlc_vout.h>
#define SRC_FOURCC "GREY"
...
...
@@ -41,8 +42,8 @@
*****************************************************************************/
static
int
Activate
(
vlc_object_t
*
);
static
void
GREY_I420
(
vout_thread
_t
*
,
picture_t
*
,
picture_t
*
);