summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:14:30 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:35:02 +0200
commitbc1d0ca37d9bdfd69a945043650e0246ffeb5f94 (patch)
tree8269c9cbc1df72afb5715b77669698a0781f6250 /stream
parentf7cc4152f7c55808c5dd6bbd49c216c9345eb686 (diff)
parente9a5e7f667d1b0c0dec0053ad9ec6f7bc3162b60 (diff)
downloadmpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.bz2
mpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.xz
Merge svn changes up to r30798
Diffstat (limited to 'stream')
-rw-r--r--stream/cache2.c20
-rw-r--r--stream/cdd.h2
-rw-r--r--stream/freesdp/parser.c60
-rw-r--r--stream/network.c7
-rw-r--r--stream/stream.c26
-rw-r--r--stream/stream.h25
-rw-r--r--stream/stream_cddb.c74
-rw-r--r--stream/stream_tv.c2
-rw-r--r--stream/stream_vcd.c2
9 files changed, 114 insertions, 104 deletions
diff --git a/stream/cache2.c b/stream/cache2.c
index 38061a4779..98e5d93501 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -218,14 +218,14 @@ static int cache_fill(cache_vars_t* s){
}
static int cache_execute_control(cache_vars_t *s) {
- int res = 1;
static unsigned last;
- if (!s->stream->control) {
+ int quit = s->control == -2;
+ if (quit || !s->stream->control) {
s->stream_time_length = 0;
s->control_new_pos = 0;
s->control_res = STREAM_UNSUPPORTED;
s->control = -1;
- return res;
+ return !quit;
}
if (GetTimerMS() - last > 99) {
double len;
@@ -235,7 +235,7 @@ static int cache_execute_control(cache_vars_t *s) {
s->stream_time_length = 0;
last = GetTimerMS();
}
- if (s->control == -1) return res;
+ if (s->control == -1) return 1;
switch (s->control) {
case STREAM_CTRL_GET_CURRENT_TIME:
case STREAM_CTRL_SEEK_TO_TIME:
@@ -250,15 +250,13 @@ static int cache_execute_control(cache_vars_t *s) {
case STREAM_CTRL_SET_ANGLE:
s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg);
break;
- case -2:
- res = 0;
default:
s->control_res = STREAM_UNSUPPORTED;
break;
}
s->control_new_pos = s->stream->pos;
s->control = -1;
- return res;
+ return 1;
}
static cache_vars_t* cache_init(int size,int sector){
@@ -310,9 +308,9 @@ void cache_uninit(stream_t *s) {
}
if(!c) return;
#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__)
- free(c->stream);
free(c->buffer);
c->buffer = NULL;
+ c->stream = NULL;
free(s->cache_data);
#else
shmem_free(c->buffer,c->buffer_size);
@@ -423,12 +421,12 @@ static void ThreadProc( void *s ){
} while (cache_execute_control(s));
#if defined(__MINGW32__) || defined(__OS2__)
_endthread();
-#endif
-#ifdef PTHREAD_CACHE
+#elif defined(PTHREAD_CACHE)
return NULL;
-#endif
+#else
// make sure forked code never leaves this function
exit(0);
+#endif
}
int cache_stream_fill_buffer(stream_t *s){
diff --git a/stream/cdd.h b/stream/cdd.h
index 9f2ae2fbb6..c6d6e9d92b 100644
--- a/stream/cdd.h
+++ b/stream/cdd.h
@@ -86,7 +86,7 @@ typedef struct {
cd_info_t *cd_info;
} cdda_priv;
-cd_info_t* cd_info_new();
+cd_info_t* cd_info_new(void);
void cd_info_free(cd_info_t *cd_info);
cd_track_t* cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length);
cd_track_t* cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb);
diff --git a/stream/freesdp/parser.c b/stream/freesdp/parser.c
index 34e6737a05..6d806a6e80 100644
--- a/stream/freesdp/parser.c
+++ b/stream/freesdp/parser.c
@@ -1440,50 +1440,6 @@ fsdp_get_encryption_content (const fsdp_description_t * dsc)
return dsc->k_encryption_content;
}
-unsigned int
-fsdp_get_rtpmap_count (const fsdp_description_t * dsc)
-{
- if (!dsc)
- return 0;
- return dsc->a_rtpmaps_count;
-}
-
-const char *
-fsdp_get_rtpmap_payload_type (const fsdp_description_t * dsc,
- unsigned int index)
-{
- if ((!dsc) || (index >= dsc->a_rtpmaps_count))
- return NULL;
- return dsc->a_rtpmaps[index]->pt;
-}
-
-const char *
-fsdp_get_rtpmap_encoding_name (const fsdp_description_t * dsc,
- unsigned int index)
-{
- if ((!dsc) || (index >= dsc->a_rtpmaps_count))
- return NULL;
- return dsc->a_rtpmaps[index]->encoding_name;
-}
-
-unsigned int
-fsdp_get_rtpmap_clock_rate (const fsdp_description_t * dsc,
- unsigned int index)
-{
- if ((!dsc) || (index >= dsc->a_rtpmaps_count))
- return 0;
- return dsc->a_rtpmaps[index]->clock_rate;
-}
-
-const char *
-fsdp_get_rtpmap_encoding_parameters (const fsdp_description_t * dsc,
- unsigned int index)
-{
- if ((!dsc) || (index >= dsc->a_rtpmaps_count))
- return NULL;
- return dsc->a_rtpmaps[index]->parameters;
-}
-
const char *
fsdp_get_str_att (const fsdp_description_t * dsc, fsdp_session_str_att_t att)
{
@@ -1531,22 +1487,6 @@ fsdp_get_sdplang (const fsdp_description_t * dsc, unsigned int index)
}
unsigned int
-fsdp_get_lang_count (const fsdp_description_t * dsc)
-{
- if (!dsc)
- return 0;
- return dsc->a_langs_count;
-}
-
-const char *
-fsdp_get_lang (const fsdp_description_t * dsc, unsigned int index)
-{
- if ((!dsc) || (index >= dsc->a_langs_count))
- return NULL;
- return dsc->a_langs[index];
-}
-
-unsigned int
fsdp_get_control_count (const fsdp_description_t * dsc)
{
if (!dsc)
diff --git a/stream/network.c b/stream/network.c
index bd496184e8..c2108559de 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -475,10 +475,3 @@ void fixup_network_stream_cache(stream_t *stream) {
mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Cache size set to %d KBytes\n", stream_cache_size);
}
}
-
-
-int
-streaming_stop( stream_t *stream ) {
- stream->streaming_ctrl->status = streaming_stopped_e;
- return 0;
-}
diff --git a/stream/stream.c b/stream/stream.c
index af194f3a3d..0b0cddc6f9 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -492,3 +492,29 @@ int stream_check_interrupt(int time) {
if(!stream_check_interrupt_cb) return 0;
return stream_check_interrupt_cb(stream_check_interrupt_ctx, time);
}
+
+unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
+ int len;
+ unsigned char* end,*ptr = mem;
+ if (max < 1) return NULL;
+ max--; // reserve one for 0-termination
+ do {
+ len = s->buf_len-s->buf_pos;
+ // try to fill the buffer
+ if(len <= 0 &&
+ (!cache_stream_fill_buffer(s) ||
+ (len = s->buf_len-s->buf_pos) <= 0)) break;
+ end = (unsigned char*) memchr((void*)(s->buffer+s->buf_pos),'\n',len);
+ if(end) len = end - (s->buffer+s->buf_pos) + 1;
+ if(len > 0 && max > 0) {
+ int l = len > max ? max : len;
+ memcpy(ptr,s->buffer+s->buf_pos,l);
+ max -= l;
+ ptr += l;
+ }
+ s->buf_pos += len;
+ } while(!end);
+ if(s->eof && ptr == mem) return NULL;
+ ptr[0] = 0;
+ return mem;
+}
diff --git a/stream/stream.h b/stream/stream.h
index c02961f1df..3690dc46aa 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -269,30 +269,7 @@ inline static int stream_read(stream_t *s,char* mem,int total){
return total;
}
-inline static unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
- int len;
- unsigned char* end,*ptr = mem;
- do {
- len = s->buf_len-s->buf_pos;
- // try to fill the buffer
- if(len <= 0 &&
- (!cache_stream_fill_buffer(s) ||
- (len = s->buf_len-s->buf_pos) <= 0)) break;
- end = (unsigned char*) memchr((void*)(s->buffer+s->buf_pos),'\n',len);
- if(end) len = end - (s->buffer+s->buf_pos) + 1;
- if(len > 0 && max > 1) {
- int l = len > max-1 ? max-1 : len;
- memcpy(ptr,s->buffer+s->buf_pos,l);
- max -= l;
- ptr += l;
- }
- s->buf_pos += len;
- } while(!end);
- if(s->eof && ptr == mem) return NULL;
- if(max > 0) ptr[0] = 0;
- return mem;
-}
-
+unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max);
inline static int stream_eof(stream_t *s){
return s->eof;
diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c
index d6fe4f1881..811a1c1570 100644
--- a/stream/stream_cddb.c
+++ b/stream/stream_cddb.c
@@ -68,6 +68,8 @@
#include "mpbswap.h"
#endif
+#include "osdep/osdep.h"
+
#include "cdd.h"
#include "version.h"
#include "stream.h"
@@ -112,6 +114,78 @@ static int read_toc(const char *dev)
}
CloseHandle(drive);
+#elif defined(__OS2__)
+ UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
+
+ struct {
+ BYTE bFirstTrack;
+ BYTE bLastTrack;
+ BYTE bLeadOutF;
+ BYTE bLeadOutS;
+ BYTE bLeadOutM;
+ BYTE bLeadOutReserved;
+ } __attribute__((packed)) sDataDisk;
+
+ struct {
+ UCHAR auchSign[4];
+ BYTE bTrack;
+ } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
+
+ struct {
+ BYTE bStartF;
+ BYTE bStartS;
+ BYTE bStartM;
+ BYTE bStartReserved;
+ BYTE bControlInfo;
+ } __attribute__((packed)) sDataTrack;
+
+ HFILE hcd;
+ ULONG ulAction;
+ ULONG ulParamLen;
+ ULONG ulDataLen;
+ ULONG rc;
+
+ rc = DosOpen(dev, &hcd, &ulAction, 0, FILE_NORMAL,
+ OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+ OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
+ NULL);
+ if (rc) {
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
+ return -1;
+ }
+
+ rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
+ auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
+ &sDataDisk, sizeof(sDataDisk), &ulDataLen);
+ if (!rc) {
+ first = sDataDisk.bFirstTrack - 1;
+ last = sDataDisk.bLastTrack;
+ for (i = first; i <= last; i++) {
+ if (i == last) {
+ sDataTrack.bStartM = sDataDisk.bLeadOutM;
+ sDataTrack.bStartS = sDataDisk.bLeadOutS;
+ sDataTrack.bStartF = sDataDisk.bLeadOutF;
+ } else {
+ sParamTrack.bTrack = i + 1;
+ rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
+ &sParamTrack, sizeof(sParamTrack), &ulParamLen,
+ &sDataTrack, sizeof(sDataTrack), &ulDataLen);
+ if (rc)
+ break;
+ }
+
+ cdtoc[i].min = sDataTrack.bStartM;
+ cdtoc[i].sec = sDataTrack.bStartS;
+ cdtoc[i].frame = sDataTrack.bStartF;
+ }
+ }
+
+ DosClose(hcd);
+
+ if (rc) {
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
+ return -1;
+ }
#else
int drive;
drive = open(dev, O_RDONLY | O_NONBLOCK);
diff --git a/stream/stream_tv.c b/stream/stream_tv.c
index 3db6195dcf..fb2090fd09 100644
--- a/stream/stream_tv.c
+++ b/stream/stream_tv.c
@@ -70,10 +70,12 @@ tv_param_t stream_tv_defaults = {
0, //hue
0, //saturation
-1, //gain
+ {
NULL, //tdevice
0, //tformat
100, //tpage
0, //tlang
+ },
0, //scan_autostart
50, //scan_threshold
0.5, //scan_period
diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c
index 23722d24e7..515c4e3ea4 100644
--- a/stream/stream_vcd.c
+++ b/stream/stream_vcd.c
@@ -92,7 +92,7 @@ static void close_s(stream_t *stream) {
}
static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
- struct stream_priv_s* p = (struct stream_priv_s*)opts;
+ struct stream_priv_s* p = opts;
int ret,ret2,f,sect,tmp;
mp_vcd_priv_t* vcd;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)