Commit 1943b8df authored by Laurent Aimar's avatar Laurent Aimar

* avi.c : quick hack to read file created by ffmpeg. I think it should

work.
 * all   : add support for some others codecs provided by ffmpeg, but some of them aren't tested.
parent 07828972
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.60 2002/06/01 12:31:57 sam Exp $
* $Id: input_ext-dec.h,v 1.61 2002/07/15 19:33:02 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -38,6 +38,9 @@
#define MSMPEG4v2_VIDEO_ES 0x41
#define MSMPEG4v3_VIDEO_ES 0x42
#define MPEG4_VIDEO_ES 0x50
#define H263_VIDEO_ES 0x60
#define I263_VIDEO_ES 0x61
#define SVQ1_VIDEO_ES 0x62
#define UNKNOWN_ES 0xFF
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.53 2002/06/01 12:31:58 sam Exp $
* $Id: video.h,v 1.54 2002/07/15 19:33:02 fenrir Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -220,6 +220,13 @@ struct picture_heap_s
/* ?? */
#define FOURCC_3IV1 VLC_FOURCC('3','I','V','1')
/* 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')
#define FOURCC_I263 VLC_FOURCC('I','2','6','3')
#define FOURCC_i263 VLC_FOURCC('i','2','6','3')
/* Packed RGB for 8bpp */
#define FOURCC_BI_RGB VLC_FOURCC( 0 , 0 , 0 , 0 )
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.30 2002/07/09 22:18:23 fenrir Exp $
* $Id: avi.c,v 1.31 2002/07/15 19:33:02 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -195,56 +195,7 @@ static int AVI_AudioGetType( u32 i_type )
return( 0 );
}
}
static int AVI_VideoGetType( u32 i_type )
{
switch( i_type )
{
case( FOURCC_DIV1 ): /* FIXME it is for msmpeg4v1 or old mpeg4 ?? */
case( FOURCC_div1 ):
case( FOURCC_MPG4 ):
case( FOURCC_mpg4 ):
return( MSMPEG4v1_VIDEO_ES );
case( FOURCC_DIV2 ):
case( FOURCC_div2 ):
case( FOURCC_MP42 ):
case( FOURCC_mp42 ):
return( MSMPEG4v2_VIDEO_ES );
case( FOURCC_MPG3 ):
case( FOURCC_mpg3 ):
case( FOURCC_div3 ):
case( FOURCC_MP43 ):
case( FOURCC_mp43 ):
case( FOURCC_DIV3 ):
case( FOURCC_DIV4 ):
case( FOURCC_div4 ):
case( FOURCC_DIV5 ):
case( FOURCC_div5 ):
case( FOURCC_DIV6 ):
case( FOURCC_div6 ):
case( FOURCC_AP41 ):
case( FOURCC_3IV1 ):
return( MSMPEG4v3_VIDEO_ES );
case( FOURCC_DIVX ):
case( FOURCC_divx ):
case( FOURCC_MP4S ):
case( FOURCC_mp4s ):
case( FOURCC_M4S2 ):
case( FOURCC_m4s2 ):
case( FOURCC_xvid ):
case( FOURCC_XVID ):
case( FOURCC_XviD ):
case( FOURCC_DX50 ):
case( FOURCC_mp4v ):
case( FOURCC_4 ):
return( MPEG4_VIDEO_ES );
default:
return( 0 );
}
}
/* Test if it seems that it's a key frame */
static int AVI_GetKeyFlag( int i_type, u8 *p_byte )
{
......@@ -606,8 +557,8 @@ static int AVIInit( input_thread_t *p_input )
riffchunk_t *p_strl,*p_strh,*p_strf;
demux_data_avi_file_t *p_avi_demux;
es_descriptor_t *p_es = NULL; /* for not warning */
int i;
char *name;
int i, i_codec;
if( !( p_input->p_demux_data =
p_avi_demux = malloc( sizeof(demux_data_avi_file_t) ) ) )
......@@ -781,15 +732,21 @@ static int AVIInit( input_thread_t *p_input )
p_es->i_cat = VIDEO_ES;
AVI_Parse_BitMapInfoHeader( &p_info->video_format,
p_strf->p_data->p_payload_start );
/* XXX quick hack for playing ffmpeg video, I don't know
who is doing something wrong */
p_info->header.i_samplesize = 0;
p_es->b_audio = 0;
p_es->i_type =
AVI_VideoGetType( p_info->video_format.i_compression );
if( !p_es->i_type )
if( !AVI_GetVideoCodec( p_info->video_format.i_compression,
&i_codec,
&name ) )
{
msg_Warn( p_input, "stream(%d,%4.4s) not supported", i,
(char*)&p_info->video_format.i_compression);
p_es->i_cat = UNKNOWN_ES;
}
p_es->i_type = i_codec;
break;
default:
msg_Err( p_input, "unknown stream(%d) type", i );
......@@ -827,8 +784,7 @@ static int AVIInit( input_thread_t *p_input )
p_avi_demux->p_movi = p_movi;
/* get index XXX need to have p_movi */
if( ( p_avi_demux->b_seekable )
&&( p_avi_demux->avih.i_flags&AVIF_HASINDEX ) )
if( p_avi_demux->b_seekable )
{
/* get index */
__AVI_GetIndex( p_input );
......@@ -864,6 +820,7 @@ static int AVIInit( input_thread_t *p_input )
switch( p_info->p_es->i_cat )
{
case( VIDEO_ES ):
msg_Dbg( p_input, "video(%4.4s) %dx%d %dbpp %ffps",
(char*)&p_info->video_format.i_compression,
p_info->video_format.i_width,
......@@ -2258,6 +2215,7 @@ static int AVIDemux( input_thread_t *p_input )
p_avi_demux->i_rate = p_input->stream.control.i_rate;
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_avi_demux->i_rate = DEFAULT_RATE;
if( p_avi_demux->i_rate != DEFAULT_RATE )
{
p_info_slave = NULL;
......
......@@ -2,7 +2,7 @@
* avi.h : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.h,v 1.8 2002/06/30 15:07:57 fenrir Exp $
* $Id: avi.h,v 1.9 2002/07/15 19:33:02 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -183,3 +183,81 @@ typedef struct demux_data_avi_file_s
} demux_data_avi_file_t;
/* current codec */
static struct
{
int i_fourcc;
int i_vlc_codec;
char *psz_name;
} AVI_VideoCodecs [] = {
{ FOURCC_DIV1, MSMPEG4v1_VIDEO_ES, "MS MPEG-4 v1" },
{ FOURCC_div1, MSMPEG4v1_VIDEO_ES, "MS MPEG-4 v1" },
{ FOURCC_MPG4, MSMPEG4v1_VIDEO_ES, "MS MPEG-4 v1" },
{ FOURCC_mpg4, MSMPEG4v1_VIDEO_ES, "MS MPEG-4 v1" },
{ FOURCC_DIV2, MSMPEG4v2_VIDEO_ES, "MS MPEG-4 v2" },
{ FOURCC_div2, MSMPEG4v2_VIDEO_ES, "MS MPEG-4 v2" },
{ FOURCC_MP42, MSMPEG4v2_VIDEO_ES, "MS MPEG-4 v2" },
{ FOURCC_mp42, MSMPEG4v2_VIDEO_ES, "MS MPEG-4 v2" },
{ FOURCC_MPG3, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_mpg3, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_div3, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_MP43, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_mp43, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_DIV3, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_DIV4, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_div4, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_DIV5, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_div5, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_DIV6, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_div6, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_AP41, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" },
{ FOURCC_3IV1, MSMPEG4v3_VIDEO_ES, "MS MPEG-4 v3" }, /* wrong */
{ FOURCC_DIVX, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_divx, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_MP4S, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_mp4s, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_M4S2, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_m4s2, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_xvid, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_XVID, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_XviD, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_DX50, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_mp4v, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_4, MPEG4_VIDEO_ES, "MPEG-4" },
{ FOURCC_H263, H263_VIDEO_ES, "H263" },
{ FOURCC_h263, H263_VIDEO_ES, "H263" },
{ FOURCC_U263, H263_VIDEO_ES, "H263" },
{ FOURCC_I263, I263_VIDEO_ES, "H263.I" },
{ FOURCC_i263, I263_VIDEO_ES, "H263.I" },
{ 0, UNKNOWN_ES, "Unknown" }
};
static int AVI_GetVideoCodec( int i_fourcc,
int *pi_vlc_codec,
char **ppsz_name )
{
int i_codec;
for( i_codec = 0; ; i_codec++ )
{
if( ( AVI_VideoCodecs[i_codec].i_fourcc == i_fourcc )||
( AVI_VideoCodecs[i_codec].i_fourcc == 0 ) )
{
break;
}
}
if( pi_vlc_codec )
*pi_vlc_codec = AVI_VideoCodecs[i_codec].i_vlc_codec;
if( ppsz_name )
*ppsz_name = AVI_VideoCodecs[i_codec].psz_name;
return( AVI_VideoCodecs[i_codec].i_fourcc == 0 ? 0 : 1 );
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* ffmpeg_vdec.h: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ffmpeg.h,v 1.3 2002/06/01 12:31:59 sam Exp $
* $Id: ffmpeg.h,v 1.4 2002/07/15 19:33:02 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -37,6 +37,57 @@ typedef struct bitmapinfoheader_s
u32 i_clrimportant;
} bitmapinfoheader_t;
static struct
{
int i_vlc_codec;
int i_ffmpeg_codec;
char *psz_name;
} ffmpeg_Codecs [] = {
#if LIBAVCODEC_BUILD >= 4608
{ MSMPEG4v1_VIDEO_ES, CODEC_ID_MSMPEG4V1, "MS MPEG-4 v1" },
{ MSMPEG4v2_VIDEO_ES, CODEC_ID_MSMPEG4V2, "MS MPEG-4 v2" },
{ MSMPEG4v3_VIDEO_ES, CODEC_ID_MSMPEG4V3, "MS MPEG-4 v3" },
#else
{ MSMPEG4v3_VIDEO_ES, CODEC_ID_MSMPEG4, "MS MPEG-4 v3" },
#endif
#if LIBAVCODEC_BUILD >= 4615
{ SVQ1_VIDEO_ES, CODEC_ID_SVQ1, "SVQ-1 (Sorenson Video v1)" },
#endif
{ MPEG4_VIDEO_ES, CODEC_ID_MPEG4, "MPEG-4" },
{ H263_VIDEO_ES, CODEC_ID_H263, "H263" },
{ I263_VIDEO_ES, CODEC_ID_H263I, "H263.I" },
/* this entry is to recognize the end */
{ 0, CODEC_ID_NONE, "Unknown" }
};
static int ffmpeg_GetFfmpegCodec( int i_vlc_codec,
int *pi_ffmpeg_codec,
char **ppsz_name )
{
int i_codec;
for( i_codec = 0; ; i_codec++ )
{
if( ( ffmpeg_Codecs[i_codec].i_vlc_codec == i_vlc_codec )||
( ffmpeg_Codecs[i_codec].i_ffmpeg_codec == CODEC_ID_NONE ) )
{
break;
}
}
if( pi_ffmpeg_codec )
*pi_ffmpeg_codec = ffmpeg_Codecs[i_codec].i_ffmpeg_codec;
if( ppsz_name )
*ppsz_name = ffmpeg_Codecs[i_codec].psz_name;
return( ffmpeg_Codecs[i_codec].i_ffmpeg_codec
== CODEC_ID_NONE ? 0 : 1);
}
typedef struct videodec_thread_s
{
decoder_fifo_t *p_fifo;
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.89 2002/06/01 12:32:01 sam Exp $
* $Id: input_programs.c,v 1.90 2002/07/15 19:33:02 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -688,6 +688,9 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
case MSMPEG4v1_VIDEO_ES:
case MSMPEG4v2_VIDEO_ES:
case MSMPEG4v3_VIDEO_ES:
case SVQ1_VIDEO_ES:
case H263_VIDEO_ES:
case I263_VIDEO_ES:
case DVD_SPU_ES:
if( config_GetInt( p_input, "video" ) )
{
......
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