summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEwald Snel <esnel@users.sourceforge.net>2002-12-27 22:49:38 +0000
committerEwald Snel <esnel@users.sourceforge.net>2002-12-27 22:49:38 +0000
commit651bba5ba5847cc7c589631cf780937b3f948eae (patch)
treebd62e6a8d463eac8b6a6e5636ad4eef453ba51ae /src
parent38cf26ec4edfe9c455372cf428601a1b0ff5bdad (diff)
downloadxine-lib-651bba5ba5847cc7c589631cf780937b3f948eae.tar.gz
xine-lib-651bba5ba5847cc7c589631cf780937b3f948eae.tar.bz2
Fix 'XINE_STREAM_INFO_MAX_SPU_CHANNEL' property
- Calculate number of spu channels in video_decoder_loop() - Use 'track_map' for spu channels, just like audio channels CVS patchset: 3700 CVS date: 2002/12/27 22:49:38
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/audio_decoder.c6
-rw-r--r--src/xine-engine/video_decoder.c37
-rw-r--r--src/xine-engine/xine_interface.c10
-rw-r--r--src/xine-engine/xine_internal.h4
4 files changed, 48 insertions, 9 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 104539871..67a18775c 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.96 2002/12/27 00:53:50 guenter Exp $
+ * $Id: audio_decoder.c,v 1.97 2002/12/27 22:49:38 esnel Exp $
*
*
* functions that implement audio decoding
@@ -199,6 +199,10 @@ void *audio_decoder_loop (void *stream_gen) {
|| (stream->audio_track_map[i] != buf->type) ) {
j = stream->audio_track_map_entries;
+
+ if (j >= 50)
+ break;
+
while (j>i) {
stream->audio_track_map[j] = stream->audio_track_map[j-1];
j--;
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 5618c80d6..f29949930 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.117 2002/12/26 21:53:42 miguelfreitas Exp $
+ * $Id: video_decoder.c,v 1.118 2002/12/27 22:49:38 esnel Exp $
*
*/
@@ -101,6 +101,7 @@ void *video_decoder_loop (void *stream_gen) {
if (stream->spu_decoder_plugin) {
free_spu_decoder (stream, stream->spu_decoder_plugin);
stream->spu_decoder_plugin = NULL;
+ stream->spu_track_map_entries = 0;
}
stream->metronom->handle_video_discontinuity (stream->metronom,
@@ -173,6 +174,7 @@ void *video_decoder_loop (void *stream_gen) {
if (stream->spu_decoder_plugin) {
free_spu_decoder (stream, stream->spu_decoder_plugin);
stream->spu_decoder_plugin = NULL;
+ stream->spu_track_map_entries = 0;
}
running = 0;
@@ -279,6 +281,9 @@ void *video_decoder_loop (void *stream_gen) {
} else if ( (buf->type & 0xFF000000) == BUF_SPU_BASE ) {
+ uint32_t spu_type = 0;
+ int i,j;
+
if (stream->stream_info[XINE_STREAM_INFO_IGNORE_SPU])
break;
@@ -286,6 +291,35 @@ void *video_decoder_loop (void *stream_gen) {
update_spu_decoder(stream, buf->type);
+ /* update track map */
+
+ i = 0;
+ while ( (i<stream->spu_track_map_entries) && (stream->spu_track_map[i]<buf->type) )
+ i++;
+
+ if ( (i==stream->spu_track_map_entries)
+ || (stream->spu_track_map[i] != buf->type) ) {
+
+ j = stream->spu_track_map_entries;
+
+ if (j >= 50)
+ break;
+
+ while (j>i) {
+ stream->spu_track_map[j] = stream->spu_track_map[j-1];
+ j--;
+ }
+ stream->spu_track_map[i] = buf->type;
+ stream->spu_track_map_entries++;
+ }
+
+ if (stream->spu_channel_user >= 0) {
+ if (stream->spu_channel_user <= stream->spu_track_map_entries)
+ stream->spu_channel = stream->spu_track_map[stream->spu_channel_user];
+ else
+ stream->spu_channel = stream->spu_channel_auto;
+ }
+
if (stream->spu_decoder_plugin) {
stream->spu_decoder_plugin->decode_data (stream->spu_decoder_plugin, buf);
}
@@ -324,6 +358,7 @@ void video_decoder_init (xine_stream_t *stream) {
* larger chunks.
*/
stream->video_fifo = fifo_buffer_new (500, 8192);
+ stream->spu_track_map_entries = 0;
pthread_attr_init(&pth_attrs);
pthread_attr_getschedparam(&pth_attrs, &pth_params);
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 70ae17f8e..959f41469 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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_interface.c,v 1.36 2002/12/27 03:40:08 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.37 2002/12/27 22:49:38 esnel Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -509,14 +509,12 @@ uint32_t xine_get_stream_info (xine_stream_t *stream, int info) {
case XINE_STREAM_INFO_VIDEO_HAS_STILL:
return stream->stream_info[info];
-/* TODO:
- case XINE_STREAM_INFO_MAX_SPU_CHANNEL:
- return 0;
-*/
-
case XINE_STREAM_INFO_MAX_AUDIO_CHANNEL:
return stream->audio_track_map_entries;
+ case XINE_STREAM_INFO_MAX_SPU_CHANNEL:
+ return stream->spu_track_map_entries;
+
default:
printf ("xine_interface: error, unknown stream info (%d) requested\n",
info);
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 859b661ad..cd6bba59e 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.119 2002/12/27 13:44:59 guenter Exp $
+ * $Id: xine_internal.h,v 1.120 2002/12/27 22:49:38 esnel Exp $
*
*/
@@ -193,6 +193,8 @@ struct xine_stream_s {
pthread_t spu_thread;
spu_decoder_t *spu_decoder_plugin;
int spu_decoder_streamtype;
+ uint32_t spu_track_map[50];
+ int spu_track_map_entries;
int spu_channel_user;
int spu_channel_auto;
int spu_channel_letterbox;