summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/Makefile.am2
-rw-r--r--src/xine-engine/buffer.h26
-rw-r--r--src/xine-engine/buffer_types.c227
-rw-r--r--src/xine-engine/demux.c111
-rw-r--r--src/xine-engine/xine.c32
-rw-r--r--src/xine-engine/xine_internal.h16
6 files changed, 269 insertions, 145 deletions
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 49744095e..e492330ca 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -10,7 +10,7 @@ lib_LTLIBRARIES = libxine.la
libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
load_plugins.c video_decoder.c buffer_types.c \
audio_decoder.c video_out.c audio_out.c resample.c events.c lrb.c \
- video_overlay.c osd.c scratch.c locale.c
+ video_overlay.c osd.c scratch.c locale.c demux.c
libxine_la_DEPENDENCIES = @INTLLIBS@
libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ $(ZLIB_LIBS) -lm
diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h
index 5a49f02db..50e8dad98 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.47 2002/06/03 16:20:36 miguelfreitas Exp $
+ * $Id: buffer.h,v 1.48 2002/06/07 02:40:47 miguelfreitas Exp $
*
*
* contents:
@@ -246,8 +246,11 @@ struct fifo_buffer_s
fifo_buffer_t *fifo_buffer_new (int num_buffers, uint32_t buf_size);
-/* return BUF_VIDEO_xxx given the fourcc */
-uint32_t fourcc_to_buf_video( void * fourcc );
+/* return BUF_VIDEO_xxx given the fourcc
+ * fourcc_int must be read in machine endianness
+ * example: fourcc_int = *(uint32_t *)fourcc_char;
+ */
+uint32_t fourcc_to_buf_video( uint32_t fourcc_int );
/* return codec name given BUF_VIDEO_xxx */
char * buf_video_name( uint32_t buf_type );
@@ -270,7 +273,7 @@ typedef struct {
int32_t biHeight;
int16_t biPlanes;
int16_t biBitCount;
- int32_t biCompression;
+ uint32_t biCompression;
int32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
@@ -281,6 +284,21 @@ typedef struct {
/* convert xine_bmiheader struct from little endian */
void xine_bmiheader_le2me( xine_bmiheader *bih );
+/* this is xine version of WAVEFORMATEX
+ * (the same comments from xine_bmiheader)
+ */
+typedef struct {
+ int16_t wFormatTag;
+ int16_t nChannels;
+ int32_t nSamplesPerSec;
+ int32_t nAvgBytesPerSec;
+ int16_t nBlockAlign;
+ int16_t wBitsPerSample;
+ int16_t cbSize;
+} xine_waveformatex;
+
+/* convert xine_waveformatex struct from little endian */
+void xine_waveformatex_le2me( xine_waveformatex *wavex );
#ifdef __cplusplus
}
diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c
index f27cdf3cd..f6f4a9902 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.22 2002/06/05 22:44:52 tmattern Exp $
+ * $Id: buffer_types.c,v 1.23 2002/06/07 02:40:47 miguelfreitas Exp $
*
*
* contents:
@@ -38,10 +38,19 @@
#include "buffer.h"
#include "bswap.h"
-#ifndef mmioFOURCC
-#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
- ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
- ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
+/* FOURCC will be manipulated using machine endian */
+#ifdef WORDS_BIGENDIAN
+#define meFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(unsigned char)(ch3) | \
+ ( (uint32_t)(unsigned char)(ch2) << 8 ) | \
+ ( (uint32_t)(unsigned char)(ch1) << 16 ) | \
+ ( (uint32_t)(unsigned char)(ch0) << 24 ) )
+#else
+#define meFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(unsigned char)(ch0) | \
+ ( (uint32_t)(unsigned char)(ch1) << 8 ) | \
+ ( (uint32_t)(unsigned char)(ch2) << 16 ) | \
+ ( (uint32_t)(unsigned char)(ch3) << 24 ) )
#endif
@@ -61,7 +70,7 @@ typedef struct audio_db_s {
static video_db_t video_db[] = {
{
{
- mmioFOURCC('m', 'p', 'e', 'g'),
+ meFOURCC('m', 'p', 'e', 'g'),
0
},
BUF_VIDEO_MPEG,
@@ -69,12 +78,12 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'I', 'V', 'X'),
- mmioFOURCC('d', 'i', 'v', 'x'),
- mmioFOURCC('D', 'i', 'v', 'x'),
- mmioFOURCC('D', 'i', 'v', 'X'),
- mmioFOURCC('M', 'P', '4', 'S'),
- mmioFOURCC('m', 'p', '4', 'v'),
+ meFOURCC('D', 'I', 'V', 'X'),
+ meFOURCC('d', 'i', 'v', 'x'),
+ meFOURCC('D', 'i', 'v', 'x'),
+ meFOURCC('D', 'i', 'v', 'X'),
+ meFOURCC('M', 'P', '4', 'S'),
+ meFOURCC('m', 'p', '4', 'v'),
0
},
BUF_VIDEO_MPEG4,
@@ -82,7 +91,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('X', 'V', 'I', 'D'),
+ meFOURCC('X', 'V', 'I', 'D'),
0
},
BUF_VIDEO_XVID,
@@ -90,7 +99,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'X', '5', '0'),
+ meFOURCC('D', 'X', '5', '0'),
0
},
BUF_VIDEO_DIVX5,
@@ -98,7 +107,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c', 'v', 'i', 'd'),
+ meFOURCC('c', 'v', 'i', 'd'),
0
},
BUF_VIDEO_CINEPAK,
@@ -106,9 +115,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('S', 'V', 'Q', '1'),
- mmioFOURCC('s', 'v', 'q', '1'),
- mmioFOURCC('s', 'v', 'q', 'i'),
+ meFOURCC('S', 'V', 'Q', '1'),
+ meFOURCC('s', 'v', 'q', '1'),
+ meFOURCC('s', 'v', 'q', 'i'),
0
},
BUF_VIDEO_SORENSON_V1,
@@ -116,8 +125,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('S', 'V', 'Q', '3'),
- mmioFOURCC('s', 'v', 'q', '3'),
+ meFOURCC('S', 'V', 'Q', '3'),
+ meFOURCC('s', 'v', 'q', '3'),
0
},
BUF_VIDEO_SORENSON_V3,
@@ -125,14 +134,14 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('M', 'P', '4', '1'),
- mmioFOURCC('m', 'p', '4', '1'),
- mmioFOURCC('M', 'P', '4', '2'),
- mmioFOURCC('m', 'p', '4', '2'),
- mmioFOURCC('D', 'I', 'V', '2'),
- mmioFOURCC('d', 'i', 'v', '2'),
- mmioFOURCC('M', 'P', 'G', '4'),
- mmioFOURCC('m', 'p', 'g', '4'),
+ meFOURCC('M', 'P', '4', '1'),
+ meFOURCC('m', 'p', '4', '1'),
+ meFOURCC('M', 'P', '4', '2'),
+ meFOURCC('m', 'p', '4', '2'),
+ meFOURCC('D', 'I', 'V', '2'),
+ meFOURCC('d', 'i', 'v', '2'),
+ meFOURCC('M', 'P', 'G', '4'),
+ meFOURCC('m', 'p', 'g', '4'),
0
},
BUF_VIDEO_MSMPEG4_V12,
@@ -140,18 +149,18 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('M', 'P', '4', '3'),
- mmioFOURCC('m', 'p', '4', '3'),
- mmioFOURCC('D', 'I', 'V', '3'),
- mmioFOURCC('d', 'i', 'v', '3'),
- mmioFOURCC('D', 'I', 'V', '4'),
- mmioFOURCC('d', 'i', 'v', '4'),
- mmioFOURCC('D', 'I', 'V', '5'),
- mmioFOURCC('d', 'i', 'v', '5'),
- mmioFOURCC('D', 'I', 'V', '6'),
- mmioFOURCC('d', 'i', 'v', '6'),
- mmioFOURCC('A', 'P', '4', '1'),
- mmioFOURCC('M', 'P', 'G', '3'),
+ meFOURCC('M', 'P', '4', '3'),
+ meFOURCC('m', 'p', '4', '3'),
+ meFOURCC('D', 'I', 'V', '3'),
+ meFOURCC('d', 'i', 'v', '3'),
+ meFOURCC('D', 'I', 'V', '4'),
+ meFOURCC('d', 'i', 'v', '4'),
+ meFOURCC('D', 'I', 'V', '5'),
+ meFOURCC('d', 'i', 'v', '5'),
+ meFOURCC('D', 'I', 'V', '6'),
+ meFOURCC('d', 'i', 'v', '6'),
+ meFOURCC('A', 'P', '4', '1'),
+ meFOURCC('M', 'P', 'G', '3'),
0
},
BUF_VIDEO_MSMPEG4_V3,
@@ -159,7 +168,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('3', 'I', 'V', '1'),
+ meFOURCC('3', 'I', 'V', '1'),
0
},
BUF_VIDEO_3IVX,
@@ -167,10 +176,10 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('d', 'm', 'b', '1'),
- mmioFOURCC('M', 'J', 'P', 'G'),
- mmioFOURCC('m', 'j', 'p', 'a'),
- mmioFOURCC('m', 'j', 'p', 'b'),
+ meFOURCC('d', 'm', 'b', '1'),
+ meFOURCC('M', 'J', 'P', 'G'),
+ meFOURCC('m', 'j', 'p', 'a'),
+ meFOURCC('m', 'j', 'p', 'b'),
0
},
BUF_VIDEO_MJPEG,
@@ -178,8 +187,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '5', '0'),
- mmioFOURCC('i', 'v', '5', '0'),
+ meFOURCC('I', 'V', '5', '0'),
+ meFOURCC('i', 'v', '5', '0'),
0
},
BUF_VIDEO_IV50,
@@ -187,8 +196,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '4', '1'),
- mmioFOURCC('i', 'v', '4', '1'),
+ meFOURCC('I', 'V', '4', '1'),
+ meFOURCC('i', 'v', '4', '1'),
0
},
BUF_VIDEO_IV41,
@@ -196,8 +205,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '3', '2'),
- mmioFOURCC('i', 'v', '3', '2'),
+ meFOURCC('I', 'V', '3', '2'),
+ meFOURCC('i', 'v', '3', '2'),
0
},
BUF_VIDEO_IV32,
@@ -205,8 +214,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', 'V', '3', '1'),
- mmioFOURCC('i', 'v', '3', '1'),
+ meFOURCC('I', 'V', '3', '1'),
+ meFOURCC('i', 'v', '3', '1'),
0
},
BUF_VIDEO_IV31,
@@ -214,7 +223,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V', 'C', 'R', '1'),
+ meFOURCC('V', 'C', 'R', '1'),
0
},
BUF_VIDEO_ATIVCR1,
@@ -222,7 +231,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V', 'C', 'R', '2'),
+ meFOURCC('V', 'C', 'R', '2'),
0
},
BUF_VIDEO_ATIVCR2,
@@ -230,11 +239,11 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('I', '2', '6', '3'),
- mmioFOURCC('i', '2', '6', '3'),
- mmioFOURCC('V', 'I', 'V', 'O'),
- mmioFOURCC('v', 'i', 'v', 'o'),
- mmioFOURCC('v', 'i', 'v', '1'),
+ meFOURCC('I', '2', '6', '3'),
+ meFOURCC('i', '2', '6', '3'),
+ meFOURCC('V', 'I', 'V', 'O'),
+ meFOURCC('v', 'i', 'v', 'o'),
+ meFOURCC('v', 'i', 'v', '1'),
0
},
BUF_VIDEO_I263,
@@ -249,7 +258,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r','a','w',' '),
+ meFOURCC('r','a','w',' '),
0
},
BUF_VIDEO_RGB,
@@ -261,7 +270,7 @@ static video_db_t video_db[] = {
else if (!strncasecmp (video, "yuv2", 4))
this->video_type = BUF_VIDEO_YUY2;
*/
- mmioFOURCC('y','u','v','2'),
+ meFOURCC('y','u','v','2'),
0
},
BUF_VIDEO_YUY2,
@@ -269,7 +278,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('j','p','e','g'),
+ meFOURCC('j','p','e','g'),
0
},
BUF_VIDEO_JPEG,
@@ -277,7 +286,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('W','M','V','1'),
+ meFOURCC('W','M','V','1'),
0
},
BUF_VIDEO_WMV7,
@@ -285,7 +294,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('W','M','V','2'),
+ meFOURCC('W','M','V','2'),
0
},
BUF_VIDEO_WMV8,
@@ -293,12 +302,12 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c','r','a','m'),
- mmioFOURCC('C','R','A','M'),
- mmioFOURCC('M','S','V','C'),
- mmioFOURCC('m','s','v','c'),
- mmioFOURCC('W','H','A','M'),
- mmioFOURCC('w','h','a','m'),
+ meFOURCC('c','r','a','m'),
+ meFOURCC('C','R','A','M'),
+ meFOURCC('M','S','V','C'),
+ meFOURCC('m','s','v','c'),
+ meFOURCC('W','H','A','M'),
+ meFOURCC('w','h','a','m'),
0
},
BUF_VIDEO_MSVC,
@@ -306,9 +315,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D','V','S','D'),
- mmioFOURCC('d','v','s','d'),
- mmioFOURCC('d','v','c','p'),
+ meFOURCC('D','V','S','D'),
+ meFOURCC('d','v','s','d'),
+ meFOURCC('d','v','c','p'),
0
},
BUF_VIDEO_DV,
@@ -316,10 +325,10 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('V','P','3','0'),
- mmioFOURCC('v','p','3','0'),
- mmioFOURCC('V','P','3','1'),
- mmioFOURCC('v','p','3','1'),
+ meFOURCC('V','P','3','0'),
+ meFOURCC('v','p','3','0'),
+ meFOURCC('V','P','3','1'),
+ meFOURCC('v','p','3','1'),
0
},
BUF_VIDEO_VP31,
@@ -327,9 +336,9 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('H', '2', '6', '3'),
- mmioFOURCC('h', '2', '6', '3'),
- mmioFOURCC('U', '2', '6', '3'),
+ meFOURCC('H', '2', '6', '3'),
+ meFOURCC('h', '2', '6', '3'),
+ meFOURCC('U', '2', '6', '3'),
0
},
BUF_VIDEO_H263,
@@ -337,8 +346,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('c', 'y', 'u', 'v'),
- mmioFOURCC('C', 'Y', 'U', 'V'),
+ meFOURCC('c', 'y', 'u', 'v'),
+ meFOURCC('C', 'Y', 'U', 'V'),
0
},
BUF_VIDEO_CYUV,
@@ -346,7 +355,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('s', 'm', 'c', ' '),
+ meFOURCC('s', 'm', 'c', ' '),
0
},
BUF_VIDEO_SMC,
@@ -354,8 +363,8 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r', 'p', 'z', 'a'),
- mmioFOURCC('a', 'z', 'p', 'r'),
+ meFOURCC('r', 'p', 'z', 'a'),
+ meFOURCC('a', 'z', 'p', 'r'),
0
},
BUF_VIDEO_RPZA,
@@ -363,7 +372,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('r', 'l', 'e', ' '),
+ meFOURCC('r', 'l', 'e', ' '),
0
},
BUF_VIDEO_QTRLE,
@@ -378,7 +387,7 @@ static video_db_t video_db[] = {
},
{
{
- mmioFOURCC('D', 'U', 'C', 'K'),
+ meFOURCC('D', 'U', 'C', 'K'),
0
},
BUF_VIDEO_DUCKTM1,
@@ -399,7 +408,7 @@ static audio_db_t audio_db[] = {
{
{
0x50, 0x55,
- mmioFOURCC('.','m','p','3'), 0
+ meFOURCC('.','m','p','3'), 0
},
BUF_AUDIO_MPEG,
"MPEG layer 2/3"
@@ -414,7 +423,7 @@ static audio_db_t audio_db[] = {
{
{
0x01,
- mmioFOURCC('r','a','w',' '),
+ meFOURCC('r','a','w',' '),
0
},
BUF_AUDIO_LPCM_LE,
@@ -460,7 +469,7 @@ static audio_db_t audio_db[] = {
/* these formattags are used by Vorbis ACM encoder and
supported by NanDub, a variant of VirtualDub. */
0x674f, 0x676f, 0x6750, 0x6770, 0x6751, 0x6771,
- mmioFOURCC('O','g','g','S'),
+ meFOURCC('O','g','g','S'),
0
},
BUF_AUDIO_VORBIS,
@@ -517,7 +526,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('i', 'm', 'a', '4'),
+ meFOURCC('i', 'm', 'a', '4'),
0
},
BUF_AUDIO_QTIMAADPCM,
@@ -525,7 +534,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('m', 'a', 'c', '3'),
+ meFOURCC('m', 'a', 'c', '3'),
0
},
BUF_AUDIO_MAC3,
@@ -533,7 +542,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('m', 'a', 'c', '6'),
+ meFOURCC('m', 'a', 'c', '6'),
0
},
BUF_AUDIO_MAC6,
@@ -541,7 +550,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('Q', 'D', 'M', 'C'),
+ meFOURCC('Q', 'D', 'M', 'C'),
0
},
BUF_AUDIO_QDESIGN1,
@@ -549,7 +558,7 @@ static audio_db_t audio_db[] = {
},
{
{
- mmioFOURCC('Q', 'D', 'M', '2'),
+ meFOURCC('Q', 'D', 'M', '2'),
0
},
BUF_AUDIO_QDESIGN2,
@@ -559,19 +568,11 @@ static audio_db_t audio_db[] = {
};
-static unsigned long str2ulong(unsigned char *str)
-{
- return ( str[0] | (str[1]<<8) | (str[2]<<16) | (str[3]<<24) );
-}
-
-uint32_t fourcc_to_buf_video( void * fourcc ) {
+uint32_t fourcc_to_buf_video( uint32_t fourcc_int ) {
int i, j;
-uint32_t fourcc_int;
static uint32_t cached_fourcc=0;
static uint32_t cached_buf_type=0;
- fourcc_int = str2ulong(fourcc);
-
if( fourcc_int == cached_fourcc )
return cached_buf_type;
@@ -636,17 +637,29 @@ int i;
}
void xine_bmiheader_le2me( xine_bmiheader *bih ) {
+ /* OBS: fourcc must be read using machine endianness
+ * so don't play with biCompression here!
+ */
bih->biSize = le2me_32(bih->biSize);
bih->biWidth = le2me_32(bih->biWidth);
bih->biHeight = le2me_32(bih->biHeight);
bih->biPlanes = le2me_16(bih->biPlanes);
bih->biBitCount = le2me_16(bih->biBitCount);
- /* do not change byte order of fourcc */
- /* bih->biCompression = le2me_32(bih->biCompression); */
bih->biSizeImage = le2me_32(bih->biSizeImage);
bih->biXPelsPerMeter = le2me_32(bih->biXPelsPerMeter);
bih->biYPelsPerMeter = le2me_32(bih->biYPelsPerMeter);
bih->biClrUsed = le2me_32(bih->biClrUsed);
bih->biClrImportant = le2me_32(bih->biClrImportant);
}
+
+void xine_waveformatex_le2me( xine_waveformatex *wavex ) {
+
+ wavex->wFormatTag = le2me_16(wavex->wFormatTag);
+ wavex->nChannels = le2me_16(wavex->nChannels);
+ wavex->nSamplesPerSec = le2me_32(wavex->nSamplesPerSec);
+ wavex->nAvgBytesPerSec = le2me_32(wavex->nAvgBytesPerSec);
+ wavex->nBlockAlign = le2me_16(wavex->nBlockAlign);
+ wavex->wBitsPerSample = le2me_16(wavex->wBitsPerSample);
+ wavex->cbSize = le2me_16(wavex->cbSize);
+}
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
new file mode 100644
index 000000000..631fce7f2
--- /dev/null
+++ b/src/xine-engine/demux.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2000-2002 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Demuxer helper functions
+ * hide some xine engine details from demuxers and reduce code duplication
+ *
+ * $id$
+ */
+
+#include "xine_internal.h"
+#include "demuxers/demux.h"
+#include "buffer.h"
+
+
+/* internal use only - called from demuxers on seek/stop
+ * warning: after clearing decoders fifos an absolute discontinuity
+ * indication must be sent. relative discontinuities are likely
+ * to cause "jumps" on metronom.
+ */
+void xine_demux_flush_engine (xine_t *this) {
+
+ buf_element_t *buf;
+
+ this->video_fifo->clear(this->video_fifo);
+ if( this->audio_fifo )
+ this->audio_fifo->clear(this->audio_fifo);
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_RESET_DECODER;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_RESET_DECODER;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+
+ this->metronom->adjust_clock(this->metronom,
+ this->metronom->get_current_time(this->metronom) + 30 * 90000 );
+
+ if (this->audio_out)
+ this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS);
+}
+
+
+void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_NEWPTS;
+ buf->decoder_flags = flags;
+ buf->disc_off = pts;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_NEWPTS;
+ buf->decoder_flags = flags;
+ buf->disc_off = pts;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
+void xine_demux_control_start( xine_t *this ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_START;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
+
+void xine_demux_control_end( xine_t *this, uint32_t flags ) {
+
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_flags = flags;
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if (this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_flags = flags;
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
+}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 9efe619ff..21dd8ce7a 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.134 2002/06/01 16:36:13 mroi Exp $
+ * $Id: xine.c,v 1.135 2002/06/07 02:40:47 miguelfreitas Exp $
*
* top-level xine functions
*
@@ -139,36 +139,6 @@ void xine_notify_stream_finished (xine_t *this) {
}
}
-/* internal use only - called from demuxers on seek/stop
- * warning: after clearing decoders fifos an absolute discontinuity
- * indication must be sent. relative discontinuities are likely
- * to cause "jumps" on metronom.
- */
-void xine_flush_engine (xine_t *this) {
-
- buf_element_t *buf;
-
- this->video_fifo->clear(this->video_fifo);
- if( this->audio_fifo )
- this->audio_fifo->clear(this->audio_fifo);
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_RESET_DECODER;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_RESET_DECODER;
- this->audio_fifo->put (this->audio_fifo, buf);
- }
-
- this->metronom->adjust_clock(this->metronom,
- this->metronom->get_current_time(this->metronom) + 30 * 90000 );
-
- if (this->audio_out)
- this->audio_out->control(this->audio_out, AO_CTRL_FLUSH_BUFFERS);
-}
-
static void xine_internal_osd (xine_t *this, char *str,
uint32_t start_time, uint32_t duration) {
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index d19841cc9..f5def8794 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.85 2002/05/25 19:19:19 siggi Exp $
+ * $Id: xine_internal.h,v 1.86 2002/06/07 02:40:47 miguelfreitas Exp $
*
*/
@@ -428,7 +428,6 @@ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls);
*/
void xine_notify_stream_finished (xine_t *this);
-void xine_flush_engine (xine_t *this);
/*
* video decoder stuff
@@ -632,6 +631,19 @@ int xine_get_log_section_count (xine_t *this);
int xine_get_error (xine_t *this);
+
+/*
+ * demuxer helper functions from demux.c
+ */
+
+void xine_demux_flush_engine(xine_t *this);
+
+void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags );
+
+void xine_demux_control_start( xine_t *this );
+
+void xine_demux_control_end( xine_t *this, uint32_t flags );
+
#ifdef __cplusplus
}
#endif