From 1044a6fe262477a8c42bacbb18bed907227b9d84 Mon Sep 17 00:00:00 2001 From: James Stembridge Date: Thu, 4 Dec 2003 22:11:25 +0000 Subject: Attempt to detect end of real rtsp streams Minor hexdump cleanup CVS patchset: 5839 CVS date: 2003/12/04 22:11:25 --- ChangeLog | 1 + src/input/libreal/real.c | 41 ++++++++++++----------------------------- src/input/libreal/rmff.c | 40 +++++----------------------------------- src/input/librtsp/rtsp.c | 40 ++-------------------------------------- 4 files changed, 20 insertions(+), 102 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45a0e727d..2212270df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,7 @@ xine-lib (1-rc3) * use AUDIODEV enviroment variable on Sun * text subtitles improvements and bugfixes * unified handling of external subtitles and ogg subtitles + * detect end of real rtsp streams xine-lib (1-rc2) * XvMC support for hardware accelerated mpeg2 playback (-V xvmc) diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 1cba7720b..8ce462f32 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 the xine project + * Copyright (C) 2002-2003 the xine project * * This file is part of xine, a free video player. * @@ -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: real.c,v 1.9 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: real.c,v 1.10 2003/12/04 22:11:25 jstembridge Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -29,9 +29,9 @@ #define LOG_MODULE "real" #define LOG_VERBOSE -/* + #define LOG -*/ + #include "real.h" #include "asmrp.h" @@ -60,28 +60,6 @@ const unsigned char xor_table[] = { #define MAX(x,y) ((x>y) ? x : y) -#ifdef LOG -static void hexdump (const char *buf, int length) { - - int i; - - printf (" hexdump> "); - for (i = 0; i < length; i++) { - unsigned char c = buf[i]; - - printf ("%02x", c); - - if ((i % 16) == 15) - printf ("\n "); - - if ((i % 2) == 1) - printf (" "); - - } - printf ("\n"); -} -#endif - static void hash(char *field, char *param) { @@ -97,7 +75,7 @@ static void hash(char *field, char *param) { lprintf("hash input: %x %x %x %x\n", a, b, c, d); lprintf("hash parameter:\n"); #ifdef LOG - hexdump(param, 64); + xine_hexdump(param, 64); #endif a = ((b & c) | (~b & d)) + *((uint32_t*)(param+0x00)) + a - 0x28955B88; @@ -455,7 +433,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection size=BE_32(mlti_chunk); #ifdef LOG - hexdump(mlti_chunk+4, size); + xine_hexdump(mlti_chunk+4, size); #endif memcpy(out,mlti_chunk+4, size); return size; @@ -580,6 +558,11 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { } size=(header[1]<<12)+(header[2]<<8)+(header[3]); flags1=header[4]; + if ((flags1==0x86)||(flags1==0x82)) + { + lprintf("got end of stream packet: 0x%02x\n",flags1); + return 0; + } if ((flags1!=0x40)&&(flags1!=0x42)) { lprintf("got flags1: 0x%02x\n",flags1); @@ -590,7 +573,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { if (n<5) return 0; lprintf("ignoring bytes:\n"); #ifdef LOG - hexdump(header, 8); + xine_hexdump(header, 8); #endif n=rtsp_read_data(rtsp_session, header+4, 4); if (n<4) return 0; diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 8229a8208..6a57255b9 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 the xine project + * Copyright (C) 2002-2003 the xine project * * This file is part of xine, a free video player. * @@ -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: rmff.c,v 1.5 2003/11/27 22:33:01 mroi Exp $ + * $Id: rmff.c,v 1.6 2003/12/04 22:11:25 jstembridge Exp $ * * functions for real media file format * adopted from joschkas real tools @@ -38,36 +38,6 @@ (((uint8_t*)(x))[2] << 8) | \ ((uint8_t*)(x))[3]) -static void hexdump (const char *buf, int length) { - - int i; - - printf ("rmff: ascii>"); - for (i = 0; i < length; i++) { - unsigned char c = buf[i]; - - if ((c >= 32) && (c <= 128)) - printf ("%c", c); - else - printf ("."); - } - printf ("\n"); - - printf ("rmff: hexdump> "); - for (i = 0; i < length; i++) { - unsigned char c = buf[i]; - - printf ("%02x", c); - - if ((i % 16) == 15) - printf ("\nrmff: "); - - if ((i % 2) == 1) - printf (" "); - - } - printf ("\n"); -} /* * writes header data to a buffer @@ -481,7 +451,7 @@ rmff_header_t *rmff_scan_header(const char *data) { break; default: printf("unknown chunk\n"); - hexdump(ptr,10); + xine_hexdump(ptr,10); chunk_size=1; break; } @@ -518,7 +488,7 @@ rmff_header_t *rmff_scan_header_stream(int fd) { break; default: printf("rmff_scan_header_stream: unknown chunk"); - hexdump(buf+index-8, 8); + xine_hexdump(buf+index-8, 8); chunk_type=DATA_TAG; } } while (chunk_type != DATA_TAG); @@ -737,7 +707,7 @@ void rmff_print_header(rmff_header_t *h) { printf("pre-buffer : %i ms\n", (*stream)->preroll); printf("duration : %i ms\n", (*stream)->duration); printf("type specific data:\n"); - hexdump((*stream)->type_specific_data, (*stream)->type_specific_len); + xine_hexdump((*stream)->type_specific_data, (*stream)->type_specific_len); stream++; } } diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 639344036..28b50fdb8 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2002 the xine project + * Copyright (C) 2000-2003 the xine project * * This file is part of xine, a free video player. * @@ -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: rtsp.c,v 1.12 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: rtsp.c,v 1.13 2003/12/04 22:11:25 jstembridge Exp $ * * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. @@ -219,42 +219,6 @@ static ssize_t read_stream(rtsp_t *s, void *buf, size_t count) { #endif } -/* - * debugging utilities - */ -#if 0 -static void hexdump (char *buf, int length) { - - int i; - - printf ("rtsp: ascii>"); - for (i = 0; i < length; i++) { - unsigned char c = buf[i]; - - if ((c >= 32) && (c <= 128)) - printf ("%c", c); - else - printf ("."); - } - printf ("\n"); - - printf ("rtsp: hexdump> "); - for (i = 0; i < length; i++) { - unsigned char c = buf[i]; - - printf ("%02x", c); - - if ((i % 16) == 15) - printf ("\nrtsp: "); - - if ((i % 2) == 1) - printf (" "); - - } - printf ("\n"); -} -#endif - /* * rtsp_get gets a line from stream * and returns a null terminated string. -- cgit v1.2.3