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 @@
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* 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>
*
......@@ -32,11 +32,6 @@
#include <vlc/decoder.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <errno.h>
#include <string.h>
#ifdef HAVE_SYS_TIMES_H
......
......@@ -2,7 +2,7 @@
* ffmpeg_vdec.h: video decoder using ffmpeg library
*****************************************************************************
* 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>
*
......@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER */
#define DECODER_THREAD_COMMON \
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* video.h: video decoder using ffmpeg library
*****************************************************************************
* 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>
*
......@@ -21,31 +21,11 @@
* 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
{
DECODER_THREAD_COMMON
bitmapinfoheader_t format;
BITMAPINFOHEADER *p_format;
vout_thread_t *p_vout;
......@@ -53,14 +33,14 @@ typedef struct vdec_thread_s
u32 i_pp_mode; /* valid only with I420 and YV12 */
postprocessing_t *p_pp;
/* for frame skipping algo */
// statistic_s statistic;
int b_hurry_up;
int i_frame_error;
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;
......@@ -68,5 +48,3 @@ typedef struct vdec_thread_s
int E_( InitThread_Video ) ( vdec_thread_t * );
void E_( EndThread_Video ) ( vdec_thread_t * );
void E_( DecodeThread_Video ) ( vdec_thread_t * );
......@@ -2,7 +2,7 @@
* libasf.h :
*****************************************************************************
* 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>
*
* This program is free software; you can redistribute it and/or modify
......@@ -20,36 +20,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
/*****************************************************************************
* 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
{
u32 v1; /* le */
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* 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>
*
* This program is free software; you can redistribute it and/or modify
......@@ -937,17 +937,17 @@ static int AVIInit( vlc_object_t * p_this )
/* XXX quick hack for playing ffmpeg video, I don't know
who is doing something wrong */
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 =
AVI_FourccGetCodec( VIDEO_ES, p_info->i_fourcc );
i_init_size = p_avi_strf_vids->i_chunk_size;
p_init_data = p_avi_strf_vids->p_bih;
msg_Dbg( p_input, "stream[%d] video(%4.4s) %dx%d %dbpp %ffps",
i,
(char*)&p_avi_strf_vids->i_compression,
p_avi_strf_vids->i_width,
p_avi_strf_vids->i_height,
p_avi_strf_vids->i_bitcount,
(char*)&p_avi_strf_vids->p_bih->biCompression,
p_avi_strf_vids->p_bih->biWidth,
p_avi_strf_vids->p_bih->biHeight,
p_avi_strf_vids->p_bih->biBitCount,
(float)p_info->i_rate /
(float)p_info->i_scale );
break;
......
......@@ -2,7 +2,7 @@
* libavi.c :
*****************************************************************************
* 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>
*
* 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,
break;
case( AVIFOURCC_vids ):
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 );
memcpy( p_chk->strf.vids.p_bih,
p_buff + 8,
p_chk->common.i_chunk_size );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize );
AVI_READ4BYTES( p_chk->strf.vids.p_bih->biWidth );
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
msg_Dbg( p_input,
"strf: video:%c%c%c%c %dx%d planes:%d %dbpp",
AVIFOURCC_PRINT( p_chk->strf.vids.i_compression ),
p_chk->strf.vids.i_width,
p_chk->strf.vids.i_height,
p_chk->strf.vids.i_planes,
p_chk->strf.vids.i_bitcount );
AVIFOURCC_PRINT( p_chk->strf.vids.p_bih->biCompression ),
p_chk->strf.vids.p_bih->biWidth,
p_chk->strf.vids.p_bih->biHeight,
p_chk->strf.vids.p_bih->biPlanes,
p_chk->strf.vids.p_bih->biBitCount );
#endif
break;
default:
......
......@@ -2,7 +2,7 @@
* libavi.h : LibAVI library
******************************************************************************
* 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>
*
* This program is free software; you can redistribute it and/or modify
......@@ -20,6 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER */
/* flags for use in <dwFlags> in AVIFileHdr */
#define AVIF_HASINDEX 0x00000010 /* Index at end of file? */
......@@ -255,18 +256,7 @@ typedef struct avi_chunk_strf_auds_s
typedef struct avi_chunk_strf_vids_s
{
AVI_CHUNK_COMMON
void *p_bih; // bitmapinfoheader_t loaded from file
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;
BITMAPINFOHEADER *p_bih;
} avi_chunk_strf_vids_t;
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