Commit fa5f1098 authored by Gildas Bazin's avatar Gildas Bazin

* include/vlc_common.h, include/vlc_es.h: new video_palette_t structure.
* modules/codec/ffmpeg/*: support for palettized codecs.
parent 64b64281
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.104 2004/01/24 20:40:46 fenrir Exp $ * $Id: vlc_common.h,v 1.105 2004/01/25 21:39:37 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -229,6 +229,7 @@ typedef struct audio_format_t audio_format_t; ...@@ -229,6 +229,7 @@ typedef struct audio_format_t audio_format_t;
typedef struct video_format_t video_format_t; typedef struct video_format_t video_format_t;
typedef struct subs_format_t subs_format_t; typedef struct subs_format_t subs_format_t;
typedef struct es_format_t es_format_t; typedef struct es_format_t es_format_t;
typedef struct video_palette_t video_palette_t;
/* NInput */ /* NInput */
typedef struct stream_t stream_t; typedef struct stream_t stream_t;
......
/***************************************************************************** /*****************************************************************************
* vlc_es.h * vlc_es.h: Elementary stream formats descriptions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: vlc_es.h,v 1.6 2004/01/19 18:15:29 fenrir Exp $ * $Id: vlc_es.h,v 1.7 2004/01/25 21:39:37 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -25,13 +25,30 @@ ...@@ -25,13 +25,30 @@
#define _VLC_ES_H 1 #define _VLC_ES_H 1
/** /**
* Description of a audio frame * \file
* This file defines the elementary streams format types
*/ */
struct audio_format_t
/**
* video palette data
* \see viedo_format_t
* \see subs_format_t
*/
struct video_palette_t
{ {
vlc_fourcc_t i_format; int i_dummy; /**< to keep the compatibility with ffmpeg's palette */
uint32_t palette[256]; /**< 4-byte ARGB palette entries, stored in native
* byte order */
};
unsigned int i_rate; /**
* audio format description
*/
struct audio_format_t
{
vlc_fourcc_t i_format; /**< audio format fourcc */
unsigned int i_rate; /**< audio sample-rate */
/* Describes the channels configuration of the samples (ie. number of /* Describes the channels configuration of the samples (ie. number of
* channels which are available in the buffer, and positions). */ * channels which are available in the buffer, and positions). */
...@@ -60,7 +77,7 @@ struct audio_format_t ...@@ -60,7 +77,7 @@ struct audio_format_t
}; };
/** /**
* Description of a video frame * video format description
*/ */
struct video_format_t struct video_format_t
{ {
...@@ -78,10 +95,12 @@ struct video_format_t ...@@ -78,10 +95,12 @@ struct video_format_t
unsigned int i_frame_rate; /**< frame rate numerator */ unsigned int i_frame_rate; /**< frame rate numerator */
unsigned int i_frame_rate_base; /**< frame rate denominator */ unsigned int i_frame_rate_base; /**< frame rate denominator */
video_palette_t *p_palette; /**< video palette from demuxer */
}; };
/** /**
* Description of subs * subtitles format description
*/ */
struct subs_format_t struct subs_format_t
{ {
...@@ -174,4 +193,3 @@ static inline void es_format_Copy( es_format_t *dst, es_format_t *src ) ...@@ -174,4 +193,3 @@ static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
} }
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* demux.c: demuxer using ffmpeg (libavformat). * demux.c: demuxer using ffmpeg (libavformat).
***************************************************************************** *****************************************************************************
* Copyright (C) 2004 VideoLAN * Copyright (C) 2004 VideoLAN
* $Id: demux.c,v 1.3 2004/01/15 19:46:32 gbazin Exp $ * $Id: demux.c,v 1.4 2004/01/25 21:39:37 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -176,6 +176,11 @@ int E_(OpenDemux)( vlc_object_t *p_this ) ...@@ -176,6 +176,11 @@ int E_(OpenDemux)( vlc_object_t *p_this )
es_format_Init( &fmt, VIDEO_ES, fcc ); es_format_Init( &fmt, VIDEO_ES, fcc );
fmt.video.i_width = cc->width; fmt.video.i_width = cc->width;
fmt.video.i_height = cc->height; fmt.video.i_height = cc->height;
if( cc->palctrl )
{
fmt.video.p_palette = malloc( sizeof(video_palette_t) );
*fmt.video.p_palette = *(video_palette_t *)cc->palctrl;
}
break; break;
default: default:
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video.c: video decoder using the ffmpeg library * video.c: video decoder using the ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.61 2004/01/18 21:30:25 fenrir Exp $ * $Id: video.c,v 1.62 2004/01/25 21:39:37 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -335,8 +335,12 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -335,8 +335,12 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_dec->fmt_out.i_cat = VIDEO_ES; p_dec->fmt_out.i_cat = VIDEO_ES;
p_dec->fmt_out.i_codec = ffmpeg_PixFmtToChroma( p_context->pix_fmt ); p_dec->fmt_out.i_codec = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
/* Setup dummy palette to avoid segfaults with some codecs */ /* Setup palette */
#if LIBAVCODEC_BUILD >= 4688 #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; p_sys->p_context->palctrl = &palette_control;
#endif #endif
......
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