Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
5e99f4d4
Commit
5e99f4d4
authored
Apr 17, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ffmpeg: remove some #ifdef (you need at least libavcodec build >= 4655)
and use ffmpeg postprocessing instead of vlc builtins. (It's a lot faster).
parent
4f947313
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
259 additions
and
219 deletions
+259
-219
modules/codec/ffmpeg/audio.c
modules/codec/ffmpeg/audio.c
+1
-3
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+62
-35
modules/codec/ffmpeg/ffmpeg.h
modules/codec/ffmpeg/ffmpeg.h
+9
-3
modules/codec/ffmpeg/video.c
modules/codec/ffmpeg/video.c
+177
-167
modules/codec/ffmpeg/video.h
modules/codec/ffmpeg/video.h
+10
-11
No files found.
modules/codec/ffmpeg/audio.c
View file @
5e99f4d4
...
...
@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.1
4
2003/0
2/07 01:22:55
fenrir Exp $
* $Id: audio.c,v 1.1
5
2003/0
4/17 10:58:30
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -105,9 +105,7 @@ int E_( InitThread_Audio )( adec_thread_t *p_adec )
/* ***** Fill p_context with init values ***** */
p_adec
->
p_context
->
sample_rate
=
p_wf
->
nSamplesPerSec
;
p_adec
->
p_context
->
channels
=
p_wf
->
nChannels
;
#if LIBAVCODEC_BUILD >= 4618
p_adec
->
p_context
->
block_align
=
p_wf
->
nBlockAlign
;
#endif
p_adec
->
p_context
->
bit_rate
=
p_wf
->
nAvgBytesPerSec
*
8
;
if
(
(
p_adec
->
p_context
->
extradata_size
=
p_wf
->
cbSize
)
>
0
)
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
5e99f4d4
...
...
@@ -2,7 +2,7 @@
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ffmpeg.c,v 1.
29
2003/04/1
6 00:12
:3
6
fenrir Exp $
* $Id: ffmpeg.c,v 1.
30
2003/04/1
7 10:58
:3
0
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -38,11 +38,21 @@
# include <sys/times.h>
#endif
#include "avcodec.h"
/* ffmpeg */
#include "avcodec.h"
/* ffmpeg */
#if LIBAVCODEC_BUILD < 4655
# error You must have a libavcodec >= 4655 (get CVS)
#endif
#include "postprocessing/postprocessing.h"
#include "ffmpeg.h"
#ifdef LIBAVCODEC_PP
# include "libpostproc/postprocess.h"
#else
# include "postprocessing/postprocessing.h"
#endif
#include "video.h" // video ffmpeg specific
#include "audio.h" // audio ffmpeg specific
...
...
@@ -77,8 +87,7 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t, int *, int *, char ** );
#define POSTPROCESSING_Q_LONGTEXT \
"Quality of post processing\n"\
"Valid range is 0 to 6\n" \
"(Overridden by others setting)"
"Valid range is 0 to 6"
#define POSTPROCESSING_AQ_LONGTEXT \
"Post processing quality is selected upon time left " \
...
...
@@ -95,26 +104,63 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t, int *, int *, char ** );
"32 ac vlc" \
"64 Qpel chroma"
/* FIXME (cut/past from ffmpeg */
#define LIBAVCODEC_PP_LONGHELP \
"<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
"long form example:\n" \
"vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock\n" \
"short form example:\n" \
"vb:a/hb:a/lb de,-vb\n" \
"more examples:\n" \
"tn:64:128:256\n" \
"Filters Options\n" \
"short long name short long option Description\n" \
"* * a autoq cpu power dependant enabler\n" \
" c chrom chrominance filtring enabled\n" \
" y nochrom chrominance filtring disabled\n" \
"hb hdeblock (2 Threshold) horizontal deblocking filter\n" \
" 1. difference factor: default=64, higher -> more deblocking\n" \
" 2. flatness threshold: default=40, lower -> more deblocking\n" \
" the h & v deblocking filters share these\n" \
" so u cant set different thresholds for h / v\n" \
"vb vdeblock (2 Threshold) vertical deblocking filter\n" \
"h1 x1hdeblock Experimental h deblock filter 1\n" \
"v1 x1vdeblock Experimental v deblock filter 1\n" \
"dr dering Deringing filter\n" \
"al autolevels automatic brightness / contrast\n" \
" f fullyrange stretch luminance to (0..255)\n" \
"lb linblenddeint linear blend deinterlacer\n" \
"li linipoldeint linear interpolating deinterlace\n" \
"ci cubicipoldeint cubic interpolating deinterlacer\n" \
"md mediandeint median deinterlacer\n" \
"fd ffmpegdeint ffmpeg deinterlacer\n" \
"de default hb:a,vb:a,dr:a,al\n" \
"fa fast h1:a,v1:a,dr:a,al\n" \
"tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n" \
" 1. <= 2. <= 3. larger -> stronger filtering\n" \
"fq forceQuant <quantizer> Force quantizer\n"
vlc_module_begin
();
add_category_hint
(
N_
(
"ffmpeg"
),
NULL
,
VLC_FALSE
);
#if LIBAVCODEC_BUILD >= 4615
add_bool
(
"ffmpeg-dr"
,
0
,
NULL
,
"direct rendering"
,
"direct rendering"
,
VLC_TRUE
);
#endif
#if LIBAVCODEC_BUILD >= 4611
add_integer
(
"ffmpeg-error-resilience"
,
-
1
,
NULL
,
"error resilience"
,
ERROR_RESILIENCE_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"ffmpeg-workaround-bugs"
,
1
,
NULL
,
"workaround bugs"
,
WORKAROUND_BUGS_LONGTEXT
,
VLC_FALSE
);
#endif
add_bool
(
"ffmpeg-hurry-up"
,
0
,
NULL
,
"hurry up"
,
HURRY_UP_LONGTEXT
,
VLC_FALSE
);
add_category_hint
(
N_
(
"Post processing"
),
NULL
,
VLC_FALSE
);
add_module
(
"ffmpeg-pp"
,
"postprocessing"
,
NULL
,
NULL
,
N_
(
"ffmpeg postprocessing module"
),
NULL
,
VLC_FALSE
);
add_integer
(
"ffmpeg-pp-q"
,
0
,
NULL
,
"post processing quality"
,
POSTPROCESSING_Q_LONGTEXT
,
VLC_FALSE
);
#ifdef LIBAVCODEC_PP
add_string
(
"ffmpeg-pp-name"
,
"default"
,
NULL
,
"ffmpeg postproc filter chains"
,
LIBAVCODEC_PP_LONGHELP
,
VLC_TRUE
);
#else
add_module
(
"ffmpeg-pp"
,
"postprocessing"
,
NULL
,
NULL
,
N_
(
"ffmpeg postprocessing module"
),
NULL
,
VLC_FALSE
);
add_bool
(
"ffmpeg-pp-auto"
,
0
,
NULL
,
"auto-level Post processing quality"
,
POSTPROCESSING_AQ_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"ffmpeg-db-yv"
,
0
,
NULL
,
...
...
@@ -135,7 +181,7 @@ vlc_module_begin();
add_bool
(
"ffmpeg-dr-c"
,
0
,
NULL
,
"force chrominance deringing"
,
"force chrominance deringing (override other settings)"
,
VLC_TRUE
);
#endif
set_description
(
_
(
"ffmpeg audio/video decoder((MS)MPEG4,SVQ1,H263,WMV,WMA)"
)
);
set_capability
(
"decoder"
,
70
);
set_callbacks
(
OpenDecoder
,
NULL
);
...
...
@@ -275,12 +321,7 @@ static int InitThread( generic_thread_t *p_decoder )
}
/* *** Get a p_context *** */
#if LIBAVCODEC_BUILD >= 4624
p_decoder
->
p_context
=
avcodec_alloc_context
();
#else
p_decoder
->
p_context
=
malloc
(
sizeof
(
AVCodecContext
)
);
memset
(
p_decoder
->
p_context
,
0
,
sizeof
(
AVCodecContext
)
);
#endif
switch
(
p_decoder
->
i_cat
)
{
...
...
@@ -399,7 +440,6 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
psz_name = "MPEG-1/2 Video";
break;
#endif
#if LIBAVCODEC_BUILD >= 4608
case
FOURCC_DIV1
:
case
FOURCC_div1
:
case
FOURCC_MPG4
:
...
...
@@ -417,7 +457,6 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
i_codec
=
CODEC_ID_MSMPEG4V2
;
psz_name
=
"MS MPEG-4 v2"
;
break
;
#endif
case
FOURCC_MPG3
:
case
FOURCC_mpg3
:
...
...
@@ -433,25 +472,19 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
case
FOURCC_div6
:
case
FOURCC_AP41
:
case
FOURCC_3VID
:
case
FOURCC_3vid
:
case
FOURCC_3vid
:
case
FOURCC_3IVD
:
case
FOURCC_3ivd
:
i_cat
=
VIDEO_ES
;
#if LIBAVCODEC_BUILD >= 4608
i_codec
=
CODEC_ID_MSMPEG4V3
;
#else
i_codec
=
CODEC_ID_MSMPEG4
;
#endif
psz_name
=
"MS MPEG-4 v3"
;
break
;
#if LIBAVCODEC_BUILD >= 4615
case
FOURCC_SVQ1
:
i_cat
=
VIDEO_ES
;
i_codec
=
CODEC_ID_SVQ1
;
psz_name
=
"SVQ-1 (Sorenson Video v1)"
;
break
;
#endif
case
FOURCC_DIVX
:
case
FOURCC_divx
:
...
...
@@ -465,10 +498,10 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
case
FOURCC_DX50
:
case
FOURCC_mp4v
:
case
FOURCC_4
:
/* 3iv1 is unsupported by ffmpeg
/* 3iv1 is unsupported by ffmpeg
putting it here gives extreme distorted images
case FOURCC_3IV1:
case FOURCC_3iv1:
case FOURCC_3IV1:
case FOURCC_3iv1:
*/
case
FOURCC_3IV2
:
case
FOURCC_3iv2
:
...
...
@@ -512,13 +545,11 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
i_codec
=
CODEC_ID_MJPEG
;
psz_name
=
"Motion JPEG"
;
break
;
#if LIBAVCODEC_BUILD >= 4640
case
FOURCC_mjpb
:
i_cat
=
VIDEO_ES
;
i_codec
=
CODEC_ID_MJPEGB
;
psz_name
=
"Motion JPEG B"
;
break
;
#endif
case
FOURCC_dvsl
:
case
FOURCC_dvsd
:
case
FOURCC_DVSD
:
...
...
@@ -530,7 +561,6 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
psz_name
=
"DV video"
;
break
;
#if LIBAVCODEC_BUILD >= 4655
case
FOURCC_MAC3
:
i_cat
=
AUDIO_ES
;
i_codec
=
CODEC_ID_MACE3
;
...
...
@@ -546,9 +576,7 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
i_codec
=
CODEC_ID_DVAUDIO
;
psz_name
=
"DV audio"
;
break
;
#endif
#if LIBAVCODEC_BUILD >= 4632
case
FOURCC_WMA1
:
case
FOURCC_wma1
:
i_cat
=
AUDIO_ES
;
...
...
@@ -561,7 +589,6 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
i_codec
=
CODEC_ID_WMAV2
;
psz_name
=
"Windows Media Audio 2"
;
break
;
#endif
#if LIBAVCODEC_BUILD >= 4663
case
FOURCC_IV31
:
...
...
modules/codec/ffmpeg/ffmpeg.h
View file @
5e99f4d4
...
...
@@ -2,7 +2,7 @@
* ffmpeg_vdec.h: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ffmpeg.h,v 1.1
6
2003/04/1
6 00:12
:3
6
fenrir Exp $
* $Id: ffmpeg.h,v 1.1
7
2003/04/1
7 10:58
:3
0
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -39,7 +39,7 @@
u8 *p_buffer;
/* buffer for gather pes */
\
int i_buffer_size;
/* size of allocated p_buffer */
\
int i_buffer;
/* bytes already present in p_buffer */
typedef
struct
generic_thread_s
{
...
...
@@ -47,6 +47,12 @@ typedef struct generic_thread_s
}
generic_thread_t
;
#if LIBAVCODEC_BUILD >= 4663
# define LIBAVCODEC_PP
#else
# undef LIBAVCODEC_PP
#endif
#define GetWLE( p ) \
( *(u8*)(p) + ( *((u8*)(p)+1) << 8 ) )
...
...
@@ -124,7 +130,7 @@ int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
#define FOURCC_3VID VLC_FOURCC('3','V','I','D')
#define FOURCC_3vid VLC_FOURCC('3','v','i','d')
/* H263 and H263i */
/* H263 and H263i */
#define FOURCC_H263 VLC_FOURCC('H','2','6','3')
#define FOURCC_h263 VLC_FOURCC('h','2','6','3')
#define FOURCC_U263 VLC_FOURCC('U','2','6','3')
...
...
modules/codec/ffmpeg/video.c
View file @
5e99f4d4
...
...
@@ -2,7 +2,7 @@
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.
19
2003/0
3/24
1
3
:5
0:55 hartman
Exp $
* $Id: video.c,v 1.
20
2003/0
4/17
1
0
:5
8:30 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
...
...
@@ -40,28 +40,30 @@
#endif
#include "avcodec.h"
/* ffmpeg */
#include "ffmpeg.h"
#include "postprocessing/postprocessing.h"
#ifdef LIBAVCODEC_PP
# include "libpostproc/postprocess.h"
#else
# include "postprocessing/postprocessing.h"
#endif
#include "ffmpeg.h"
#include "video.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
#if LIBAVCODEC_BUILD >= 4641
static
void
ffmpeg_CopyPicture
(
picture_t
*
,
AVFrame
*
,
vdec_thread_t
*
);
#else
static
void
ffmpeg_CopyPicture
(
picture_t
*
,
AVPicture
*
,
vdec_thread_t
*
);
#endif
#ifndef LIBAVCODEC_PP
static
void
ffmpeg_PostProcPicture
(
vdec_thread_t
*
,
picture_t
*
);
#if LIBAVCODEC_BUILD >= 4641
static
int
ffmpeg_GetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
ffmpeg_ReleaseFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
#endif
/* direct rendering */
static
int
ffmpeg_GetFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
ffmpeg_ReleaseFrameBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
/*****************************************************************************
* Local Functions
*****************************************************************************/
...
...
@@ -81,10 +83,8 @@ static inline uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
return
(
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'2'
)
);
case
PIX_FMT_YUV444P
:
return
(
VLC_FOURCC
(
'I'
,
'4'
,
'4'
,
'4'
)
);
#if LIBAVCODEC_BUILD >= 4615
case
PIX_FMT_YUV410P
:
case
PIX_FMT_YUV411P
:
#endif
case
PIX_FMT_BGR24
:
default:
return
(
0
);
...
...
@@ -111,34 +111,55 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
/* we make conversion if possible*/
i_chroma
=
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
);
}
#if LIBAVCODEC_BUILD >= 4640
i_aspect
=
VOUT_ASPECT_FACTOR
*
p_context
->
aspect_ratio
;
if
(
i_aspect
==
0
)
{
i_aspect
=
VOUT_ASPECT_FACTOR
*
i_width
/
i_height
;
}
#else
switch
(
p_context
->
aspect_ratio_info
)
{
case
(
FF_ASPECT_4_3_625
):
case
(
FF_ASPECT_4_3_525
):
i_aspect
=
VOUT_ASPECT_FACTOR
*
4
/
3
;
break
;
case
(
FF_ASPECT_16_9_625
):
case
(
FF_ASPECT_16_9_525
):
i_aspect
=
VOUT_ASPECT_FACTOR
*
16
/
9
;
break
;
case
(
FF_ASPECT_SQUARE
):
default:
i_aspect
=
VOUT_ASPECT_FACTOR
*
i_width
/
i_height
;
break
;
}
#endif
/* Spawn a video output if there is none. First we look for our children,
* then we look for any other vout that might be available. */
p_vout
=
vout_Request
(
p_vdec
->
p_fifo
,
NULL
,
i_width
,
i_height
,
i_chroma
,
i_aspect
);
#ifdef LIBAVCODEC_PP
if
(
p_vdec
->
pp_mode
&&
!
p_vdec
->
pp_context
)
{
int32_t
i_cpu
=
p_vdec
->
p_fifo
->
p_libvlc
->
i_cpu
;
int
i_flags
=
0
;
if
(
i_cpu
&
CPU_CAPABILITY_MMX
)
{
i_flags
|=
PP_CPU_CAPS_MMX
;
}
if
(
i_cpu
&
CPU_CAPABILITY_MMXEXT
)
{
i_flags
|=
PP_CPU_CAPS_MMX2
;
}
if
(
i_cpu
&
CPU_CAPABILITY_3DNOW
)
{
i_flags
|=
PP_CPU_CAPS_3DNOW
;
}
switch
(
p_context
->
pix_fmt
)
{
case
PIX_FMT_YUV444P
:
i_flags
|=
PP_FORMAT_444
;
break
;
case
PIX_FMT_YUV422P
:
i_flags
|=
PP_FORMAT_422
;
break
;
case
PIX_FMT_YUV411P
:
i_flags
|=
PP_FORMAT_411
;
break
;
default:
i_flags
|=
PP_FORMAT_420
;
break
;
}
p_vdec
->
pp_context
=
pp_get_context
(
i_width
,
i_height
,
i_flags
);
}
#endif
return
p_vout
;
}
...
...
@@ -166,20 +187,13 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
int
E_
(
InitThread_Video
)(
vdec_thread_t
*
p_vdec
)
{
int
i_tmp
;
#if LIBAVCODEC_BUILD >= 4645
p_vdec
->
p_ff_pic
=
avcodec_alloc_frame
();
#elif LIBAVCODEC_BUILD >= 4641
p_vdec
->
p_ff_pic
=
avcodec_alloc_picture
();
#else
p_vdec
->
p_ff_pic
=
&
p_vdec
->
ff_pic
;
#endif
if
(
(
p_vdec
->
p_format
=
(
BITMAPINFOHEADER
*
)
p_vdec
->
p_fifo
->
p_bitmapinfoheader
)
!=
NULL
)
{
/* ***** Fill p_context with init values ***** */
p_vdec
->
p_context
->
width
=
p_vdec
->
p_format
->
biWidth
;
p_vdec
->
p_context
->
height
=
p_vdec
->
p_format
->
biHeight
;
}
else
{
...
...
@@ -189,34 +203,21 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
/* ***** Get configuration of ffmpeg plugin ***** */
#if LIBAVCODEC_BUILD >= 4611
i_tmp
=
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-workaround-bugs"
);
p_vdec
->
p_context
->
workaround_bugs
=
__MAX
(
__MIN
(
i_tmp
,
99
),
0
);
i_tmp
=
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-error-resilience"
);
p_vdec
->
p_context
->
error_resilience
=
__MAX
(
__MIN
(
i_tmp
,
99
),
-
1
);
#endif
#if LIBAVCODEC_BUILD >= 4614
if
(
config_GetInt
(
p_vdec
->
p_fifo
,
"grayscale"
)
)
{
p_vdec
->
p_context
->
flags
|=
CODEC_FLAG_GRAY
;
}
#endif
p_vdec
->
b_hurry_up
=
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-hurry-up"
);
p_vdec
->
b_direct_rendering
=
0
;
#if 0
/* check if codec support truncated frames */
// if( p_vdec->p_codec->capabilities & CODEC_FLAG_TRUNCATED )
if( p_vdec->i_codec_id == CODEC_ID_MPEG1VIDEO)
{
msg_Dbg( p_vdec->p_fifo, "CODEC_FLAG_TRUNCATED supported" );
p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED;
}
#endif
/* CODEC_FLAG_TRUNCATED */
/* FIXME search real LIBAVCODEC_BUILD */
...
...
@@ -231,7 +232,7 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
{
msg_Err
(
p_vdec
->
p_fifo
,
"cannot open codec (%s)"
,
p_vdec
->
psz_namecodec
);
return
(
-
1
);
return
(
VLC_EGENERIC
);
}
else
{
...
...
@@ -239,7 +240,6 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
p_vdec
->
psz_namecodec
);
}
#if LIBAVCODEC_BUILD >= 4641
if
(
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-dr"
)
&&
p_vdec
->
p_codec
->
capabilities
&
CODEC_CAP_DR1
&&
ffmpeg_PixFmtToChroma
(
p_vdec
->
p_context
->
pix_fmt
)
)
...
...
@@ -255,52 +255,72 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
p_vdec
->
p_context
->
opaque
=
p_vdec
;
}
#endif
/* ***** init this codec with special data ***** */
if
(
p_vdec
->
p_format
&&
p_vdec
->
p_format
->
biSize
>
sizeof
(
BITMAPINFOHEADER
)
)
{
int
b_gotpicture
;
int
i_size
=
p_vdec
->
p_format
->
biSize
-
sizeof
(
BITMAPINFOHEADER
);
switch
(
p_vdec
->
i_codec_id
)
if
(
p_vdec
->
i_codec_id
==
CODEC_ID_MPEG4
)
{
case
(
CODEC_ID_MPEG4
):
#if 1
avcodec_decode_video
(
p_vdec
->
p_context
,
p_vdec
->
p_ff_pic
,
&
b_gotpicture
,
(
void
*
)
&
p_vdec
->
p_format
[
1
],
p_vdec
->
p_format
->
biSize
-
sizeof
(
BITMAPINFOHEADER
)
);
#endif
break
;
default:
if
(
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_MP4S
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_mp4s
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_M4S2
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_m4s2
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_WMV2
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_MSS1
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_MJPG
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_mjpg
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_mjpa
||
p_vdec
->
p_fifo
->
i_fourcc
==
FOURCC_mjpb
)
{
p_vdec
->
p_context
->
extradata_size
=
p_vdec
->
p_format
->
biSize
-
sizeof
(
BITMAPINFOHEADER
);
p_vdec
->
p_context
->
extradata
=
malloc
(
p_vdec
->
p_context
->
extradata_size
);
memcpy
(
p_vdec
->
p_context
->
extradata
,
&
p_vdec
->
p_format
[
1
],
p_vdec
->
p_context
->
extradata_size
);
}
break
;
avcodec_decode_video
(
p_vdec
->
p_context
,
p_vdec
->
p_ff_pic
,
&
b_gotpicture
,
(
void
*
)
&
p_vdec
->
p_format
[
1
],
i_size
);
}
else
{
p_vdec
->
p_context
->
extradata_size
=
i_size
;
p_vdec
->
p_context
->
extradata
=
malloc
(
i_size
);
memcpy
(
p_vdec
->
p_context
->
extradata
,
&
p_vdec
->
p_format
[
1
],
i_size
);
}
}
/* ***** Load post processing ***** */
#ifdef LIBAVCODEC_PP
p_vdec
->
pp_context
=
NULL
;
p_vdec
->
pp_mode
=
NULL
;
/* for now we cannot do postproc and dr */
if
(
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-pp-q"
)
>
0
&&
!
p_vdec
->
b_direct_rendering
)
{
int
i_quality
=
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-pp-q"
);
char
*
psz_name
=
config_GetPsz
(
p_vdec
->
p_fifo
,
"ffmpeg-pp-name"
);
if
(
!
psz_name
)
{
psz_name
=
strdup
(
"default"
);
}
else
if
(
*
psz_name
==
'\0'
)
{
free
(
psz_name
);
psz_name
=
strdup
(
"default"
);
}
p_vdec
->
pp_mode
=
pp_get_mode_by_name_and_quality
(
psz_name
,
i_quality
);
if
(
!
p_vdec
->
pp_mode
)
{
msg_Err
(
p_vdec
->
p_fifo
,
"failed geting mode for postproc"
);
}
else
{
msg_Info
(
p_vdec
->
p_fifo
,
"postproc activated"
);
}
free
(
psz_name
);
}
else
{
msg_Dbg
(
p_vdec
->
p_fifo
,
"no postproc"
);
}
#else
/* get overridding settings */
p_vdec
->
i_pp_mode
=
0
;
if
(
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-db-yv"
)
)
...
...
@@ -323,20 +343,15 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
/* check if the codec support postproc. */
switch
(
p_vdec
->
i_codec_id
)
{
#if LIBAVCODEC_BUILD > 4608
case
(
CODEC_ID_MSMPEG4V1
):
case
(
CODEC_ID_MSMPEG4V2
):
case
(
CODEC_ID_MSMPEG4V3
):
#else
case
(
CODEC_ID_MSMPEG4
):
#endif
case
(
CODEC_ID_MPEG4
):
case
(
CODEC_ID_H263
):
// case( CODEC_ID_H263P ): I don't use it up to now
case
(
CODEC_ID_H263I
):
/* Ok we can make postprocessing :)) */
/* first try to get a postprocess module */
#if LIBAVCODEC_BUILD >= 4633
p_vdec
->
p_pp
=
vlc_object_create
(
p_vdec
->
p_fifo
,
sizeof
(
postprocessing_t
)
);
p_vdec
->
p_pp
->
psz_object_name
=
"postprocessing"
;
...
...
@@ -360,11 +375,6 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
config_GetInt
(
p_vdec
->
p_fifo
,
"ffmpeg-pp-auto"
)
);
}
#else
p_vdec
->
i_pp_mode
=
0
;
msg_Warn
(
p_vdec
->
p_fifo
,
"post-processing not supported, upgrade ffmpeg"
);
#endif
break
;
default:
p_vdec
->
i_pp_mode
=
0
;
...
...
@@ -372,11 +382,10 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
"Post processing unsupported for this codec"
);
break
;
}
}
// memset( &p_vdec->statistic, 0, sizeof( statistic_t ) );
#endif
return
(
0
);
return
(
VLC_SUCCESS
);