summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_decoder.c11
-rw-r--r--src/xine-engine/audio_decoder.h4
-rw-r--r--src/xine-engine/audio_out.c25
-rw-r--r--src/xine-engine/audio_out.h22
-rw-r--r--src/xine-engine/buffer.c22
-rw-r--r--src/xine-engine/buffer.h28
-rw-r--r--src/xine-engine/buffer_types.c17
-rw-r--r--src/xine-engine/video_decoder.c14
-rw-r--r--src/xine-engine/video_decoder.h4
-rw-r--r--src/xine-engine/video_out.c36
-rw-r--r--src/xine-engine/video_out.h15
-rw-r--r--src/xine-engine/xine.c57
-rw-r--r--src/xine-engine/xine_internal.h35
13 files changed, 199 insertions, 91 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 4b3cbb848..50d1e47a9 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.92 2002/12/18 03:59:10 guenter Exp $
+ * $Id: audio_decoder.c,v 1.93 2002/12/21 12:56:51 miguelfreitas Exp $
*
*
* functions that implement audio decoding
@@ -65,13 +65,7 @@ void *audio_decoder_loop (void *stream_gen) {
buf->pts, buf->type);
#endif
- if (buf->input_pos)
- stream->input_pos = buf->input_pos;
- if (buf->input_length)
- stream->input_length = buf->input_length;
- if (buf->input_time) {
- stream->input_time = buf->input_time;
- }
+ extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info );
switch (buf->type) {
@@ -155,6 +149,7 @@ void *audio_decoder_loop (void *stream_gen) {
#ifdef LOG
printf ("audio_decoder: reset\n");
#endif
+ extra_info_reset( stream->audio_decoder_extra_info );
if (stream->audio_decoder_plugin)
stream->audio_decoder_plugin->reset (stream->audio_decoder_plugin);
break;
diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h
index fec946f5a..a194694f1 100644
--- a/src/xine-engine/audio_decoder.h
+++ b/src/xine-engine/audio_decoder.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: audio_decoder.h,v 1.7 2002/11/20 11:57:49 mroi Exp $
+ * $Id: audio_decoder.h,v 1.8 2002/12/21 12:56:51 miguelfreitas Exp $
*
* xine audio decoder plugin interface
*
@@ -29,7 +29,7 @@
#include <inttypes.h>
#include "buffer.h"
-#define AUDIO_DECODER_IFACE_VERSION 12
+#define AUDIO_DECODER_IFACE_VERSION 13
/*
* generic xine audio decoder plugin interface
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 8693a9678..b057cf1dc 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.89 2002/12/14 16:33:59 jkeil Exp $
+ * $Id: audio_out.c,v 1.90 2002/12/21 12:56:51 miguelfreitas Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -573,6 +573,11 @@ static void *ao_loop (void *this_gen) {
}
pthread_mutex_unlock( &this->driver_lock );
+
+ if( in_buf && in_buf->stream && !in_buf->stream->video_decoder_plugin ) {
+ extra_info_merge( in_buf->stream->current_extra_info, in_buf->extra_info );
+ }
+
/*
* where, in the timeline is the "end" of the
* hardware audio buffer at the moment?
@@ -827,7 +832,12 @@ static int ao_open(xine_audio_port_t *this, xine_stream_t *stream,
}
static audio_buffer_t *ao_get_buffer (xine_audio_port_t *this) {
- return fifo_remove (this->free_fifo);
+ audio_buffer_t *buf;
+
+ buf = fifo_remove (this->free_fifo);
+ extra_info_reset( buf->extra_info );
+
+ return buf;
}
static void ao_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, xine_stream_t *stream) {
@@ -839,6 +849,9 @@ static void ao_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf, xine_st
return;
}
+ buf->stream = stream;
+ extra_info_merge( buf->extra_info, stream->audio_decoder_extra_info );
+
pts = buf->vpts;
buf->vpts = stream->metronom->got_audio_samples (stream->metronom, pts,
@@ -926,8 +939,10 @@ static void ao_exit(xine_audio_port_t *this) {
xine_list_free(this->streams);
free (this->frame_buf[0]->mem);
+ free (this->frame_buf[0]->extra_info);
free (this->frame_buf[0]);
free (this->frame_buf[1]->mem);
+ free (this->frame_buf[1]->extra_info);
free (this->frame_buf[1]);
free (this->zero_space);
@@ -938,6 +953,7 @@ static void ao_exit(xine_audio_port_t *this) {
next = buf->next;
free (buf->mem);
+ free (buf->extra_info);
free (buf);
buf = next;
@@ -950,6 +966,7 @@ static void ao_exit(xine_audio_port_t *this) {
next = buf->next;
free (buf->mem);
+ free (buf->extra_info);
free (buf);
buf = next;
@@ -1117,7 +1134,8 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) {
buf = (audio_buffer_t *) xine_xmalloc (sizeof (audio_buffer_t));
buf->mem = xine_xmalloc (AUDIO_BUF_SIZE);
buf->mem_size = AUDIO_BUF_SIZE;
-
+ buf->extra_info = malloc(sizeof(extra_info_t));
+
fifo_append (this->free_fifo, buf);
}
@@ -1129,6 +1147,7 @@ xine_audio_port_t *ao_new_port (xine_t *xine, ao_driver_t *driver) {
buf = (audio_buffer_t *) xine_xmalloc (sizeof (audio_buffer_t));
buf->mem = xine_xmalloc (4*AUDIO_BUF_SIZE);
buf->mem_size = 4*AUDIO_BUF_SIZE;
+ buf->extra_info = malloc(sizeof(extra_info_t));
this->frame_buf[i] = buf;
}
diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h
index c68fc9d94..99fb40496 100644
--- a/src/xine-engine/audio_out.h
+++ b/src/xine-engine/audio_out.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: audio_out.h,v 1.43 2002/11/30 22:09:42 miguelfreitas Exp $
+ * $Id: audio_out.h,v 1.44 2002/12/21 12:56:52 miguelfreitas Exp $
*/
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H
@@ -39,7 +39,7 @@ extern "C" {
#endif
-#define AUDIO_OUT_IFACE_VERSION 6
+#define AUDIO_OUT_IFACE_VERSION 7
/*
* ao_driver_s contains the driver every audio output
@@ -132,9 +132,11 @@ struct ao_driver_s {
void *node;
};
-/*
- * ao_port_s contains the port every audio decoder talks to
- */
+/* to access extra_info_t contents one have to include xine_internal.h */
+#ifndef extra_info_t
+#define extra_info_t void
+#endif
+
typedef struct audio_fifo_s audio_fifo_t;
typedef struct audio_buffer_s audio_buffer_t;
@@ -150,6 +152,12 @@ struct audio_buffer_s {
int64_t vpts;
uint32_t frame_header_count;
uint32_t first_access_unit;
+
+ /* extra info coming from input or demuxers */
+ extra_info_t *extra_info;
+
+ xine_stream_t *stream; /* stream that send that buffer */
+
};
typedef struct ao_format_s ao_format_t;
@@ -160,6 +168,10 @@ struct ao_format_s {
int mode;
};
+/*
+ * xine_audio_port_s contains the port every audio decoder talks to
+ */
+
struct xine_audio_port_s {
uint32_t (*get_capabilities) (xine_audio_port_t *this); /* for constants see below */
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c
index 4d1c50805..e4d1c7724 100644
--- a/src/xine-engine/buffer.c
+++ b/src/xine-engine/buffer.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.c,v 1.18 2002/07/17 18:36:44 miguelfreitas Exp $
+ * $Id: buffer.c,v 1.19 2002/12/21 12:56:52 miguelfreitas Exp $
*
*
* contents:
@@ -39,6 +39,7 @@
#include <stdlib.h>
#include "buffer.h"
#include "xineutils.h"
+#include "xine_internal.h"
/*
* put a previously allocated buffer element back into the buffer pool
@@ -108,8 +109,8 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) {
buf->content = buf->mem; /* 99% of demuxers will want this */
buf->pts = 0;
buf->size = 0;
- buf->input_pos = buf->input_length = buf->input_time = 0;
buf->decoder_flags = 0;
+ extra_info_reset( buf->extra_info );
return buf;
}
@@ -196,18 +197,6 @@ static void fifo_buffer_clear (fifo_buffer_t *fifo) {
buf = next;
}
- /*
- while (fifo->first != NULL) {
-
- buf = fifo->first;
-
- fifo->first = fifo->first->next;
- if (fifo->first==NULL)
- fifo->last = NULL;
-
- buf->free_buffer(buf);
- }
- */
/*printf("Free buffers after clear: %d\n", fifo->buffer_pool_num_free);*/
pthread_mutex_unlock (&fifo->mutex);
@@ -241,6 +230,7 @@ static void fifo_buffer_dispose (fifo_buffer_t *this) {
next = buf->next;
+ free (buf->extra_info);
free (buf);
received++;
@@ -251,6 +241,7 @@ static void fifo_buffer_dispose (fifo_buffer_t *this) {
buf = this->get(this);
+ free(buf->extra_info);
free(buf);
received++;
}
@@ -311,13 +302,14 @@ fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size) {
buf_element_t *buf;
buf = xine_xmalloc (sizeof (buf_element_t));
-
+
buf->mem = multi_buffer;
multi_buffer += buf_size;
buf->max_size = buf_size;
buf->free_buffer = buffer_pool_free;
buf->source = this;
+ buf->extra_info = malloc(sizeof(extra_info_t));
buffer_pool_free (buf);
}
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index f04ce9f7c..3fb3bd397 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.85 2002/12/21 03:03:15 tmmm Exp $
+ * $Id: buffer.h,v 1.86 2002/12/21 12:56:52 miguelfreitas Exp $
*
*
* contents:
@@ -135,6 +135,8 @@ extern "C" {
#define BUF_VIDEO_RV30 0x02340000
#define BUF_VIDEO_MVI2 0x02350000
#define BUF_VIDEO_UCOD 0x02360000
+#define BUF_VIDEO_WMV9 0x02370000
+
/* audio buffer types: (please keep in sync with buffer_types.c) */
@@ -177,6 +179,7 @@ extern "C" {
#define BUF_AUDIO_14_4 0x03230000
#define BUF_AUDIO_28_8 0x03240000
#define BUF_AUDIO_SIPRO 0x03250000
+#define BUF_AUDIO_WMAV3 0x03260000
/* spu buffer types: */
@@ -190,6 +193,11 @@ extern "C" {
#define BUF_DEMUX_BLOCK 0x05000000
+/* to access extra_info_t contents one have to include xine_internal.h */
+#ifndef extra_info_t
+#define extra_info_t void
+#endif
+
typedef struct buf_element_s buf_element_t;
struct buf_element_s {
buf_element_t *next;
@@ -202,13 +210,13 @@ struct buf_element_s {
uint32_t type;
int64_t pts; /* presentation time stamp, used for a/v sync */
int64_t disc_off; /* discontinuity offset */
- off_t input_pos; /* remember where this buf came from in the input source */
- off_t input_length; /* remember the length of the input source */
- int input_time;/* time offset in seconds from beginning of stream */
+ extra_info_t *extra_info; /* extra info will be passed to frames */
+
uint32_t decoder_flags; /* stuff like keyframe, is_header ... see below */
uint32_t decoder_info[4]; /* additional decoder flags and other dec-spec. stuff */
+ void *decoder_info_ptr[4]; /* pointers to dec-spec. stuff */
void (*free_buffer) (buf_element_t *buf);
@@ -257,7 +265,7 @@ struct buf_element_s {
* In a BUF_SPECIAL_PALETTE buffer:
* decoder_info[1] = BUF_SPECIAL_PALETTE
* decoder_info[2] = number of entries in palette table
- * decoder_info[3] = pointer to palette table
+ * decoder_info_ptr[2] = pointer to palette table
* This buffer type is used to provide a file- and decoder-independent
* facility to transport RGB color palettes from demuxers to decoders.
* A palette table is an array of palette_entry_t structures. A decoder
@@ -270,7 +278,8 @@ struct buf_element_s {
/*
* In a BUF_SPECIAL_IDCIN_HUFFMAN_TABLE buffer:
* decoder_info[1] = BUF_SPECIAL_IDCIN_HUFFMAN_TABLE
- * decoder_info[2] = pointer to a 65536-element byte array containing the
+ * decoder_info[2] = 65536 (size of data)
+ * decoder_info_ptr[2] = pointer to a 65536-element byte array containing the
* Huffman tables from an Id CIN file
* This buffer is used to transport the Huffman tables from an Id CIN
* file to the Id CIN decoder. A decoder should not count on the byte array
@@ -296,7 +305,7 @@ struct buf_element_s {
* In a BUF_SPECIAL_DECODER_CONFIG buffer:
* decoder_info[1] = BUF_SPECIAL_DECODER_CONFIG
* decoder_info[2] = data size
- * decoder_info[3] = pointer to data
+ * decoder_info_ptr[2] = pointer to data
* This buffer is used to pass config information from .mp4 files
* (atom esds) to decoders. both mpeg4 and aac streams use that.
*/
@@ -306,7 +315,7 @@ struct buf_element_s {
* In a BUF_SPECIAL_STSD_ATOM buffer:
* decoder_info[1] = BUF_SPECIAL_STSD_ATOM
* decoder_info[2] = size of the stsd atom
- * decoder_info[3] = pointer to stsd atom
+ * decoder_info_ptr[2] = pointer to stsd atom
* binary-only quicktime decoders need this, sent by qt demuxer
*/
#define BUF_SPECIAL_STSD_ATOM 5
@@ -341,7 +350,8 @@ struct buf_element_s {
/* In a BUF_SPECIAL_SPU_DVB_DESCRIPTOR
* decoder_info[1] = BUF_SPECIAL_SPU_DVB_DESCRIPTOR
- * decoder_info[2] = pointer to spu_dvb_descriptor_t, or NULL
+ * decoder_info[2] = size of spu_dvb_descriptor_t
+ * decoder_info_ptr[2] = pointer to spu_dvb_descriptor_t, or NULL
* decoder_info[3] =
*
* This buffer is used to tell a DVBSUB decoder when the stream
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index ee5f0132b..08a9ebf4a 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.48 2002/12/01 17:04:30 tmmm Exp $
+ * $Id: buffer_types.c,v 1.49 2002/12/21 12:56:52 miguelfreitas Exp $
*
*
* contents:
@@ -317,6 +317,14 @@ static video_db_t video_db[] = {
},
{
{
+ meFOURCC('W','M','V','3'),
+ 0
+ },
+ BUF_VIDEO_WMV9,
+ "Windows Media Video 9"
+},
+{
+ {
meFOURCC('c','r','a','m'),
meFOURCC('C','R','A','M'),
meFOURCC('M','S','V','C'),
@@ -549,6 +557,13 @@ static audio_db_t audio_db[] = {
},
{
{
+ 0x162, 0
+ },
+ BUF_AUDIO_WMAV3,
+ "Windows Media Audio v3"
+},
+{
+ {
0
},
BUF_AUDIO_DTS,
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 21e51e4ca..809f1c048 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_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: video_decoder.c,v 1.113 2002/12/12 22:54:57 guenter Exp $
+ * $Id: video_decoder.c,v 1.114 2002/12/21 12:56:52 miguelfreitas Exp $
*
*/
@@ -76,16 +76,7 @@ void *video_decoder_loop (void *stream_gen) {
#endif
buf = stream->video_fifo->get (stream->video_fifo);
-
- if (buf->input_length)
- stream->input_length = buf->input_length;
-
- if (!stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO]) {
- if (buf->input_pos)
- stream->input_pos = buf->input_pos;
- if (buf->input_time)
- stream->input_time = buf->input_time;
- }
+ extra_info_merge( stream->video_decoder_extra_info, buf->extra_info );
#ifdef LOG
printf ("video_decoder: got buffer 0x%08x\n", buf->type);
@@ -191,6 +182,7 @@ void *video_decoder_loop (void *stream_gen) {
break;
case BUF_CONTROL_RESET_DECODER:
+ extra_info_reset( stream->video_decoder_extra_info );
if (stream->video_decoder_plugin) {
stream->video_decoder_plugin->reset (stream->video_decoder_plugin);
}
diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h
index b58f0008b..e4b891e6b 100644
--- a/src/xine-engine/video_decoder.h
+++ b/src/xine-engine/video_decoder.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: video_decoder.h,v 1.7 2002/11/20 11:57:49 mroi Exp $
+ * $Id: video_decoder.h,v 1.8 2002/12/21 12:56:52 miguelfreitas Exp $
*
* xine video decoder plugin interface
*
@@ -29,7 +29,7 @@
#include <inttypes.h>
#include "buffer.h"
-#define VIDEO_DECODER_IFACE_VERSION 13
+#define VIDEO_DECODER_IFACE_VERSION 14
/*
* generic xine video decoder plugin interface
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 3bffbee41..b5c50bcd1 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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: video_out.c,v 1.119 2002/12/20 18:14:34 jkeil Exp $
+ * $Id: video_out.c,v 1.120 2002/12/21 12:56:52 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -269,6 +269,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->ratio = ratio;
img->format = format;
img->copy_called = 0;
+ extra_info_reset ( img->extra_info );
/* let driver ensure this image has the right format */
@@ -292,6 +293,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
int64_t pic_vpts ;
int frames_to_skip;
+ img->stream = stream;
+ extra_info_merge( img->extra_info, stream->video_decoder_extra_info );
+
stream->metronom->got_video_frame (stream->metronom, img);
pic_vpts = img->vpts;
@@ -365,7 +369,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
*/
if ((this->num_frames_delivered % 200) == 0
- && (this->num_frames_skipped || this->num_frames_discarded)) {
+ && (this->num_frames_skipped || this->num_frames_discarded)) {
xine_log(this->xine, XINE_LOG_MSG,
_("%d frames delivered, %d frames skipped, %d frames discarded\n"),
this->num_frames_delivered,
@@ -445,6 +449,9 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
dupl->vpts = 0;
dupl->duration = img->duration;
+ dupl->stream = img->stream;
+ memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) );
+
/* delay frame copying for now, we might not even need it (eg. frame will be discarded) */
/* vo_frame_driver_copy(dupl); */
@@ -473,7 +480,7 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) {
diff = cur_vpts - pts;
if (diff > img->duration) {
-
+
/* do not print this message in stop/exit (scr is adjusted to force
* discarding audio and video frames)
*/
@@ -485,6 +492,8 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) {
this->num_frames_discarded++;
img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue);
+
+ extra_info_merge( img->stream->current_extra_info, img->extra_info );
/*
* last frame? back it up for
@@ -598,19 +607,10 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) {
*/
pthread_mutex_lock( &this->free_img_buf_queue->mutex );
if (img && !img->next) {
- xine_stream_t *stream;
- int backup_needed = 0;
- pthread_mutex_lock(&this->streams_lock);
- for (stream = xine_list_first_content(this->streams); stream;
- stream = xine_list_next_content(this->streams)) {
- if (stream->stream_info[XINE_STREAM_INFO_VIDEO_HAS_STILL] ||
- stream->video_fifo->size(stream->video_fifo) < 10)
- backup_needed = 1;
- }
- pthread_mutex_unlock(&this->streams_lock);
+ if (img->stream->stream_info[XINE_STREAM_INFO_VIDEO_HAS_STILL] ||
+ img->stream->video_fifo->size(img->stream->video_fifo) < 10) {
- if( backup_needed ) {
/*#ifdef LOG*/
printf ("video_out: possible still frame\n");
/*#endif*/
@@ -643,6 +643,8 @@ static void overlay_and_display_frame (vos_t *this,
*/
if( img->copy && !img->copy_called )
vo_frame_driver_copy(img);
+
+ extra_info_merge( img->stream->current_extra_info, img->extra_info );
if (this->overlay_source) {
this->overlay_source->multiple_overlay_blend (this->overlay_source,
@@ -733,7 +735,7 @@ static void *video_out_loop (void *this_gen) {
vos_t *this = (vos_t *) this_gen;
int64_t frame_duration, next_frame_vpts;
int64_t usec_to_sleep;
-
+
/*
* here it is - the heart of xine (or rather: one of the hearts
* of xine) : the video output loop
@@ -961,11 +963,13 @@ static void vo_free_img_buffers (xine_video_port_t *this_gen) {
while (this->free_img_buf_queue->first) {
img = vo_remove_from_img_buf_queue (this->free_img_buf_queue);
+ free(img->extra_info);
img->dispose (img);
}
while (this->display_img_buf_queue->first) {
img = vo_remove_from_img_buf_queue (this->display_img_buf_queue) ;
+ free(img->extra_info);
img->dispose (img);
}
}
@@ -1135,6 +1139,8 @@ xine_video_port_t *vo_new_port (xine_t *xine, vo_driver_t *driver) {
img->displayed = vo_frame_dec_lock;
img->draw = vo_frame_draw;
+ img->extra_info = malloc(sizeof(extra_info_t));
+
vo_append_to_img_buf_queue (this->free_img_buf_queue,
img);
}
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index f29d0d6a8..52b2bda4b 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.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: video_out.h,v 1.73 2002/12/06 01:30:49 miguelfreitas Exp $
+ * $Id: video_out.h,v 1.74 2002/12/21 12:56:52 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -54,6 +54,10 @@ typedef struct vo_overlay_s vo_overlay_t;
typedef struct video_overlay_instance_s video_overlay_instance_t;
typedef struct vo_driver_s vo_driver_t;
+/* to access extra_info_t contents one have to include xine_internal.h */
+#ifndef extra_info_t
+#define extra_info_t void
+#endif
/* public part, video drivers may add private fields */
struct vo_frame_s {
@@ -102,7 +106,10 @@ struct vo_frame_s {
/* pan/scan offset */
int pan_scan_x;
int pan_scan_y;
-
+
+ /* extra info coming from input or demuxers */
+ extra_info_t *extra_info;
+
/* additional information to be able to duplicate frames: */
int width, height;
int ratio; /* aspect ratio, codes see below */
@@ -114,7 +121,7 @@ struct vo_frame_s {
/* "backward" references to where this frame originates from */
xine_video_port_t *port;
vo_driver_t *driver;
-
+ xine_stream_t *stream;
/*
* that part is used only by video_out.c for frame management
@@ -247,7 +254,7 @@ struct xine_video_port_s {
* from generic vo functions.
*/
-#define VIDEO_OUT_DRIVER_IFACE_VERSION 13
+#define VIDEO_OUT_DRIVER_IFACE_VERSION 14
struct vo_driver_s {
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index aa554be30..26cb21c81 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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.c,v 1.199 2002/12/08 21:43:52 miguelfreitas Exp $
+ * $Id: xine.c,v 1.200 2002/12/21 12:56:52 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -98,6 +98,24 @@ void xine_report_codec (xine_stream_t *stream, int codec_type,
}
}
+void extra_info_reset( extra_info_t *extra_info ) {
+ memset( extra_info, 0, sizeof(extra_info_t) );
+}
+
+void extra_info_merge( extra_info_t *dst, extra_info_t *src ) {
+
+ if( src->input_pos )
+ dst->input_pos = src->input_pos;
+
+ if( src->input_length )
+ dst->input_length = src->input_length;
+
+ if( src->input_time )
+ dst->input_time = src->input_time;
+
+ if( src->frame_number )
+ dst->frame_number = src->frame_number;
+}
static void xine_set_speed_internal (xine_stream_t *stream, int speed) {
@@ -268,8 +286,11 @@ xine_stream_t *xine_stream_new (xine_t *this,
*/
pthread_mutex_lock (&this->streams_lock);
-
+
stream = (xine_stream_t *) xine_xmalloc (sizeof (xine_stream_t)) ;
+ stream->current_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
+ stream->audio_decoder_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
+ stream->video_decoder_extra_info = xine_xmalloc( sizeof( extra_info_t ) );
stream->xine = this;
stream->status = XINE_STATUS_STOP;
@@ -277,9 +298,6 @@ xine_stream_t *xine_stream_new (xine_t *this,
stream->stream_info[i] = 0;
stream->meta_info[i] = NULL;
}
- stream->input_pos = 0;
- stream->input_length = 0;
- stream->input_time = 0;
stream->spu_out = NULL;
stream->spu_decoder_plugin = NULL;
stream->spu_decoder_streamtype = -1;
@@ -369,7 +387,6 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
*/
xine_close_internal (stream);
- stream->input_length = 0;
#ifdef LOG
printf ("xine: engine should be stopped now\n");
@@ -597,6 +614,10 @@ static int xine_open_internal (xine_stream_t *stream, const char *mrl) {
= strdup (stream->demux_plugin->demux_class->get_identifier(stream->demux_plugin->demux_class));
}
+ extra_info_reset( stream->current_extra_info );
+ extra_info_reset( stream->video_decoder_extra_info );
+ extra_info_reset( stream->audio_decoder_extra_info );
+
/*
* send and decode headers
*/
@@ -729,7 +750,7 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
xine_demux_start_thread( stream );
stream->status = XINE_STATUS_PLAY;
}
-
+
pthread_mutex_lock (&stream->first_frame_lock);
stream->first_frame_flag = 1;
pthread_mutex_unlock (&stream->first_frame_lock);
@@ -800,6 +821,9 @@ void xine_dispose (xine_stream_t *stream) {
stream->metronom->exit (stream->metronom);
+ free (stream->current_extra_info);
+ free (stream->video_decoder_extra_info);
+ free (stream->audio_decoder_extra_info);
free (stream);
}
@@ -935,7 +959,7 @@ static int xine_get_current_position (xine_stream_t *stream) {
off_t len;
double share;
-
+
pthread_mutex_lock (&stream->frontend_lock);
if (!stream->input_plugin) {
@@ -943,11 +967,18 @@ static int xine_get_current_position (xine_stream_t *stream) {
pthread_mutex_unlock (&stream->frontend_lock);
return 0;
}
+
+ if ( (!stream->video_decoder_plugin && !stream->audio_decoder_plugin) ||
+ !stream->first_frame_flag ) {
+ if( stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] )
+ extra_info_merge( stream->current_extra_info, stream->video_decoder_extra_info );
+ else
+ extra_info_merge( stream->current_extra_info, stream->audio_decoder_extra_info );
+ }
- /* pos = stream->mCurInput->seek (0, SEEK_CUR); */
- len = stream->input_length;
+ len = stream->current_extra_info->input_length;
if (len == 0) len = stream->input_plugin->get_length (stream->input_plugin);
- share = (double) stream->input_pos / (double) len * 65535;
+ share = (double) stream->current_extra_info->input_pos / (double) len * 65535;
pthread_mutex_unlock (&stream->frontend_lock);
@@ -1005,10 +1036,12 @@ static int xine_get_stream_length (xine_stream_t *stream) {
int xine_get_pos_length (xine_stream_t *stream, int *pos_stream,
int *pos_time, int *length_time) {
+ xine_get_current_position (stream); /* force updating extra_info */
+
if (pos_stream)
*pos_stream = xine_get_current_position (stream);
if (pos_time)
- *pos_time = stream->input_time * 1000;
+ *pos_time = stream->current_extra_info->input_time * 1000;
if (length_time)
*length_time = xine_get_stream_length (stream) * 1000;
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 6d8373bab..67da17d62 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.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: xine_internal.h,v 1.114 2002/12/06 18:38:49 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.115 2002/12/21 12:56:52 miguelfreitas Exp $
*
*/
@@ -30,6 +30,12 @@ extern "C" {
#include <inttypes.h>
+
+#ifdef extra_info_t
+#undef extra_info_t
+#endif
+#define extra_info_t struct extra_info_s
+
/*
* include public part of xine header
*/
@@ -113,6 +119,20 @@ struct xine_s {
};
/*
+ * extra_info_t is used to pass information from input or demuxer plugins
+ * to output frames (past decoder). new data must be added after the existing
+ * fields for backward compatibility.
+ */
+
+struct extra_info_s {
+
+ off_t input_pos; /* remember where this buf came from in the input source */
+ off_t input_length; /* remember the length of the input source */
+ int input_time;/* time offset in seconds from beginning of stream */
+ uint32_t frame_number; /* number of current frame if known */
+};
+
+/*
* xine event queue
*/
@@ -142,9 +162,6 @@ struct xine_stream_s {
demux_plugin_t *demux_plugin;
metronom_t *metronom;
- off_t input_pos;
- off_t input_length;
- int input_time;
xine_video_port_t *video_out;
vo_driver_t *video_driver;
@@ -152,6 +169,7 @@ struct xine_stream_s {
pthread_t video_thread;
video_decoder_t *video_decoder_plugin;
int video_decoder_streamtype;
+ extra_info_t *video_decoder_extra_info;
int video_channel;
xine_audio_port_t *audio_out;
@@ -160,6 +178,7 @@ struct xine_stream_s {
pthread_t audio_thread;
audio_decoder_t *audio_decoder_plugin;
int audio_decoder_streamtype;
+ extra_info_t *audio_decoder_extra_info;
uint32_t audio_track_map[50];
int audio_track_map_entries;
uint32_t audio_type;
@@ -213,6 +232,8 @@ struct xine_stream_s {
pthread_mutex_t demux_lock;
int demux_action_pending;
+ extra_info_t *current_extra_info;
+
int err;
};
@@ -243,6 +264,12 @@ void audio_decoder_shutdown (xine_stream_t *stream);
void xine_report_codec (xine_stream_t *stream, int codec_type,
uint32_t fourcc, uint32_t buf_type, int handled) ;
+/* extra_info operations */
+void extra_info_reset( extra_info_t *extra_info );
+
+void extra_info_merge( extra_info_t *dst, extra_info_t *src );
+
+
/* demuxer helper functions from demux.c */
void xine_demux_flush_engine (xine_stream_t *stream);