Commit 3e017c26 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/ffmpeg/*: modified the ffmpeg video codec to use direct
   rendering when possible.
   Use BITMAPINFOHEADER from include/codecs.h + got rid of Little Endian
   translations that were already done in the demux.
* modules/demux/avi/* modules/demux/asf/*: Use BITMAPINFOHEADER from
   include/codecs.h.
parent 32519ebf
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ffmpeg.c: video decoder using ffmpeg library * ffmpeg.c: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: ffmpeg.c,v 1.13 2002/10/28 22:23:23 gbazin Exp $ * $Id: ffmpeg.c,v 1.14 2002/11/05 10:07:56 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -32,11 +32,6 @@ ...@@ -32,11 +32,6 @@
#include <vlc/decoder.h> #include <vlc/decoder.h>
#include <vlc/input.h> #include <vlc/input.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <errno.h>
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_TIMES_H #ifdef HAVE_SYS_TIMES_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ffmpeg_vdec.h: video decoder using ffmpeg library * ffmpeg_vdec.h: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: ffmpeg.h,v 1.7 2002/10/28 06:26:11 fenrir Exp $ * $Id: ffmpeg.h,v 1.8 2002/11/05 10:07:56 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER */
#define DECODER_THREAD_COMMON \ #define DECODER_THREAD_COMMON \
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video.h: video decoder using ffmpeg library * video.h: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: video.h,v 1.1 2002/10/28 06:26:11 fenrir Exp $ * $Id: video.h,v 1.2 2002/11/05 10:07:56 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -21,31 +21,11 @@ ...@@ -21,31 +21,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/* for a video stream */
typedef struct bitmapinfoheader_s
{
u32 i_size; /* size of header */
u32 i_width;
u32 i_height;
u16 i_planes;
u16 i_bitcount;
u32 i_compression;
u32 i_sizeimage;
u32 i_xpelspermeter;
u32 i_ypelspermeter;
u32 i_clrused;
u32 i_clrimportant;
int i_data;
u8 *p_data;
} bitmapinfoheader_t;
typedef struct vdec_thread_s typedef struct vdec_thread_s
{ {
DECODER_THREAD_COMMON DECODER_THREAD_COMMON
bitmapinfoheader_t format; BITMAPINFOHEADER *p_format;
vout_thread_t *p_vout; vout_thread_t *p_vout;
...@@ -53,14 +33,14 @@ typedef struct vdec_thread_s ...@@ -53,14 +33,14 @@ typedef struct vdec_thread_s
u32 i_pp_mode; /* valid only with I420 and YV12 */ u32 i_pp_mode; /* valid only with I420 and YV12 */
postprocessing_t *p_pp; postprocessing_t *p_pp;
/* for frame skipping algo */ /* for frame skipping algo */
// statistic_s statistic;
int b_hurry_up; int b_hurry_up;
int i_frame_error; int i_frame_error;
int i_frame_skip; int i_frame_skip;
int i_frame_late; /* how may frame decoded are in late */ int i_frame_late; /* how many decoded frames are late */
/* for direct rendering */
int b_direct_rendering;
} vdec_thread_t; } vdec_thread_t;
...@@ -68,5 +48,3 @@ typedef struct vdec_thread_s ...@@ -68,5 +48,3 @@ typedef struct vdec_thread_s
int E_( InitThread_Video ) ( vdec_thread_t * ); int E_( InitThread_Video ) ( vdec_thread_t * );
void E_( EndThread_Video ) ( vdec_thread_t * ); void E_( EndThread_Video ) ( vdec_thread_t * );
void E_( DecodeThread_Video ) ( vdec_thread_t * ); void E_( DecodeThread_Video ) ( vdec_thread_t * );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libasf.h : * libasf.h :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libasf.h,v 1.2 2002/10/21 09:18:37 fenrir Exp $ * $Id: libasf.h,v 1.3 2002/11/05 10:07:56 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -20,36 +20,11 @@ ...@@ -20,36 +20,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
/***************************************************************************** /*****************************************************************************
* Structure needed for decoder * Structure needed for decoder
*****************************************************************************/ *****************************************************************************/
typedef struct bitmapinfoheader_s
{
u32 i_size; /* size of header 40 + size of data follwoing this header */
u32 i_width;
u32 i_height;
u16 i_planes;
u16 i_bitcount;
u32 i_compression;
u32 i_sizeimage;
u32 i_xpelspermeter;
u32 i_ypelspermeter;
u32 i_clrused;
u32 i_clrimportant;
} bitmapinfoheader_t;
typedef struct waveformatex_s
{
u16 i_format;
u16 i_channels;
u32 i_samplepersec;
u32 i_avgbytespersec;
u16 i_blockalign;
u16 i_bitspersample;
u16 i_size; /* This give size of data
imediatly following this header. */
} waveformatex_t;
typedef struct guid_s typedef struct guid_s
{ {
u32 v1; /* le */ u32 v1; /* le */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc * avi.c : AVI file Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.8 2002/10/28 01:51:37 fenrir Exp $ * $Id: avi.c,v 1.9 2002/11/05 10:07:56 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -937,17 +937,17 @@ static int AVIInit( vlc_object_t * p_this ) ...@@ -937,17 +937,17 @@ static int AVIInit( vlc_object_t * p_this )
/* XXX quick hack for playing ffmpeg video, I don't know /* XXX quick hack for playing ffmpeg video, I don't know
who is doing something wrong */ who is doing something wrong */
p_info->i_samplesize = 0; p_info->i_samplesize = 0;
p_info->i_fourcc = p_avi_strf_vids->i_compression; p_info->i_fourcc = p_avi_strf_vids->p_bih->biCompression;
p_info->i_codec = p_info->i_codec =
AVI_FourccGetCodec( VIDEO_ES, p_info->i_fourcc ); AVI_FourccGetCodec( VIDEO_ES, p_info->i_fourcc );
i_init_size = p_avi_strf_vids->i_chunk_size; i_init_size = p_avi_strf_vids->i_chunk_size;
p_init_data = p_avi_strf_vids->p_bih; p_init_data = p_avi_strf_vids->p_bih;
msg_Dbg( p_input, "stream[%d] video(%4.4s) %dx%d %dbpp %ffps", msg_Dbg( p_input, "stream[%d] video(%4.4s) %dx%d %dbpp %ffps",
i, i,
(char*)&p_avi_strf_vids->i_compression, (char*)&p_avi_strf_vids->p_bih->biCompression,
p_avi_strf_vids->i_width, p_avi_strf_vids->p_bih->biWidth,
p_avi_strf_vids->i_height, p_avi_strf_vids->p_bih->biHeight,
p_avi_strf_vids->i_bitcount, p_avi_strf_vids->p_bih->biBitCount,
(float)p_info->i_rate / (float)p_info->i_rate /
(float)p_info->i_scale ); (float)p_info->i_scale );
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.c : * libavi.c :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.3 2002/10/27 15:37:16 fenrir Exp $ * $Id: libavi.c,v 1.4 2002/11/05 10:07:56 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -539,29 +539,29 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input, ...@@ -539,29 +539,29 @@ static int AVI_ChunkRead_strf( input_thread_t *p_input,
break; break;
case( AVIFOURCC_vids ): case( AVIFOURCC_vids ):
p_strh->strh.i_samplesize = 0; // XXX for ffmpeg avi file p_strh->strh.i_samplesize = 0; // XXX for ffmpeg avi file
AVI_READ4BYTES( p_chk->strf.vids.i_size );
AVI_READ4BYTES( p_chk->strf.vids.i_width );
AVI_READ4BYTES( p_chk->strf.vids.i_height );
AVI_READ2BYTES( p_chk->strf.vids.i_planes );
AVI_READ2BYTES( p_chk->strf.vids.i_bitcount );
AVI_READFOURCC( p_chk->strf.vids.i_compression );
AVI_READ4BYTES( p_chk->strf.vids.i_sizeimage );
AVI_READ4BYTES( p_chk->strf.vids.i_xpelspermeter );
AVI_READ4BYTES( p_chk->strf.vids.i_ypelspermeter );
AVI_READ4BYTES( p_chk->strf.vids.i_clrused );
AVI_READ4BYTES( p_chk->strf.vids.i_clrimportant );
p_chk->strf.vids.p_bih = malloc( p_chk->common.i_chunk_size ); p_chk->strf.vids.p_bih = malloc( p_chk->common.i_chunk_size );
memcpy( p_chk->strf.vids.p_bih, AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize );
p_buff + 8, AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth );
p_chk->common.i_chunk_size ); AVI_READ4BYTES( p_chk->strf.vids.p_bih->biHeight );
AVI_READ2BYTES( p_chk->strf.vids.p_bih->biPlanes );
AVI_READ2BYTES( p_chk->strf.vids.p_bih->biBitCount );
AVI_READFOURCC( p_chk->strf.vids.p_bih->biCompression );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSizeImage );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biXPelsPerMeter );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biYPelsPerMeter );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biClrUsed );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biClrImportant );
memcpy( &p_chk->strf.vids.p_bih[1],
p_buff + sizeof(BITMAPINFOHEADER),
p_chk->common.i_chunk_size - sizeof(BITMAPINFOHEADER) );
#ifdef AVI_DEBUG #ifdef AVI_DEBUG
msg_Dbg( p_input, msg_Dbg( p_input,
"strf: video:%c%c%c%c %dx%d planes:%d %dbpp", "strf: video:%c%c%c%c %dx%d planes:%d %dbpp",
AVIFOURCC_PRINT( p_chk->strf.vids.i_compression ), AVIFOURCC_PRINT( p_chk->strf.vids.p_bih->biCompression ),
p_chk->strf.vids.i_width, p_chk->strf.vids.p_bih->biWidth,
p_chk->strf.vids.i_height, p_chk->strf.vids.p_bih->biHeight,
p_chk->strf.vids.i_planes, p_chk->strf.vids.p_bih->biPlanes,
p_chk->strf.vids.i_bitcount ); p_chk->strf.vids.p_bih->biBitCount );
#endif #endif
break; break;
default: default:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.h : LibAVI library * libavi.h : LibAVI library
****************************************************************************** ******************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libavi.h,v 1.1 2002/10/15 00:56:43 fenrir Exp $ * $Id: libavi.h,v 1.2 2002/11/05 10:07:56 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER */
/* flags for use in <dwFlags> in AVIFileHdr */ /* flags for use in <dwFlags> in AVIFileHdr */
#define AVIF_HASINDEX 0x00000010 /* Index at end of file? */ #define AVIF_HASINDEX 0x00000010 /* Index at end of file? */
...@@ -255,18 +256,7 @@ typedef struct avi_chunk_strf_auds_s ...@@ -255,18 +256,7 @@ typedef struct avi_chunk_strf_auds_s
typedef struct avi_chunk_strf_vids_s typedef struct avi_chunk_strf_vids_s
{ {
AVI_CHUNK_COMMON AVI_CHUNK_COMMON
void *p_bih; // bitmapinfoheader_t loaded from file BITMAPINFOHEADER *p_bih;
u32 i_size; /* size of header */
u32 i_width;
u32 i_height;
u16 i_planes;
u16 i_bitcount;
u32 i_compression;
u32 i_sizeimage;
u32 i_xpelspermeter;
u32 i_ypelspermeter;
u32 i_clrused;
u32 i_clrimportant;
} avi_chunk_strf_vids_t; } avi_chunk_strf_vids_t;
typedef union avi_chunk_strf_u typedef union avi_chunk_strf_u
......
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