test_thread.c
资源名称:NETVIDEO.rar [点击查看]
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:7k
源码类别:
流媒体/Mpeg4/MP4
开发平台:
Visual C++
- /*
- * The contents of this file are subject to the Mozilla Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is MPEG4IP.
- *
- * The Initial Developer of the Original Code is Cisco Systems Inc.
- * Portions created by Cisco Systems Inc. are
- * Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved.
- *
- * Contributor(s):
- * Bill May wmay@cisco.com
- */
- /*
- * test.c - test program for rtsp library
- */
- #include <SDL.h>
- #include <sdp/sdp.h>
- #include <time.h>
- #include "rtsp_private.h"
- #if 0
- static const char *optbuff =
- "OPTIONS * RTSP/1.0rnCSeq: 1rnrn";
- static const char *optbuff2 =
- "OPTIONS * RTSP/1.0rnCSeq: 2rnrn";
- #endif
- static void local_error_msg (int loglevel,
- const char *lib,
- const char *fmt,
- va_list ap)
- {
- struct timeval thistime;
- char buffer[80];
- #if _WIN32
- if (IsDebuggerPresent()) {
- char msg[512];
- sprintf(msg, "%s-%d:", lib, loglevel);
- OutputDebugString(msg);
- // va_start(ap, fmt);
- _vsnprintf(msg, 512, fmt, ap);
- // va_end(ap);
- OutputDebugString(msg);
- OutputDebugString("n");
- return;
- }
- #define sleep(a) Sleep((a) * 1000)
- #endif
- gettimeofday(&thistime, NULL);
- strftime(buffer, sizeof(buffer), "%X", localtime(&thistime.tv_sec));
- printf("%s.%03ld-%s-%d: ",
- buffer,
- thistime.tv_usec / 1000,
- lib,
- loglevel);
- vprintf(fmt, ap);
- printf("n");
- }
- static int callback (void *foo)
- {
- rtsp_debug(LOG_DEBUG, "callback - SDL thread %dn", SDL_ThreadID());
- return (SDL_ThreadID());
- }
- static void do_relative_url_to_absolute (char **control_string,
- const char *base_url,
- int dontfree)
- {
- char *str, *cpystr;
- uint32_t cblen, malloclen;
- malloclen = cblen = strlen(base_url);
- if (base_url[cblen - 1] != '/') malloclen++;
- /*
- * If the control string is just a *, use the base url only
- */
- cpystr = *control_string;
- if (strcmp(cpystr, "*") != 0) {
- if (*cpystr == '/') cpystr++;
- // duh - add 1 for