Commit 968cc6bf authored by Laurent Aimar's avatar Laurent Aimar

* all: added mjpeg support, some clean up in video part.

parent e0ac4474
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library * audio.c: audio decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.3 2002/11/14 22:38:47 massiot Exp $ * $Id: audio.c,v 1.4 2002/11/27 12:41:45 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -196,14 +196,14 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec ) ...@@ -196,14 +196,14 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec )
if( i_frame_size > 0 ) if( i_frame_size > 0 )
{ {
if( p_adec->i_buffer < i_frame_size + 16 ) if( p_adec->i_buffer_size < i_frame_size + 16 )
{ {
FREE( p_adec->p_buffer ); FREE( p_adec->p_buffer );
p_adec->p_buffer = malloc( i_frame_size + 16 ); p_adec->p_buffer = malloc( i_frame_size + 16 );
p_adec->i_buffer = i_frame_size + 16; p_adec->i_buffer_size = i_frame_size + 16;
} }
E_( GetPESData )( p_adec->p_buffer, p_adec->i_buffer, p_pes ); E_( GetPESData )( p_adec->p_buffer, p_adec->i_buffer_size, p_pes );
} }
input_DeletePES( p_adec->p_fifo->p_packets_mgt, p_pes ); input_DeletePES( p_adec->p_fifo->p_packets_mgt, p_pes );
} while( i_frame_size <= 0 ); } while( i_frame_size <= 0 );
......
...@@ -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.17 2002/11/18 02:46:10 fenrir Exp $ * $Id: ffmpeg.c,v 1.18 2002/11/27 12:41:45 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -294,6 +294,10 @@ static int InitThread( generic_thread_t *p_decoder ) ...@@ -294,6 +294,10 @@ static int InitThread( generic_thread_t *p_decoder )
} }
p_decoder->pts = 0; p_decoder->pts = 0;
p_decoder->p_buffer = NULL;
p_decoder->i_buffer = 0;
p_decoder->i_buffer_size = 0;
return( i_result ); return( i_result );
} }
...@@ -313,7 +317,6 @@ static void EndThread( generic_thread_t *p_decoder ) ...@@ -313,7 +317,6 @@ static void EndThread( generic_thread_t *p_decoder )
if( p_decoder->p_context != NULL) if( p_decoder->p_context != NULL)
{ {
FREE( p_decoder->p_context->quant_store );
FREE( p_decoder->p_context->extradata ); FREE( p_decoder->p_context->extradata );
avcodec_close( p_decoder->p_context ); avcodec_close( p_decoder->p_context );
msg_Dbg( p_decoder->p_fifo, msg_Dbg( p_decoder->p_fifo,
...@@ -341,7 +344,7 @@ static void EndThread( generic_thread_t *p_decoder ) ...@@ -341,7 +344,7 @@ static void EndThread( generic_thread_t *p_decoder )
* locales Functions * locales Functions
*****************************************************************************/ *****************************************************************************/
void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes ) int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes )
{ {
int i_copy; int i_copy;
int i_count; int i_count;
...@@ -372,6 +375,7 @@ void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes ) ...@@ -372,6 +375,7 @@ void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes )
{ {
memset( p_buf, 0, i_max - i_count ); memset( p_buf, 0, i_max - i_count );
} }
return( i_count );
} }
...@@ -386,6 +390,14 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc, ...@@ -386,6 +390,14 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
switch( i_fourcc ) switch( i_fourcc )
{ {
#if 0
/* XXX don't use it */
case FOURCC_mpgv:
i_cat = VIDEO_ES;
i_codec = CODEC_ID_MPEG1VIDEO;
psz_name = "MPEG-1/2 Video";
break;
#endif
#if LIBAVCODEC_BUILD >= 4608 #if LIBAVCODEC_BUILD >= 4608
case FOURCC_DIV1: case FOURCC_DIV1:
case FOURCC_div1: case FOURCC_div1:
...@@ -479,7 +491,21 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc, ...@@ -479,7 +491,21 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
i_codec = CODEC_ID_WMV2; i_codec = CODEC_ID_WMV2;
psz_name ="Windows Media Video 2"; psz_name ="Windows Media Video 2";
break; break;
case FOURCC_MJPG:
case FOURCC_mjpg:
case FOURCC_mjpa:
case FOURCC_jpeg:
case FOURCC_JFIF:
i_cat = VIDEO_ES;
i_codec = CODEC_ID_MJPEG;
psz_name = "Motion JPEG";
break;
case FOURCC_mjpb:
i_cat = VIDEO_ES;
i_codec = CODEC_ID_MJPEGB;
psz_name = "Motion JPEG B";
break;
#if LIBAVCODEC_BUILD >= 4632 #if LIBAVCODEC_BUILD >= 4632
case FOURCC_WMA1: case FOURCC_WMA1:
case FOURCC_wma1: case FOURCC_wma1:
......
...@@ -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.8 2002/11/05 10:07:56 gbazin Exp $ * $Id: ffmpeg.h,v 1.9 2002/11/27 12:41:45 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
\ \
/* Private stuff for frame gathering */ \ /* Private stuff for frame gathering */ \
u8 *p_buffer; /* buffer for gather pes */ \ u8 *p_buffer; /* buffer for gather pes */ \
int i_buffer; /* size of allocated p_framedata */ int i_buffer_size; /* size of allocated p_buffer */ \
int i_buffer; /* bytes already present in p_buffer */
typedef struct generic_thread_s typedef struct generic_thread_s
...@@ -55,12 +56,15 @@ typedef struct generic_thread_s ...@@ -55,12 +56,15 @@ typedef struct generic_thread_s
#define FREE( p ) if( p ) free( p ); p = NULL #define FREE( p ) if( p ) free( p ); p = NULL
void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes ); int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
/***************************************************************************** /*****************************************************************************
* Video codec fourcc * Video codec fourcc
*****************************************************************************/ *****************************************************************************/
/* MPEG 1/2 video */
#define FOURCC_mpgv VLC_FOURCC('m','p','g','v')
/* MPEG4 video */ /* MPEG4 video */
#define FOURCC_DIVX VLC_FOURCC('D','I','V','X') #define FOURCC_DIVX VLC_FOURCC('D','I','V','X')
#define FOURCC_divx VLC_FOURCC('d','i','v','x') #define FOURCC_divx VLC_FOURCC('d','i','v','x')
...@@ -118,6 +122,17 @@ void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes ); ...@@ -118,6 +122,17 @@ void E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
/* Sorenson v1 */ /* Sorenson v1 */
#define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' ) #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
/* mjpeg */
#define FOURCC_MJPG VLC_FOURCC( 'M', 'J', 'P', 'G' )
#define FOURCC_mjpg VLC_FOURCC( 'm', 'j', 'p', 'g' )
/* for mov file */
#define FOURCC_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
/* for mov file XXX: untested */
#define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'p', 'b' )
#define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
#define FOURCC_JFIF VLC_FOURCC( 'J', 'F', 'I', 'F' )
/* wmv */ /* wmv */
#define FOURCC_WMV1 VLC_FOURCC('W','M','V','1') #define FOURCC_WMV1 VLC_FOURCC('W','M','V','1')
#define FOURCC_WMV2 VLC_FOURCC('W','M','V','2') #define FOURCC_WMV2 VLC_FOURCC('W','M','V','2')
......
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.3 2002/11/06 21:48:24 gbazin Exp $ * $Id: video.h,v 1.4 2002/11/27 12:41:45 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -37,7 +37,9 @@ typedef struct vdec_thread_s ...@@ -37,7 +37,9 @@ typedef struct vdec_thread_s
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 many decoded frames are late */ int i_frame_late; /* how many decoded frames are late */
int i_frame_count; /* to emulate pts */
/* for direct rendering */ /* for direct rendering */
int b_direct_rendering; int b_direct_rendering;
......
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