summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Stembridge <jstembridge@users.sourceforge.net>2003-02-19 21:37:15 +0000
committerJames Stembridge <jstembridge@users.sourceforge.net>2003-02-19 21:37:15 +0000
commitca8fd8f4748c07e19fbfff317f302e79072c01b1 (patch)
tree13577057e2ffc66a7c4d1cfd55f44f69facbe7e4
parent7f12bd3aba90ea334c924f8d5456860e50c498ab (diff)
downloadxine-lib-ca8fd8f4748c07e19fbfff317f302e79072c01b1.tar.gz
xine-lib-ca8fd8f4748c07e19fbfff317f302e79072c01b1.tar.bz2
Support for YUY2 HuffYUV video
CVS patchset: 4203 CVS date: 2003/02/19 21:37:15
-rw-r--r--src/demuxers/demux_avi.c35
-rw-r--r--src/libffmpeg/libavcodec/huffyuv.c2
-rw-r--r--src/libffmpeg/xine_decoder.c8
-rw-r--r--src/xine-engine/buffer.h3
-rw-r--r--src/xine-engine/buffer_types.c10
5 files changed, 40 insertions, 18 deletions
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 182bc6e40..64973980e 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_avi.c,v 1.148 2003/01/23 16:12:00 miguelfreitas Exp $
+ * $Id: demux_avi.c,v 1.149 2003/02/19 21:37:15 jstembridge Exp $
*
* demultiplexer for avi streams
*
@@ -161,7 +161,7 @@ typedef struct
long max_idx; /* number of index entries actually allocated */
unsigned char (*idx)[16]; /* index entries (AVI idx1 tag) */
video_index_t video_idx;
- xine_bmiheader bih;
+ xine_bmiheader *bih;
off_t movi_start;
int palette_count;
@@ -515,6 +515,7 @@ static void AVI_close(avi_t *AVI)
if(AVI->idx) free(AVI->idx);
if(AVI->video_idx.vindex) free(AVI->video_idx.vindex);
+ if(AVI->bih) free(AVI->bih);
for(i=0; i<AVI->n_audio; i++) {
if(AVI->audio[i]->audio_idx.aindex) free(AVI->audio[i]->audio_idx.aindex);
@@ -727,12 +728,18 @@ static avi_t *AVI_init(demux_avi_t *this) {
i += 8;
if(lasttag == 1) {
/* printf ("size : %d\n",sizeof(AVI->bih)); */
- memcpy (&AVI->bih, hdrl_data+i, sizeof(AVI->bih));
- xine_bmiheader_le2me( &AVI->bih );
+ AVI->bih = (xine_bmiheader *)
+ xine_xmalloc((n < sizeof(xine_bmiheader)) ? sizeof(xine_bmiheader) : n);
+ if(AVI->bih == NULL) {
+ this->AVI_errno = AVI_ERR_NO_MEM;
+ return 0;
+ }
+ memcpy (AVI->bih, hdrl_data+i, n);
+ xine_bmiheader_le2me( AVI->bih );
/* stream_read(demuxer->stream,(char*) &avi_header.bih,MIN(size2,sizeof(avi_header.bih))); */
- AVI->width = AVI->bih.biWidth;
- AVI->height = AVI->bih.biHeight;
+ AVI->width = AVI->bih->biWidth;
+ AVI->height = AVI->bih->biHeight;
/*
printf ("size : %d x %d (%d x %d)\n", AVI->width, AVI->height, AVI->bih.biWidth, AVI->bih.biHeight);
@@ -742,16 +749,16 @@ static avi_t *AVI_init(demux_avi_t *this) {
vids_strf_seen = 1;
/* load the palette, if there is one */
- AVI->palette_count = AVI->bih.biClrUsed;
+ AVI->palette_count = AVI->bih->biClrUsed;
if (AVI->palette_count > 256) {
printf ("demux_avi: number of colors exceeded 256 (%d)",
AVI->palette_count);
AVI->palette_count = 256;
}
for (j = 0; j < AVI->palette_count; j++) {
- AVI->palette[j].b = *(hdrl_data + i + sizeof(AVI->bih) + j * 4 + 0);
- AVI->palette[j].g = *(hdrl_data + i + sizeof(AVI->bih) + j * 4 + 1);
- AVI->palette[j].r = *(hdrl_data + i + sizeof(AVI->bih) + j * 4 + 2);
+ AVI->palette[j].b = *(hdrl_data + i + sizeof(xine_bmiheader) + j * 4 + 0);
+ AVI->palette[j].g = *(hdrl_data + i + sizeof(xine_bmiheader) + j * 4 + 1);
+ AVI->palette[j].r = *(hdrl_data + i + sizeof(xine_bmiheader) + j * 4 + 2);
}
} else if(lasttag == 2) {
@@ -1216,10 +1223,10 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) {
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
buf->decoder_flags = BUF_FLAG_HEADER;
buf->decoder_info[1] = this->video_step;
- memcpy (buf->content, &this->avi->bih, sizeof (this->avi->bih));
- buf->size = sizeof (this->avi->bih);
+ memcpy (buf->content, this->avi->bih, this->avi->bih->biSize);
+ buf->size = this->avi->bih->biSize;
- this->avi->video_type = fourcc_to_buf_video(this->avi->bih.biCompression);
+ this->avi->video_type = fourcc_to_buf_video(this->avi->bih->biCompression);
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_FOURCC] = *(uint32_t *)this->avi->compressor;
if (!this->avi->video_type)
@@ -1228,7 +1235,7 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) {
if (!this->avi->video_type) {
printf ("demux_avi: unknown video codec '%.4s'\n",
- (char*)&this->avi->bih.biCompression);
+ (char*)&this->avi->bih->biCompression);
this->avi->video_type = BUF_VIDEO_UNKNOWN;
}
diff --git a/src/libffmpeg/libavcodec/huffyuv.c b/src/libffmpeg/libavcodec/huffyuv.c
index cff642d11..fa740ff28 100644
--- a/src/libffmpeg/libavcodec/huffyuv.c
+++ b/src/libffmpeg/libavcodec/huffyuv.c
@@ -893,7 +893,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
*data_size = sizeof(AVFrame);
- return (get_bits_count(&s->gb)+7)>>3;
+ return (((get_bits_count(&s->gb)+7)>>3) + 3) & ~3;
}
static int decode_end(AVCodecContext *avctx)
diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c
index 560a1697c..37d9ed892 100644
--- a/src/libffmpeg/xine_decoder.c
+++ b/src/libffmpeg/xine_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_decoder.c,v 1.92 2003/02/04 22:01:34 hadess Exp $
+ * $Id: xine_decoder.c,v 1.93 2003/02/19 21:37:16 jstembridge Exp $
*
* xine decoder plugin using ffmpeg
*
@@ -399,6 +399,11 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
this->stream->meta_info[XINE_META_INFO_VIDEOCODEC]
= strdup ("DV (ffmpeg)");
break;
+ case BUF_VIDEO_HUFFYUV:
+ this->codec = avcodec_find_decoder (CODEC_ID_HUFFYUV);
+ this->stream->meta_info[XINE_META_INFO_VIDEOCODEC]
+ = strdup ("huffyuv (ffmpeg)");
+ break;
default:
printf ("ffmpeg: unknown video format (buftype: 0x%08X)\n",
buf->type & 0xFFFF0000);
@@ -1092,6 +1097,7 @@ static uint32_t supported_video_types[] = {
BUF_VIDEO_JPEG,
BUF_VIDEO_MPEG,
BUF_VIDEO_DV,
+ BUF_VIDEO_HUFFYUV,
0
};
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index 1e180e475..008e130df 100644
--- a/src/xine-engine/buffer.h
+++ b/src/xine-engine/buffer.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.h,v 1.100 2003/02/08 13:52:44 tmattern Exp $
+ * $Id: buffer.h,v 1.101 2003/02/19 21:37:16 jstembridge Exp $
*
*
* contents:
@@ -142,6 +142,7 @@ extern "C" {
#define BUF_VIDEO_RV40 0x02390000
#define BUF_VIDEO_PSX_MDEC 0x023A0000
#define BUF_VIDEO_YUV_FRAMES 0x023B0000 /* uncompressed YUV, delivered by v4l input plugin */
+#define BUF_VIDEO_HUFFYUV 0x023C0000
/* audio buffer types: (please keep in sync with buffer_types.c) */
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index 9850e4a68..ae606d887 100644
--- a/src/xine-engine/buffer_types.c
+++ b/src/xine-engine/buffer_types.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer_types.c,v 1.53 2003/01/31 18:29:47 miguelfreitas Exp $
+ * $Id: buffer_types.c,v 1.54 2003/02/19 21:37:17 jstembridge Exp $
*
*
* contents:
@@ -526,6 +526,14 @@ static video_db_t video_db[] = {
BUF_VIDEO_RV40,
"Real Video 4.0"
},
+{
+ {
+ meFOURCC('H', 'F', 'Y', 'U'),
+ 0,
+ },
+ BUF_VIDEO_HUFFYUV,
+ "HuffYUV"
+},
{ { 0 }, 0, "last entry" }
};