Commit 229fe32c authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Backport of swscale functionality from trunk.

parent 469e9790
......@@ -4,11 +4,13 @@ SOURCES_ffmpeg = \
video.c \
audio.c \
video_filter.c \
deinterlace.c \
chroma.c \
encoder.c \
postprocess.c \
demux.c \
mux.c \
scale.c \
$(NULL)
SOURCES_ffmpegaltivec = \
......@@ -17,6 +19,7 @@ SOURCES_ffmpegaltivec = \
video.c \
audio.c \
video_filter.c \
deinterlace.c \
chroma.c \
encoder.c \
postprocess.c \
......
......@@ -36,6 +36,7 @@
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void E_(InitLibavcodec) ( vlc_object_t *p_object );
static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * );
......@@ -187,3 +188,4 @@ void E_(CloseChroma)( vlc_object_t *p_this )
}
free( p_vout->chroma.p_sys );
}
#endif
/*****************************************************************************
* video filter: video filter doing chroma conversion and resizing
* using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc_codec.h>
#include <vlc_filter.h>
/* ffmpeg header */
#ifdef HAVE_FFMPEG_AVCODEC_H
# include <ffmpeg/avcodec.h>
#else
# include <avcodec.h>
#endif
#include "ffmpeg.h"
static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic );
/*****************************************************************************
* filter_sys_t : filter descriptor
*****************************************************************************/
struct filter_sys_t
{
vlc_bool_t b_resize;
vlc_bool_t b_convert;
vlc_bool_t b_resize_first;
vlc_bool_t b_enable_croppadd;
es_format_t fmt_in;
int i_src_ffmpeg_chroma;
es_format_t fmt_out;
int i_dst_ffmpeg_chroma;
AVPicture tmp_pic;
};
/*****************************************************************************
* OpenDeinterlace: probe the filter and return score
*****************************************************************************/
int E_(OpenDeinterlace)( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys;
/* Check if we can handle that formats */
if( E_(GetFfmpegChroma)( p_filter->fmt_in.video.i_chroma ) < 0 )
{
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the decoder's structure */
if( ( p_filter->p_sys = p_sys =
(filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
/* Misc init */
p_sys->i_src_ffmpeg_chroma =
E_(GetFfmpegChroma)( p_filter->fmt_in.video.i_chroma );
p_filter->pf_video_filter = Deinterlace;
msg_Dbg( p_filter, "deinterlacing" );
/* libavcodec needs to be initialized for some chroma conversions */
E_(InitLibavcodec)(p_this);
return VLC_SUCCESS;
}
/*****************************************************************************
* CloseDeinterlace: clean up the filter
*****************************************************************************/
void E_(CloseDeinterlace)( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
free( p_sys );
}
/*****************************************************************************
* Do the processing here
*****************************************************************************/
static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
AVPicture src_pic, dest_pic;
picture_t *p_pic_dst;
int i;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
/* Prepare the AVPictures for the conversion */
for( i = 0; i < p_pic->i_planes; i++ )
{
src_pic.data[i] = p_pic->p[i].p_pixels;
src_pic.linesize[i] = p_pic->p[i].i_pitch;
}
for( i = 0; i < p_pic_dst->i_planes; i++ )
{
dest_pic.data[i] = p_pic_dst->p[i].p_pixels;
dest_pic.linesize[i] = p_pic_dst->p[i].i_pitch;
}
avpicture_deinterlace( &dest_pic, &src_pic, p_sys->i_src_ffmpeg_chroma,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height );
p_pic_dst->date = p_pic->date;
p_pic_dst->b_force = p_pic->b_force;
p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
p_pic_dst->b_progressive = VLC_TRUE;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......@@ -42,12 +42,10 @@
#include "ffmpeg.h"
#ifdef LIBAVCODEC_PP
# ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
# else
# include <libpostproc/postprocess.h>
# endif
#ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
#else
# include <libpostproc/postprocess.h>
#endif
/*****************************************************************************
......@@ -76,6 +74,16 @@ static char *nloopf_list_text[] =
static char *enc_hq_list[] = { "rd", "bits", "simple" };
static char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
static int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static const char *ppsz_mode_descriptions[] =
{ N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"),
N_("Experimental"), N_("Nearest neighbour (bad quality)"),
N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),
N_("SincR"), N_("Lanczos"), N_("Bicubic spline") };
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -112,20 +120,13 @@ vlc_module_begin();
SKIPLOOPF_LONGTEXT, VLC_TRUE );
change_integer_list( nloopf_list, nloopf_list_text, 0 );
#ifdef LIBAVCODEC_PP
add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, VLC_FALSE );
add_string( "ffmpeg-pp-name", "default", NULL, LIBAVCODEC_PP_TEXT,
LIBAVCODEC_PP_LONGTEXT, VLC_TRUE );
#endif
add_integer( "ffmpeg-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT,
VLC_TRUE );
/* chroma conversion submodule */
add_submodule();
set_capability( "chroma", 50 );
set_callbacks( E_(OpenChroma), E_(CloseChroma) );
set_description( _("FFmpeg chroma conversion") );
/* encoder submodule */
add_submodule();
set_section( N_("Encoding") , NULL );
......@@ -197,6 +198,18 @@ vlc_module_begin();
set_capability( "sout mux", 2 );
set_callbacks( E_(OpenMux), E_(CloseMux) );
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
/* video filter submodule */
add_submodule();
set_description( _("Video scaling filter") );
set_capability( "video filter2", 1000 );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VFILTER );
set_callbacks( E_(OpenScaler), E_(CloseScaler) );
add_integer( "swscale-mode", 0, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, VLC_TRUE );
change_integer_list( pi_mode_values, ppsz_mode_descriptions, 0 );
#else
/* video filter submodule */
add_submodule();
set_capability( "video filter2", 50 );
......@@ -209,6 +222,13 @@ vlc_module_begin();
set_callbacks( E_(OpenCropPadd), E_(CloseFilter) );
set_description( _("FFmpeg crop padd filter") );
/* chroma conversion submodule */
add_submodule();
set_capability( "chroma", 50 );
set_callbacks( E_(OpenChroma), E_(CloseChroma) );
set_description( _("FFmpeg chroma conversion") );
#endif
/* video filter submodule */
add_submodule();
set_capability( "video filter2", 0 );
......@@ -455,23 +475,24 @@ static struct
/* Packed YUV formats */
{ VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUV422 },
#if LIBAVCODEC_BUILD >= 4720
{ VLC_FOURCC('Y','U','Y','V'), PIX_FMT_YUV422 },
{ VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
#endif
/* Packed RGB formats */
{ VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
{ VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
{ VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
{ VLC_FOURCC('R','V','3','2'), PIX_FMT_RGBA32 },
#ifdef WORDS_BIGENDIAN
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
# ifdef WORDS_BIGENDIAN
{ VLC_FOURCC('R','G','B','A'), PIX_FMT_RGB32_1 },
#else
# else
{ VLC_FOURCC('R','G','B','A'), PIX_FMT_BGR32 },
# endif
#endif
{ VLC_FOURCC('G','R','E','Y'), PIX_FMT_GRAY8 },
{0}
{ 0, 0 }
};
int E_(GetFfmpegChroma)( vlc_fourcc_t i_chroma )
......@@ -513,12 +534,49 @@ static struct
/* MPEG-1 Video */
{ VLC_FOURCC('m','p','1','v'), CODEC_ID_MPEG1VIDEO,
VIDEO_ES, "MPEG-1 Video" },
{ VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
VIDEO_ES, "MPEG-1 Video" },
{ VLC_FOURCC('m','p','g','1'), CODEC_ID_MPEG1VIDEO,
VIDEO_ES, "MPEG-1 Video" },
{ VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
VIDEO_ES, "MPEG-1 Video" },
{ VLC_FOURCC('P','I','M','1'), CODEC_ID_MPEG1VIDEO,
VIDEO_ES, "Pinnacle DC1000 (MPEG-1 Video)" },
/* MPEG-2 Video */
{ VLC_FOURCC('m','p','2','v'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG-2 Video" },
{ VLC_FOURCC('m','p','g','v'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG-2 Video" },
{ VLC_FOURCC('M','P','E','G'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG-2 Video" },
{ VLC_FOURCC('m','p','g','2'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG-2 Video" },
{ VLC_FOURCC('h','d','v','1'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "HDV 720p30 (MPEG-2 Video)" },
{ VLC_FOURCC('h','d','v','2'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "Sony HDV (MPEG-2 Video)" },
{ VLC_FOURCC('h','d','v','3'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "FCP HDV (MPEG-2 Video)" },
{ VLC_FOURCC('m','x','5','n'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG2 IMX NTSC 525/60 50mb/s (FCP)" },
{ VLC_FOURCC('m','x','5','p'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG2 IMX PAL 625/50 50mb/s (FCP)" },
{ VLC_FOURCC('m','x','3','n'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG2 IMX NTSC 525/60 30mb/s (FCP)" },
{ VLC_FOURCC('m','x','3','p'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "MPEG2 IMX NTSC 625/50 30mb/s (FCP)" },
{ VLC_FOURCC('x','d','v','2'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "XDCAM HD 1080i60" },
{ VLC_FOURCC('A','V','m','p'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "AVID IMX PAL" },
/* ATI VCR2 */
{ VLC_FOURCC('V','C','R','2'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "ATI VCR2 Video" },
{ VLC_FOURCC('M','M','E','S'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "Matrox MPEG-2" },
{ VLC_FOURCC('m','m','e','s'), CODEC_ID_MPEG2VIDEO,
VIDEO_ES, "Matrox MPEG-2" },
/* MPEG-4 Video */
{ VLC_FOURCC('D','I','V','X'), CODEC_ID_MPEG4,
......@@ -547,6 +605,10 @@ static struct
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('d','x','5','0'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('B','L','Z','0'), CODEC_ID_MPEG4,
VIDEO_ES, "Blizzard MPEG-4 Video" },
{ VLC_FOURCC('D','X','G','M'), CODEC_ID_MPEG4,
VIDEO_ES, "Electronic Arts Game MPEG-4 Video" },
{ VLC_FOURCC('m','p','4','v'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('M','P','4','V'), CODEC_ID_MPEG4,
......@@ -559,6 +621,8 @@ static struct
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('F','M','P','4'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
/* 3ivx delta 3.5 Unsupported
* putting it here gives extreme distorted images
{ VLC_FOURCC('3','I','V','1'), CODEC_ID_MPEG4,
......@@ -570,6 +634,24 @@ static struct
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('3','i','v','2'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('U','M','P','4'), CODEC_ID_MPEG4,
VIDEO_ES, "UB MPEG-4 Video" },
{ VLC_FOURCC('W','V','1','F'), CODEC_ID_MPEG4,
VIDEO_ES, "MPEG-4 Video" },
{ VLC_FOURCC('S','E','D','G'), CODEC_ID_MPEG4,
VIDEO_ES, "Samsung MPEG-4 Video" },
{ VLC_FOURCC('R','M','P','4'), CODEC_ID_MPEG4,
VIDEO_ES, "REALmagic MPEG-4 Video" },
{ VLC_FOURCC('H','D','X','4'), CODEC_ID_MPEG4,
VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
{ VLC_FOURCC('h','d','x','4'), CODEC_ID_MPEG4,
VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
{ VLC_FOURCC('S','M','P','4'), CODEC_ID_MPEG4,
VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" },
{ VLC_FOURCC('f','v','f','w'), CODEC_ID_MPEG4,
VIDEO_ES, "FFmpeg MPEG-4" },
{ VLC_FOURCC('F','V','F','W'), CODEC_ID_MPEG4,
VIDEO_ES, "FFmpeg MPEG-4" },
/* MSMPEG4 v1 */
{ VLC_FOURCC('D','I','V','1'), CODEC_ID_MSMPEG4V1,
......@@ -617,6 +699,15 @@ static struct
VIDEO_ES, "MS MPEG-4 Video v3" },
{ VLC_FOURCC('d','i','v','6'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
/* Cool Codec */
{ VLC_FOURCC('C','O','L','1'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
{ VLC_FOURCC('c','o','l','1'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
{ VLC_FOURCC('C','O','L','0'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
{ VLC_FOURCC('c','o','l','0'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
/* AngelPotion stuff */
{ VLC_FOURCC('A','P','4','1'), CODEC_ID_MSMPEG4V3,
VIDEO_ES, "MS MPEG-4 Video v3" },
......@@ -634,6 +725,10 @@ static struct
/* Sorenson v1 */
{ VLC_FOURCC('S','V','Q','1'), CODEC_ID_SVQ1,
VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
{ VLC_FOURCC('s','v','q','1'), CODEC_ID_SVQ1,
VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
{ VLC_FOURCC('s','v','q','i'), CODEC_ID_SVQ1,
VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
/* Sorenson v3 */
{ VLC_FOURCC('S','V','Q','3'), CODEC_ID_SVQ3,
......@@ -650,11 +745,20 @@ static struct
VIDEO_ES, "h264" },
/* avc1: special case h264 */
{ VLC_FOURCC('a','v','c','1'), CODEC_ID_H264,
VIDEO_ES, "h264" },
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
{ VLC_FOURCC('A','V','C','1'), CODEC_ID_H264,
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
{ VLC_FOURCC('V','S','S','H'), CODEC_ID_H264,
VIDEO_ES, "h264" },
VIDEO_ES, "Vanguard VSS H264" },
{ VLC_FOURCC('V','S','S','W'), CODEC_ID_H264,
VIDEO_ES, "Vanguard VSS H264" },
{ VLC_FOURCC('v','s','s','h'), CODEC_ID_H264,
VIDEO_ES, "h264" },
VIDEO_ES, "Vanguard VSS H264" },
{ VLC_FOURCC('D','A','V','C'), CODEC_ID_H264,
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
{ VLC_FOURCC('d','a','v','c'), CODEC_ID_H264,
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
/* H263 and H263i */
/* H263(+) is also known as Real Video 1.0 */
......@@ -662,14 +766,28 @@ static struct
/* FIXME FOURCC_H263P exist but what fourcc ? */
/* H263 */
{ VLC_FOURCC('D','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "DEC H263" },
{ VLC_FOURCC('H','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "H263" },
{ VLC_FOURCC('h','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "H263" },
{ VLC_FOURCC('U','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "H263" },
{ VLC_FOURCC('M','2','6','3'), CODEC_ID_H263,
{ VLC_FOURCC('L','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "LEAD H263" },
{ VLC_FOURCC('s','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "H263" },
{ VLC_FOURCC('S','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "H263" },
{ VLC_FOURCC('M','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "Microsoft H263" },
{ VLC_FOURCC('X','2','6','3'), CODEC_ID_H263,
VIDEO_ES, "Xirlink H263" },
/* Zygo (partial) */
{ VLC_FOURCC('Z','y','G','o'), CODEC_ID_H263,
VIDEO_ES, "ITU H263+" },
/* H263i */
{ VLC_FOURCC('I','2','6','3'), CODEC_ID_H263I,
......@@ -677,43 +795,78 @@ static struct
{ VLC_FOURCC('i','2','6','3'), CODEC_ID_H263I,
VIDEO_ES, "I263.I" },
/* H263P */
{ VLC_FOURCC('v','i','v','1'), CODEC_ID_H263P,
VIDEO_ES, "H263+" },
{ VLC_FOURCC('v','i','v','O'), CODEC_ID_H263P,
VIDEO_ES, "H263+" },
{ VLC_FOURCC('v','i','v','2'), CODEC_ID_H263P,
VIDEO_ES, "H263+" },
{ VLC_FOURCC('U','2','6','3'), CODEC_ID_H263P,
VIDEO_ES, "UB H263+" },
{ VLC_FOURCC('I','L','V','R'), CODEC_ID_H263P,
VIDEO_ES, "ITU H263+" },
/* Flash (H263) variant */
{ VLC_FOURCC('F','L','V','1'), CODEC_ID_FLV1,
VIDEO_ES, "Flash Video" },
#if LIBAVCODEC_BUILD > 4716
/* H261 */
{ VLC_FOURCC('H','2','6','1'), CODEC_ID_H261,
VIDEO_ES, "H.261" },
#endif
{ VLC_FOURCC('h','2','6','1'), CODEC_ID_H261,
VIDEO_ES, "H.261" },
#if LIBAVCODEC_BUILD > 4680
{ VLC_FOURCC('F','L','I','C'), CODEC_ID_FLIC,
VIDEO_ES, "Flic Video" },
#endif
/* MJPEG */
{ VLC_FOURCC( 'M', 'J', 'P', 'G' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('M','J','P','G'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'm', 'j', 'p', 'g' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('m','j','p','g'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'm', 'j', 'p', 'a' ), CODEC_ID_MJPEG, /* for mov file */
{ VLC_FOURCC('m','j','p','a'), CODEC_ID_MJPEG, /* for mov file */
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'j', 'p', 'e', 'g' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('j','p','e','g'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'J', 'P', 'E', 'G' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('J','P','E','G'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'J', 'F', 'I', 'F' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('J','F','I','F'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'J', 'P', 'G', 'L' ), CODEC_ID_MJPEG,
{ VLC_FOURCC('J','P','G','L'), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'm', 'j', 'p', 'b' ), CODEC_ID_MJPEGB, /* for mov file */
{ VLC_FOURCC( 'A','V','D','J' ), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'm','j','p','b' ), CODEC_ID_MJPEGB, /* for mov file */
VIDEO_ES, "Motion JPEG B Video" },
#if LIBAVCODEC_BUILD > 4680
{ VLC_FOURCC( 'S', 'P', '5', 'X' ), CODEC_ID_SP5X,
{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_LJPEG,
VIDEO_ES, "Lead Motion JPEG Video" },
{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG,
VIDEO_ES, "Lead Motion JPEG Video" },
/* AVID MJPEG */
{ VLC_FOURCC( 'A','V','R','n' ), CODEC_ID_MJPEG,
VIDEO_ES, "Avid Motion JPEG" },
{ VLC_FOURCC( 'A','D','J','V' ), CODEC_ID_MJPEG,
VIDEO_ES, "Avid Motion JPEG" },
{ VLC_FOURCC( 'd','m','b','1' ), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG OpenDML Video" },
/* SP5x */
{ VLC_FOURCC( 'S','P','5','X' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','3' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','4' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','5' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','6' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','7' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
{ VLC_FOURCC( 'S','P','5','8' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
#endif
/* DV */
{ VLC_FOURCC('d','v','s','l'), CODEC_ID_DVVIDEO,
......@@ -734,26 +887,39 @@ static struct
VIDEO_ES, "DV Video Pro PAL" },
{ VLC_FOURCC('C','D','V','C'), CODEC_ID_DVVIDEO,
VIDEO_ES, "DV Video" },
{ VLC_FOURCC('c','d','v','c'), CODEC_ID_DVVIDEO,
VIDEO_ES, "DV Video" },
{ VLC_FOURCC('d','v','5','p'), CODEC_ID_DVVIDEO,
VIDEO_ES, "DV Video C Pro 50 PAL" },
{ VLC_FOURCC('d','v','5','n'), CODEC_ID_DVVIDEO,
VIDEO_ES, "DV Video C Pro 50 NTSC" },
{ VLC_FOURCC('A','V','d','v'), CODEC_ID_DVVIDEO,
VIDEO_ES, "AVID DV" },
/* Windows Media Video */
{ VLC_FOURCC('W','M','V','1'), CODEC_ID_WMV1,
VIDEO_ES, "Windows Media Video 1" },
{ VLC_FOURCC('w','m','v','1'), CODEC_ID_WMV1,
VIDEO_ES, "Windows Media Video 1" },
{ VLC_FOURCC('W','M','V','2'), CODEC_ID_WMV2,
VIDEO_ES, "Windows Media Video 2" },
#if LIBAVCODEC_BUILD >= ((51<<16)+(10<<8)+1)
{ VLC_FOURCC('w','m','v','2'), CODEC_ID_WMV2,
VIDEO_ES, "Windows Media Video 2" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(10<<8)+1)
{ VLC_FOURCC('W','M','V','3'), CODEC_ID_WMV3,
VIDEO_ES, "Windows Media Video 3" },
{ VLC_FOURCC('w','m','v','3'), CODEC_ID_WMV3,
VIDEO_ES, "Windows Media Video 3" },
{ VLC_FOURCC('W','V','C','1'), CODEC_ID_VC1,
VIDEO_ES, "Windows Media Video VC1" },
#endif
#if 0
{ VLC_FOURCC('w','v','c','1'), CODEC_ID_VC1,
VIDEO_ES, "Windows Media Video VC1" },
/* WMVA is the VC-1 codec before the standardization proces,
it is not bitstream compatible and deprecated */
{ VLC_FOURCC('W','M','V','A'), CODEC_ID_VC1,
VIDEO_ES, "Windows Media Video Advanced Profile" },
#endif
#if LIBAVCODEC_BUILD >= 4683
/* Microsoft Video 1 */
{ VLC_FOURCC('M','S','V','C'), CODEC_ID_MSVIDEO1,
VIDEO_ES, "Microsoft Video 1" },
......@@ -771,9 +937,12 @@ static struct
/* Microsoft RLE */
{ VLC_FOURCC('m','r','l','e'), CODEC_ID_MSRLE,
VIDEO_ES, "Microsoft RLE Video" },
{ VLC_FOURCC('W','R','L','E'), CODEC_ID_MSRLE,
VIDEO_ES, "Microsoft RLE Video" },
{ VLC_FOURCC(0x1,0x0,0x0,0x0), CODEC_ID_MSRLE,
VIDEO_ES, "Microsoft RLE Video" },
#endif
{ VLC_FOURCC(0x2,0x0,0x0,0x0), CODEC_ID_MSRLE,
VIDEO_ES, "Microsoft RLE Video" },
/* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
{ VLC_FOURCC('I','V','3','1'), CODEC_ID_INDEO3,
......@@ -785,18 +954,17 @@ static struct
{ VLC_FOURCC('i','v','3','2'), CODEC_ID_INDEO3,
VIDEO_ES, "Indeo Video v3" },
#if LIBAVCODEC_BUILD >= 4721
{ VLC_FOURCC('t','s','c','c'), CODEC_ID_TSCC,
VIDEO_ES, "TechSmith Camtasia Screen Capture Video" },
#endif
/* Huff YUV */
{ VLC_FOURCC('H','F','Y','U'), CODEC_ID_HUFFYUV,
VIDEO_ES, "Huff YUV Video" },
{ VLC_FOURCC('F','F','V','H'), CODEC_ID_FFVHUFF,
VIDEO_ES, "Huff YUV Video" },
/* Creative YUV */
{ VLC_FOURCC('C','Y','U','V'), CODEC_ID_CYUV,
VIDEO_ES, "Creative YUV Video" },
{ VLC_FOURCC('c','y','u','v'), CODEC_ID_CYUV,
VIDEO_ES, "Creative YUV Video" },
/* On2 VP3 Video Codecs */
{ VLC_FOURCC('V','P','3',' '), CODEC_ID_VP3,
......@@ -808,7 +976,8 @@ static struct
{ VLC_FOURCC('v','p','3','1'), CODEC_ID_VP3,
VIDEO_ES, "On2's VP3 Video" },
#if LIBAVCODEC_BUILD >= ((51<<16)+(14<<8)+0)
/* On2 VP5, VP6 codecs */
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(14<<8)+0)
{ VLC_FOURCC('V','P','5',' '), CODEC_ID_VP5,
VIDEO_ES, "On2's VP5 Video" },
{ VLC_FOURCC('V','P','5','0'), CODEC_ID_VP5,
......@@ -828,11 +997,16 @@ static struct
VIDEO_ES, "On2's VP6.1 Video" },
#endif
#if LIBAVCODEC_BUILD >= 4685
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(47<<8)+0)
{ VLC_FOURCC('V','P','6','A'), CODEC_ID_VP6A,
VIDEO_ES, "On2's VP6 A Video" },
#endif
/* Xiph.org theora */
{ VLC_FOURCC('t','h','e','o'), CODEC_ID_THEORA,
VIDEO_ES, "Xiph.org's Theora Video" },
#endif
{ VLC_FOURCC('T','h','r','a'), CODEC_ID_THEORA,
VIDEO_ES, "Xiph.org's Theora Video" },
#if ( !defined( WORDS_BIGENDIAN ) )
/* Asus Video (Another thing that doesn't work on PPC) */
......@@ -857,39 +1031,62 @@ static struct
/* Real Video */
{ VLC_FOURCC('R','V','1','0'), CODEC_ID_RV10,
VIDEO_ES, "Real Video 10" },
{ VLC_FOURCC('r','v','1','0'), CODEC_ID_RV10,
VIDEO_ES, "Real Video 10" },
{ VLC_FOURCC('R','V','1','3'), CODEC_ID_RV10,
VIDEO_ES, "Real Video 13" },
#if LIBAVCODEC_BUILD >= ((51<<16)+(15<<8)+1)
{ VLC_FOURCC('r','v','1','3'), CODEC_ID_RV10,
VIDEO_ES, "Real Video 13" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(15<<8)+1)
{ VLC_FOURCC('R','V','2','0'), CODEC_ID_RV20,
VIDEO_ES, "Real Video 20" },
#endif
#if LIBAVCODEC_BUILD >= 4684
/* Apple Video */
{ VLC_FOURCC('r','p','z','a'), CODEC_ID_RPZA,
VIDEO_ES, "Apple Video" },
{ VLC_FOURCC('a','z','p','r'), CODEC_ID_RPZA,
VIDEO_ES, "Apple Video" },
{ VLC_FOURCC('s','m','c',' '), CODEC_ID_SMC,
VIDEO_ES, "Apple graphics" },
/* Cinepak */
/* CINEPAK. We have our own decoder with an higher priority,
but this can't harm */
{ VLC_FOURCC('C','V','I','D'), CODEC_ID_CINEPAK,
VIDEO_ES, "Cinepak Video" },
{ VLC_FOURCC('c','v','i','d'), CODEC_ID_CINEPAK,
VIDEO_ES, "Cinepak Video" },
/* Id Quake II CIN */
{ VLC_FOURCC('I','D','C','I'), CODEC_ID_IDCIN,
VIDEO_ES, "Id Quake II CIN Video" },
#endif
/* Screen Capture Video Codecs */
{ VLC_FOURCC('t','s','c','c'), CODEC_ID_TSCC,
VIDEO_ES, "TechSmith Camtasia Screen Capture Video" },
{ VLC_FOURCC('T','S','C','C'), CODEC_ID_TSCC,
VIDEO_ES, "TechSmith Camtasia Screen Capture Video" },
/* 4X Technologies */
{ VLC_FOURCC('4','x','m','v'), CODEC_ID_4XM,
VIDEO_ES, "4X Technologies Video" },
{ VLC_FOURCC('C','S','C','D'), CODEC_ID_CSCD,
VIDEO_ES, "CamStudio Screen Codec" },
{ VLC_FOURCC('c','s','c','d'), CODEC_ID_CSCD,
VIDEO_ES, "CamStudio Screen Codec" },
{ VLC_FOURCC('Z','M','B','V'), CODEC_ID_ZMBV,
VIDEO_ES, "DosBox Capture Codec" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(13<<8)+0)
{ VLC_FOURCC('V','M','n','c'), CODEC_ID_VMNC,
VIDEO_ES, "VMware Video" },
#endif
{ VLC_FOURCC('F','P','S','1'), CODEC_ID_FRAPS,
VIDEO_ES, "FRAPS: Realtime Video Capture" },
{ VLC_FOURCC('f','p','s','1'), CODEC_ID_FRAPS,
VIDEO_ES, "FRAPS: Realtime Video Capture" },
#if LIBAVCODEC_BUILD >= 4694
/* Duck TrueMotion */
{ VLC_FOURCC('D','U','C','K'), CODEC_ID_TRUEMOTION1,
VIDEO_ES, "Duck TrueMotion v1 Video" },
#endif
{ VLC_FOURCC('T','M','2','0'), CODEC_ID_TRUEMOTION2,
VIDEO_ES, "Duck TrueMotion v2.0 Video" },
/* Interplay MVE */
{ VLC_FOURCC('i','m','v','e'), CODEC_ID_INTERPLAY_VIDEO,
......@@ -903,19 +1100,16 @@ static struct
{ VLC_FOURCC('M','D','E','C'), CODEC_ID_MDEC,
VIDEO_ES, "PSX MDEC Video" },
#if LIBAVCODEC_BUILD >= 4699
/* Sierra VMD */
{ VLC_FOURCC('v','m','d','v'), CODEC_ID_VMDVIDEO,
VIDEO_ES, "Sierra VMD Video" },
#endif
#if LIBAVCODEC_BUILD >= 4719
/* FFMPEG's SNOW wavelet codec */
{ VLC_FOURCC('S','N','O','W'), CODEC_ID_SNOW,
VIDEO_ES, "FFMpeg SNOW wavelet Video" },
#endif
{ VLC_FOURCC('s','n','o','w'), CODEC_ID_SNOW,
VIDEO_ES, "FFMpeg SNOW wavelet Video" },
#if LIBAVCODEC_BUILD >= 4752
{ VLC_FOURCC('r','l','e',' '), CODEC_ID_QTRLE,
VIDEO_ES, "Apple QuickTime RLE Video" },
......@@ -934,6 +1128,8 @@ static struct
{ VLC_FOURCC('V','I','X','L'), CODEC_ID_VIXL,
VIDEO_ES, "Miro/Pinnacle VideoXL Video" },
{ VLC_FOURCC('P','I','X','L'), CODEC_ID_VIXL,
VIDEO_ES, "Pinnacle VideoXL Video" },
{ VLC_FOURCC('L','O','C','O'), CODEC_ID_LOCO,
VIDEO_ES, "LOCO Video" },
......@@ -943,25 +1139,113 @@ static struct
{ VLC_FOURCC('A','A','S','C'), CODEC_ID_AASC,
VIDEO_ES, "Autodesc RLE Video" },
#endif
#if LIBAVCODEC_BUILD >= 4753
{ VLC_FOURCC('I','V','2','0'), CODEC_ID_INDEO2,
VIDEO_ES, "Indeo Video v2" },
{ VLC_FOURCC('R','T','2','1'), CODEC_ID_INDEO2,
VIDEO_ES, "Indeo Video v2" },
/* Flash Screen Video */
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(11<<8)+0)
{ VLC_FOURCC('F','S','V','1'), CODEC_ID_FLASHSV,
VIDEO_ES, "Flash Screen Video" },
#endif
{ VLC_FOURCC('K','M','V','C'), CODEC_ID_KMVC,
VIDEO_ES, "Karl Morton's Video Codec (Worms)" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(13<<8)+0)
{ VLC_FOURCC('N','U','V','1'), CODEC_ID_NUV,
VIDEO_ES, "Nuppel Video" },
{ VLC_FOURCC('R','J','P','G'), CODEC_ID_NUV,
VIDEO_ES, "Nuppel Video" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(8<<8)+0)
/* CODEC_ID_SMACKVIDEO */
{ VLC_FOURCC('S','M','K','2'), CODEC_ID_SMACKVIDEO,
VIDEO_ES, "Smacker Video" },
{ VLC_FOURCC('S','M','K','4'), CODEC_ID_SMACKVIDEO,
VIDEO_ES, "Smacker Video" },
#endif
/* Chinese AVS - Untested */
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(8<<8)+0)
{ VLC_FOURCC('C','A','V','S'), CODEC_ID_CAVS,
VIDEO_ES, "Chinese AVS" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+0)
/* Untested yet */
{ VLC_FOURCC('A','V','d','n'), CODEC_ID_DNXHD,
VIDEO_ES, "DNxHD" },
#endif
{ VLC_FOURCC('8','B','P','S'), CODEC_ID_8BPS,
VIDEO_ES, "8BPS" },
/* Videogames Codecs */
/* Interplay MVE */
{ VLC_FOURCC('i','m','v','e'), CODEC_ID_INTERPLAY_VIDEO,
VIDEO_ES, "Interplay MVE Video" },
{ VLC_FOURCC('I','N','P','V'), CODEC_ID_INTERPLAY_VIDEO,
VIDEO_ES, "Interplay MVE Video" },
/* Id Quake II CIN */
{ VLC_FOURCC('I','D','C','I'), CODEC_ID_IDCIN,
VIDEO_ES, "Id Quake II CIN Video" },
/* 4X Technologies */
{ VLC_FOURCC('4','x','m','v'), CODEC_ID_4XM,
VIDEO_ES, "4X Technologies Video" },
{ VLC_FOURCC('4','X','M','V'), CODEC_ID_4XM,
VIDEO_ES, "4X Technologies Video" },
/* Id RoQ */
{ VLC_FOURCC('R','o','Q','v'), CODEC_ID_ROQ,
VIDEO_ES, "Id RoQ Video" },
/* Sony Playstation MDEC */
{ VLC_FOURCC('M','D','E','C'), CODEC_ID_MDEC,
VIDEO_ES, "PSX MDEC Video" },
/* Sierra VMD */
{ VLC_FOURCC('v','m','d','v'), CODEC_ID_VMDVIDEO,
VIDEO_ES, "Sierra VMD Video" },
{ VLC_FOURCC('V','M','D','V'), CODEC_ID_VMDVIDEO,
VIDEO_ES, "Sierra VMD Video" },
#if 0
/* UNTESTED VideoGames*/
{ VLC_FOURCC('W','C','3','V'), CODEC_ID_XAN_WC3,
VIDEO_ES, "XAN wc3 Video" },
{ VLC_FOURCC('W','C','4','V'), CODEC_ID_XAN_WC4,
VIDEO_ES, "XAN wc4 Video" },
{ VLC_FOURCC('S','T','3','C'), CODEC_ID_TXD,
VIDEO_ES, "Renderware TeXture Dictionary" },
{ VLC_FOURCC('V','Q','A','V'), CODEC_ID_WS_VQA,
VIDEO_ES, "WestWood Vector Quantized Animation" },
{ VLC_FOURCC('T','S','E','Q'), CODEC_ID_TIERTEXSEQVIDEO,
VIDEO_ES, "Tiertex SEQ Video" },
{ VLC_FOURCC('D','X','A','1'), CODEC_ID_DXA,
VIDEO_ES, "Feeble DXA Video" },
{ VLC_FOURCC('D','C','I','V'), CODEC_ID_DSICINVIDEO,
VIDEO_ES, "Delphine CIN Video" },
{ VLC_FOURCC('T','H','P','V'), CODEC_ID_THP,
VIDEO_ES, "THP Video" },
{ VLC_FOURCC('B','E','T','H'), CODEC_ID_BETHSOFTVID,
VIDEO_ES, "THP Video" },
{ VLC_FOURCC('C','9','3','V'), CODEC_ID_C93,
VIDEO_ES, "THP Video" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(13<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(13<<8)+0)
{ VLC_FOURCC('V','M','n','c'), CODEC_ID_VMNC,
VIDEO_ES, "VMware Video" },
#endif
/*
* Image codecs
*/
#if LIBAVCODEC_BUILD >= 4731
{ VLC_FOURCC('p','n','g',' '), CODEC_ID_PNG,
VIDEO_ES, "PNG Image" },
{ VLC_FOURCC('p','p','m',' '), CODEC_ID_PPM,
......@@ -972,13 +1256,31 @@ static struct
VIDEO_ES, "PGM YUV Image" },
{ VLC_FOURCC('p','a','m',' '), CODEC_ID_PAM,
VIDEO_ES, "PAM Image" },
#endif
{ VLC_FOURCC('M','J','L','S'), CODEC_ID_JPEGLS,
VIDEO_ES, "PAM Image" },
#if LIBAVCODEC_BUILD >= ((51<<16)+(0<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(0<<8)+0)
{ VLC_FOURCC('b','m','p',' '), CODEC_ID_BMP,
VIDEO_ES, "BMP Image" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+1)
{ VLC_FOURCC('t','i','f','f'), CODEC_ID_TIFF,
VIDEO_ES, "TIFF Image" },
{ VLC_FOURCC('g','i','f',' '), CODEC_ID_GIF,
VIDEO_ES, "GIF Image" },
{ VLC_FOURCC('t','g','a',' '), CODEC_ID_TARGA,
VIDEO_ES, "Truevision Targa Image" },
{ VLC_FOURCC('m','t','g','a'), CODEC_ID_TARGA,
VIDEO_ES, "Truevision Targa Image" },
{ VLC_FOURCC('M','T','G','A'), CODEC_ID_TARGA,
VIDEO_ES, "Truevision Targa Image" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+3)
{ VLC_FOURCC('s','g','i',' '), CODEC_ID_SGI,
VIDEO_ES, "SGI Image" },
#endif
/*
* Audio Codecs
*/
......@@ -1007,6 +1309,12 @@ static struct
{ VLC_FOURCC('M','A','C','6'), CODEC_ID_MACE6,
AUDIO_ES, "MACE-6 Audio" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(41<<8)+1)
/* MUSEPACK7 Audio */
{ VLC_FOURCC('M','P','C',' '), CODEC_ID_MUSEPACK7,
AUDIO_ES, "MUSEPACK7 Audio" },
#endif
/* RealAudio 1.0 */
{ VLC_FOURCC('1','4','_','4'), CODEC_ID_RA_144,
AUDIO_ES, "RealAudio 1.0" },
......@@ -1020,6 +1328,12 @@ static struct
AUDIO_ES, "MPEG Audio layer 1/2" },
{ VLC_FOURCC('m','p','3',' '), CODEC_ID_MP3,
AUDIO_ES, "MPEG Audio layer 1/2/3" },
{ VLC_FOURCC('.','m','p','3'), CODEC_ID_MP3,
AUDIO_ES, "MPEG Audio layer 1/2/3" },
{ VLC_FOURCC('M','P','3',' '), CODEC_ID_MP3,
AUDIO_ES, "MPEG Audio layer 1/2/3" },
{ VLC_FOURCC('L','A','M','E'), CODEC_ID_MP3,
AUDIO_ES, "MPEG Audio layer 1/2/3" },
/* A52 Audio (aka AC3) */
{ VLC_FOURCC('a','5','2',' '), CODEC_ID_AC3,
......@@ -1027,11 +1341,9 @@ static struct
{ VLC_FOURCC('a','5','2','b'), CODEC_ID_AC3, /* VLC specific hack */
AUDIO_ES, "A52 Audio (aka AC3)" },
#if LIBAVCODEC_BUILD >= 4719
/* DTS Audio */
{ VLC_FOURCC('d','t','s',' '), CODEC_ID_DTS,
AUDIO_ES, "DTS Audio" },
#endif
/* AAC audio */
{ VLC_FOURCC('m','p','4','a'), CODEC_ID_AAC,
......@@ -1041,6 +1353,10 @@ static struct
{ VLC_FOURCC('4','x','m','a'), CODEC_ID_ADPCM_4XM,
AUDIO_ES, "4X Technologies Audio" },
/* EA ADPCM */
{ VLC_FOURCC('A','D','E','A'), CODEC_ID_ADPCM_EA,
AUDIO_ES, "EA ADPCM Audio" },
/* Interplay DPCM */
{ VLC_FOURCC('i','d','p','c'), CODEC_ID_INTERPLAY_DPCM,
AUDIO_ES, "Interplay DPCM Audio" },
......@@ -1049,7 +1365,12 @@ static struct
{ VLC_FOURCC('R','o','Q','a'), CODEC_ID_ROQ_DPCM,
AUDIO_ES, "Id RoQ DPCM Audio" },
#if LIBAVCODEC_BUILD >= 4685
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(27<<8)+0)
/* DCIN Audio */
{ VLC_FOURCC('D','C','I','A'), CODEC_ID_DSICINAUDIO,
AUDIO_ES, "Delphine CIN Audio" },
#endif
/* Sony Playstation XA ADPCM */
{ VLC_FOURCC('x','a',' ',' '), CODEC_ID_ADPCM_XA,
AUDIO_ES, "PSX XA ADPCM Audio" },
......@@ -1057,68 +1378,96 @@ static struct
/* ADX ADPCM */
{ VLC_FOURCC('a','d','x',' '), CODEC_ID_ADPCM_ADX,
AUDIO_ES, "ADX ADPCM Audio" },
#endif
#if LIBAVCODEC_BUILD >= 4699
/* Westwood ADPCM */
{ VLC_FOURCC('A','I','W','S'), CODEC_ID_ADPCM_IMA_WS,
AUDIO_ES, "Westwood IMA ADPCM audio" },
/* Sierra VMD */
{ VLC_FOURCC('v','m','d','a'), CODEC_ID_VMDAUDIO,
AUDIO_ES, "Sierra VMD Audio" },
#endif
#if LIBAVCODEC_BUILD >= 4706
/* G.726 ADPCM */
{ VLC_FOURCC('g','7','2','6'), CODEC_ID_ADPCM_G726,
AUDIO_ES, "G.726 ADPCM Audio" },
#endif
#if LIBAVCODEC_BUILD >= 4683
/* AMR */
{ VLC_FOURCC('s','a','m','r'), CODEC_ID_AMR_NB,
AUDIO_ES, "AMR narrow band" },
{ VLC_FOURCC('s','a','w','b'), CODEC_ID_AMR_WB,
AUDIO_ES, "AMR wide band" },
#endif
#if LIBAVCODEC_BUILD >= 4703
/* FLAC */
{ VLC_FOURCC('f','l','a','c'), CODEC_ID_FLAC,
AUDIO_ES, "FLAC (Free Lossless Audio Codec)" },
#endif
#if LIBAVCODEC_BUILD >= 4745
/* ALAC */
{ VLC_FOURCC('a','l','a','c'), CODEC_ID_ALAC,
AUDIO_ES, "Apple Lossless Audio Codec" },
#endif
#if LIBAVCODEC_BUILD >= ((50<<16)+(0<<8)+1)
#if LIBAVCODEC_VERSION_INT >= ((50<<16)+(0<<8)+1)
/* QDM2 */
{ VLC_FOURCC('Q','D','M','2'), CODEC_ID_QDM2,
AUDIO_ES, "QDM2 Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(0<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(0<<8)+0)
/* COOK */
{ VLC_FOURCC('c','o','o','k'), CODEC_ID_COOK,
AUDIO_ES, "Cook Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(4<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(4<<8)+0)
/* TTA: The Lossless True Audio */
{ VLC_FOURCC('T','T','A','1'), CODEC_ID_TTA,
AUDIO_ES, "The Lossless True Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(8<<8)+0)
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(8<<8)+0)
/* Shorten */
{ VLC_FOURCC('s','h','n',' '), CODEC_ID_SHORTEN,
AUDIO_ES, "Shorten Lossless Audio" },
{ VLC_FOURCC('s','h','r','n'), CODEC_ID_SHORTEN,
AUDIO_ES, "Shorten Lossless Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(16<<8)+0)
/* WavPack */
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(16<<8)+0)
{ VLC_FOURCC('w','v','p','k'), CODEC_ID_WAVPACK,
AUDIO_ES, "WavPack" },
{ VLC_FOURCC('W','V','P','K'), CODEC_ID_WAVPACK,
AUDIO_ES, "WavPack Lossless Audio" },
AUDIO_ES, "WavPack" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(34<<8)+0)
{ VLC_FOURCC('g','s','m',' '), CODEC_ID_GSM,
AUDIO_ES, "GSM Audio" },
{ VLC_FOURCC('g','s','m','s'), CODEC_ID_GSM_MS,
AUDIO_ES, "Microsoft GSM Audio" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
{ VLC_FOURCC('a','t','r','c'), CODEC_ID_ATRAC3,
AUDIO_ES, "atrac 3" },
{ VLC_FOURCC(0x70,0x2,0x0,0x0), CODEC_ID_ATRAC3,
AUDIO_ES, "atrac 3" },
#endif
{ VLC_FOURCC('S','O','N','C'), CODEC_ID_SONIC,
AUDIO_ES, "Sonic" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(34<<8)+0)
{ VLC_FOURCC(0x1,0x4,0x0,0x0), CODEC_ID_IMC,
AUDIO_ES, "IMC" },
#endif
{ VLC_FOURCC(0x22,0x0,0x0,0x0), CODEC_ID_TRUESPEECH,
AUDIO_ES, "TrueSpeech" },
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(46<<8)+0)
{ VLC_FOURCC('N','E','L','L'), CODEC_ID_NELLYMOSER,
AUDIO_ES, "NellyMoser ASAO" },
#endif
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(44<<8)+0)
{ VLC_FOURCC('A','P','E',' '), CODEC_ID_APE,
AUDIO_ES, "Monkey's Audio" },
#endif
/* PCM */
......@@ -1154,8 +1503,10 @@ static struct
AUDIO_ES, "PCM ALAW" },
{ VLC_FOURCC('u','l','a','w'), CODEC_ID_PCM_MULAW,
AUDIO_ES, "PCM ULAW" },
{ VLC_FOURCC('d','a','u','d'), CODEC_ID_PCM_S24DAUD,
AUDIO_ES, "PCM ULAW" },
{0}
{ 0, 0, 0, 0 }
};
int E_(GetFfmpegCodec)( vlc_fourcc_t i_fourcc, int *pi_cat,
......@@ -1169,7 +1520,7 @@ int E_(GetFfmpegCodec)( vlc_fourcc_t i_fourcc, int *pi_cat,
{
if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
if( pi_ffmpeg_codec ) *pi_ffmpeg_codec = codecs_table[i].i_codec;
if( ppsz_name ) *ppsz_name = codecs_table[i].psz_name;
if( ppsz_name ) *ppsz_name = (char *) codecs_table[i].psz_name;
return VLC_TRUE;
}
......
......@@ -2,7 +2,7 @@
* ffmpeg.h: decoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 2001 the VideoLAN team
* $Id$
* $Id: f2ea5ef3a73821145591172cfb79c3d8813f66ad $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -23,12 +23,6 @@
#include "codecs.h" /* BITMAPINFOHEADER */
#if LIBAVCODEC_BUILD >= 4663
# define LIBAVCODEC_PP
#else
# undef LIBAVCODEC_PP
#endif
struct picture_t;
struct AVFrame;
struct AVCodecContext;
......@@ -78,6 +72,8 @@ int E_(OpenCropPadd)( vlc_object_t * );
void E_(CloseFilter)( vlc_object_t * );
int E_(OpenDeinterlace)( vlc_object_t * );
void E_(CloseDeinterlace)( vlc_object_t * );
int E_(OpenScaler)( vlc_object_t * );
void E_(CloseScaler)( vlc_object_t * );
/* Postprocessing module */
void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
......@@ -297,3 +293,6 @@ N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...
#define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
"the PSNR isn't much changed (default: 0.0). The H264 specification " \
"recommends 7." )
#define SCALEMODE_TEXT N_("Scaling mode")
#define SCALEMODE_LONGTEXT N_("Scaling mode to use.")
......@@ -2,7 +2,7 @@
* postprocess.c: video postprocessing using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id: 2c9471842b31cdcdd4bfad33cff706829f7d72e9 $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -35,8 +35,6 @@
#include "ffmpeg.h"
#ifdef LIBAVCODEC_PP
#ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
#else
......@@ -265,5 +263,3 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
#endif /* LIBAVCODEC_PP */
/*****************************************************************************
* filter.c: video scaling module using the swscale library
*****************************************************************************
* Copyright (C) 2003 the VideoLAN team
* $Id$
*
* Author: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc_codec.h>
#include <vlc_filter.h>
#include <vlc_cpu.h>
/* ffmpeg headers */
#ifdef HAVE_FFMPEG_AVCODEC_H
# include <ffmpeg/avcodec.h>
#else
# include <avcodec.h>
#endif
#ifdef HAVE_FFMPEG_SWSCALE_H
# include <ffmpeg/swscale.h>
#elif defined(HAVE_LIBSWSCALE_TREE)
# include <swscale.h>
#endif
#include "ffmpeg.h"
/* Version checking */
#if ( (defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)) && (LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0)) )
/*****************************************************************************
* filter_sys_t : filter descriptor
*****************************************************************************/
struct filter_sys_t
{
struct SwsContext *ctx;
SwsFilter *p_src_filter;
SwsFilter *p_dst_filter;
int i_cpu_mask, i_sws_flags;
es_format_t fmt_in;
es_format_t fmt_out;
};
/****************************************************************************
* Local prototypes
****************************************************************************/
void *( *swscale_fast_memcpy )( void *, const void *, size_t );
static picture_t *Filter( filter_t *, picture_t * );
static int CheckInit( filter_t * );
static const char *ppsz_mode_descriptions[] =
{ N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"),
N_("Experimental"), N_("Nearest neighbour (bad quality)"),
N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),
N_("SincR"), N_("Lanczos"), N_("Bicubic spline") };
/*****************************************************************************
* OpenScaler: probe the filter and return score
*****************************************************************************/
int E_(OpenScaler)( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys;
vlc_value_t val;
int i_fmt_in, i_fmt_out;
unsigned int i_cpu;
int i_sws_mode;
float sws_lum_gblur = 0.0, sws_chr_gblur = 0.0;
int sws_chr_vshift = 0, sws_chr_hshift = 0;
float sws_chr_sharpen = 0.0, sws_lum_sharpen = 0.0;
/* Supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24,
* BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09 */
i_fmt_in = E_(GetFfmpegChroma)(p_filter->fmt_in.video.i_chroma);
/* Supported output formats: YV12, I420/IYUV, YUY2, UYVY,
* {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09 */
i_fmt_out = E_(GetFfmpegChroma)(p_filter->fmt_out.video.i_chroma);
if( ( i_fmt_in < 0 ) || ( i_fmt_out < 0 ) )
{
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the decoder's structure */
if( ( p_filter->p_sys = p_sys =
(filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
swscale_fast_memcpy = p_filter->p_vlc->pf_memcpy;
/* Set CPU capabilities */
i_cpu = CPUCapabilities();
p_sys->i_cpu_mask = 0;
if( i_cpu & CPU_CAPABILITY_MMX )
{
p_sys->i_cpu_mask |= SWS_CPU_CAPS_MMX;
}
if( i_cpu & CPU_CAPABILITY_MMXEXT )
{
p_sys->i_cpu_mask |= SWS_CPU_CAPS_MMX2;
}
if( i_cpu & CPU_CAPABILITY_3DNOW )
{
p_sys->i_cpu_mask |= SWS_CPU_CAPS_3DNOW;
}
if( i_cpu & CPU_CAPABILITY_ALTIVEC )
{
p_sys->i_cpu_mask |= SWS_CPU_CAPS_ALTIVEC;
}
var_Create( p_filter, "swscale-mode", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Get( p_filter, "swscale-mode", &val );
i_sws_mode = val.i_int;
switch( i_sws_mode )
{
case 0: p_sys->i_sws_flags = SWS_FAST_BILINEAR; break;
case 1: p_sys->i_sws_flags = SWS_BILINEAR; break;
case 2: p_sys->i_sws_flags = SWS_BICUBIC; break;
case 3: p_sys->i_sws_flags = SWS_X; break;
case 4: p_sys->i_sws_flags = SWS_POINT; break;
case 5: p_sys->i_sws_flags = SWS_AREA; break;
case 6: p_sys->i_sws_flags = SWS_BICUBLIN; break;
case 7: p_sys->i_sws_flags = SWS_GAUSS; break;
case 8: p_sys->i_sws_flags = SWS_SINC; break;
case 9: p_sys->i_sws_flags = SWS_LANCZOS; break;
case 10: p_sys->i_sws_flags = SWS_SPLINE; break;
default: p_sys->i_sws_flags = SWS_FAST_BILINEAR; i_sws_mode = 0; break;
}
p_sys->p_src_filter = NULL;
p_sys->p_dst_filter = NULL;
p_sys->p_src_filter =
sws_getDefaultFilter( sws_lum_gblur, sws_chr_gblur,
sws_lum_sharpen, sws_chr_sharpen,
sws_chr_hshift, sws_chr_vshift, 0 );
/* Misc init */
p_sys->ctx = NULL;
p_filter->pf_video_filter = Filter;
es_format_Init( &p_sys->fmt_in, 0, 0 );
es_format_Init( &p_sys->fmt_out, 0, 0 );
if( CheckInit( p_filter ) != VLC_SUCCESS )
{
if( p_sys->p_src_filter ) sws_freeFilter( p_sys->p_src_filter );
free( p_sys );
return VLC_EGENERIC;
}
msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s",
p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height,
(char *)&p_filter->fmt_in.video.i_chroma,
p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height,
(char *)&p_filter->fmt_out.video.i_chroma );
if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width ||
p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
{
msg_Dbg( p_filter, "scaling mode: %s",
ppsz_mode_descriptions[i_sws_mode] );
}
return VLC_SUCCESS;
}
/*****************************************************************************
* CloseFilter: clean up the filter
*****************************************************************************/
void E_(CloseScaler)( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
if( p_sys->ctx ) sws_freeContext( p_sys->ctx );
if( p_sys->p_src_filter ) sws_freeFilter( p_sys->p_src_filter );
free( p_sys );
}
/*****************************************************************************
* CheckInit: Initialise filter when necessary
*****************************************************************************/
static int CheckInit( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
if( ( p_filter->fmt_in.video.i_width != p_sys->fmt_in.video.i_width ) ||
( p_filter->fmt_in.video.i_height != p_sys->fmt_in.video.i_height ) ||
( p_filter->fmt_out.video.i_width != p_sys->fmt_out.video.i_width ) ||
( p_filter->fmt_out.video.i_height != p_sys->fmt_out.video.i_height ) )
{
int i_fmt_in, i_fmt_out;
i_fmt_in = E_(GetFfmpegChroma)(p_filter->fmt_in.video.i_chroma);
i_fmt_out = E_(GetFfmpegChroma)(p_filter->fmt_out.video.i_chroma);
if( (i_fmt_in < 0 ) || ( i_fmt_out < 0 ) )
{
msg_Err( p_filter, "format not supported" );
return VLC_EGENERIC;
}
if( p_sys->ctx ) sws_freeContext( p_sys->ctx );
p_sys->ctx =
sws_getContext( p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height, i_fmt_in,
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height, i_fmt_out,
p_sys->i_sws_flags | p_sys->i_cpu_mask,
p_sys->p_src_filter, p_sys->p_dst_filter, 0 );
if( !p_sys->ctx )
{
msg_Err( p_filter, "could not init SwScaler" );
return VLC_EGENERIC;
}
p_sys->fmt_in = p_filter->fmt_in;
p_sys->fmt_out = p_filter->fmt_out;
}
return VLC_SUCCESS;
}
/****************************************************************************
* Filter: the whole thing
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
uint8_t *src[3]; int src_stride[3];
uint8_t *dst[3]; int dst_stride[3];
picture_t *p_pic_dst;
int i_plane;
int i_nb_planes = p_pic->i_planes;
/* Check if format properties changed */
if( CheckInit( p_filter ) != VLC_SUCCESS ) return NULL;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','V','A') )
{
i_nb_planes = 3;
memset( p_pic_dst->p[3].p_pixels, 0xff, p_filter->fmt_out.video.i_height
* p_pic_dst->p[3].i_pitch );
}
for( i_plane = 0; i_plane < __MIN(3, p_pic->i_planes); i_plane++ )
{
src[i_plane] = p_pic->p[i_plane].p_pixels;
src_stride[i_plane] = p_pic->p[i_plane].i_pitch;
}
for( i_plane = 0; i_plane < __MIN(3, i_nb_planes); i_plane++ )
{
dst[i_plane] = p_pic_dst->p[i_plane].p_pixels;
dst_stride[i_plane] = p_pic_dst->p[i_plane].i_pitch;
}
#if LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0)
sws_scale( p_sys->ctx, src, src_stride,
0, p_filter->fmt_in.video.i_height,
dst, dst_stride );
#else
sws_scale_ordered( p_sys->ctx, src, src_stride,
0, p_filter->fmt_in.video.i_height,
dst, dst_stride );
#endif
p_pic_dst->date = p_pic->date;
p_pic_dst->b_force = p_pic->b_force;
p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
p_pic_dst->b_progressive = p_pic->b_progressive;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
p_pic->pf_release( p_pic );
return p_pic_dst;
}
#else /* LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0) */
int E_(OpenScaler)( vlc_object_t *p_this )
{
return VLC_EGENERIC;
}
void E_(CloseScaler)( vlc_object_t *p_this )
{
}
#endif /* LIBSWSCALE_VERSION_INT >= ((0<<16)+(5<<8)+0) */
......@@ -2,7 +2,7 @@
* video.c: video decoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id: 5376a0d2d02a3ecdf7cb2c4c200d5749e803182b $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@videolan.org>
......@@ -130,6 +130,8 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
return VLC_FOURCC('R','V','2','4');
case PIX_FMT_RGBA32:
return VLC_FOURCC('R','V','3','2');
case PIX_FMT_RGBA:
return VLC_FOURCC('R','G','B','A');
case PIX_FMT_GRAY8:
return VLC_FOURCC('G','R','E','Y');
......@@ -170,16 +172,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
}
else
{
#if LIBAVCODEC_BUILD >= 4687
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height );
p_dec->fmt_out.video.i_sar_num = p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den = p_context->sample_aspect_ratio.den;
#else
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
#endif
if( p_dec->fmt_out.video.i_aspect == 0 )
{
p_dec->fmt_out.video.i_aspect =
......@@ -195,31 +193,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_dec->fmt_out.video.i_frame_rate_base =
p_dec->fmt_in.video.i_frame_rate_base;
}
else
#if LIBAVCODEC_BUILD >= 4754
if( p_context->time_base.num > 0 && p_context->time_base.den > 0 )
else if( p_context->time_base.num > 0 && p_context->time_base.den > 0 )
{
p_dec->fmt_out.video.i_frame_rate = p_context->time_base.den;
p_dec->fmt_out.video.i_frame_rate_base = p_context->time_base.num;
}
#else
if( p_context->frame_rate > 0 && p_context->frame_rate_base > 0 )
{
p_dec->fmt_out.video.i_frame_rate = p_context->frame_rate;
p_dec->fmt_out.video.i_frame_rate_base = p_context->frame_rate_base;
}
#endif
p_pic = p_dec->pf_vout_buffer_new( p_dec );
#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init )
{
E_(InitPostproc)( p_dec, p_sys->p_pp, p_context->width,
p_context->height, p_context->pix_fmt );
p_sys->b_pp_init = VLC_TRUE;
}
#endif
return p_pic;
}
......@@ -271,25 +258,19 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
var_Create( p_dec, "ffmpeg-vismv", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-vismv", &val );
#if LIBAVCODEC_BUILD >= 4698
if( val.i_int ) p_sys->p_context->debug_mv = val.i_int;
#endif
var_Create( p_dec, "ffmpeg-lowres", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-lowres", &val );
#if LIBAVCODEC_BUILD >= 4723
if( val.i_int > 0 && val.i_int <= 2 ) p_sys->p_context->lowres = val.i_int;
#endif
var_Create( p_dec, "ffmpeg-skiploopfilter",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-skiploopfilter", &val );
#if LIBAVCODEC_BUILD >= 4758
if( val.i_int > 0 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF;
if( val.i_int > 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR;
if( val.i_int > 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
if( val.i_int > 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
#endif
/* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......@@ -305,22 +286,16 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
/* H264 uses too many reference frames */
p_sys->i_codec_id != CODEC_ID_H264 &&
#if LIBAVCODEC_BUILD >= 4698
!p_sys->p_context->debug_mv )
#else
1 )
#endif
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
* so we need to do another check in ffmpeg_GetFrameBuf() */
p_sys->b_direct_rendering = 1;
}
#ifdef LIBAVCODEC_PP
p_sys->p_pp = NULL;
p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = VLC_FALSE;
p_sys->p_pp = E_(OpenPostproc)( p_dec, &p_sys->b_pp_async );
#endif
/* ffmpeg doesn't properly release old pictures when frames are skipped */
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
......@@ -354,13 +329,11 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_dec->fmt_out.i_codec = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
/* Setup palette */
#if LIBAVCODEC_BUILD >= 4688
if( p_dec->fmt_in.video.p_palette )
p_sys->p_context->palctrl =
(AVPaletteControl *)p_dec->fmt_in.video.p_palette;
else
p_sys->p_context->palctrl = &palette_control;
#endif
/* ***** Open the codec ***** */
vlc_mutex_lock( lockval.p_address );
......@@ -374,7 +347,6 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
vlc_mutex_unlock( lockval.p_address );
msg_Dbg( p_dec, "ffmpeg codec (%s) started", p_sys->psz_namecodec );
return VLC_SUCCESS;
}
......@@ -602,7 +574,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
if( !p_dec->fmt_in.video.i_aspect )
{
/* Fetch again the aspect ratio in case it changed */
#if LIBAVCODEC_BUILD >= 4687
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR
* ( av_q2d(p_sys->p_context->sample_aspect_ratio)
......@@ -611,10 +582,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
= p_sys->p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den
= p_sys->p_context->sample_aspect_ratio.den;
#else
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_sys->p_context->aspect_ratio;
#endif
if( p_dec->fmt_out.video.i_aspect == 0 )
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR
......@@ -628,7 +596,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_pic->date = p_sys->i_pts;
/* interpolate the next PTS */
#if LIBAVCODEC_BUILD >= 4754
if( p_dec->fmt_in.video.i_frame_rate > 0 &&
p_dec->fmt_in.video.i_frame_rate_base > 0 )
{
......@@ -646,16 +613,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_block->i_rate / INPUT_RATE_DEFAULT /
(2 * p_sys->p_context->time_base.den);
}
#else
if( p_sys->p_context->frame_rate > 0 )
{
p_sys->i_pts += I64C(1000000) *
(2 + p_sys->p_ff_pic->repeat_pict) *
p_sys->p_context->frame_rate_base *
p_block->i_rate / INPUT_RATE_DEFAULT /
(2 * p_sys->p_context->frame_rate);
}
#endif
if( p_sys->b_first_frame )
{
......@@ -665,10 +622,8 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
}
p_pic->i_nb_fields = 2 + p_sys->p_ff_pic->repeat_pict;
#if LIBAVCODEC_BUILD >= 4685
p_pic->b_progressive = !p_sys->p_ff_pic->interlaced_frame;
p_pic->b_top_field_first = p_sys->p_ff_pic->top_field_first;
#endif
return p_pic;
}
......@@ -694,9 +649,7 @@ void E_(EndVideoDec)( decoder_t *p_dec )
if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic );
#ifdef LIBAVCODEC_PP
E_(ClosePostproc)( p_dec, p_sys->p_pp );
#endif
free( p_sys->p_buffer_orig );
}
......@@ -792,11 +745,9 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
uint8_t *p_dst, *p_src;
int i_src_stride, i_dst_stride;
#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && p_sys->b_pp )
E_(PostprocPict)( p_dec, p_sys->p_pp, p_pic, p_ff_pic );
else
#endif
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
p_src = p_ff_pic->data[i_plane];
......@@ -831,11 +782,13 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
dest_pic.data[i] = p_pic->p[i].p_pixels;
dest_pic.linesize[i] = p_pic->p[i].i_pitch;
}
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
img_convert( &dest_pic, PIX_FMT_YUV420P,
(AVPicture *)p_ff_pic,
p_sys->p_context->pix_fmt,
p_sys->p_context->width,
p_sys->p_context->height );
#endif
break;
default:
msg_Err( p_dec, "don't know how to convert chroma %i",
......
......@@ -3,7 +3,7 @@
* using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id: a6d66457c73a31abbe49d51c6f0ef10b6a57234b $
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
......@@ -38,6 +38,7 @@
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void E_(InitLibavcodec) ( vlc_object_t *p_object );
static int CheckInit( filter_t *p_filter );
static picture_t *Process( filter_t *p_filter, picture_t *p_pic );
......@@ -691,3 +692,4 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
#endif
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment