Update of /cvsroot/alsa/alsa-kernel/core/seq In directory sc8-pr-cvs1:/tmp/cvs-serv4997
Modified Files: seq_clientmgr.c seq_ports.c seq_ports.h Log Message: - added auto-timestamp mode for the port. - increased the protocol version to 1.0.1. Index: seq_clientmgr.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/seq/seq_clientmgr.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- seq_clientmgr.c 30 May 2003 13:58:32 -0000 1.22 +++ seq_clientmgr.c 25 Jul 2003 17:22:26 -0000 1.23 @@ -521,6 +521,32 @@ /* + * rewrite the time-stamp of the event record with the curren time + * of the given queue. + * return non-zero if updated. + */ +static int update_timestamp_of_queue(snd_seq_event_t *event, int queue, int real_time) +{ + queue_t *q; + + q = queueptr(queue); + if (! q) + return 0; + event->queue = queue; + event->flags &= ~SNDRV_SEQ_TIME_STAMP_MASK; + if (real_time) { + event->time.time = snd_seq_timer_get_cur_time(q->timer); + event->flags |= SNDRV_SEQ_TIME_STAMP_REAL; + } else { + event->time.tick = snd_seq_timer_get_cur_tick(q->timer); + event->flags |= SNDRV_SEQ_TIME_STAMP_TICK; + } + queuefree(q); + return 1; +} + + +/* * deliver an event to the specified destination. * if filter is non-zero, client filter bitmap is tested. * @@ -551,6 +577,10 @@ goto __skip; } + if (dest_port->timestamping) + update_timestamp_of_queue(event, dest_port->time_queue, + dest_port->time_real); + /* expand the quoted event */ if (event->type == SNDRV_SEQ_EVENT_KERNEL_QUOTE) { quoted = 1; @@ -597,27 +627,6 @@ } -static void snd_seq_subs_update_event_header(subscribers_t *subs, snd_seq_event_t *event) -{ - if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) { - /* convert time according to flag with subscription */ - queue_t *q; - q = queueptr(subs->info.queue); - if (q) { - event->queue = subs->info.queue; - event->flags &= ~SNDRV_SEQ_TIME_STAMP_MASK; - if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL) { - event->time.time = snd_seq_timer_get_cur_time(q->timer); - event->flags |= SNDRV_SEQ_TIME_STAMP_REAL; - } else { - event->time.tick = snd_seq_timer_get_cur_tick(q->timer); - event->flags |= SNDRV_SEQ_TIME_STAMP_TICK; - } - queuefree(q); - } - } -} - /* * send the event to all subscribers: */ @@ -647,7 +656,10 @@ list_for_each(p, &grp->list_head) { subs = list_entry(p, subscribers_t, src_list); event->dest = subs->info.dest; - snd_seq_subs_update_event_header(subs, event); + if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) + /* convert time according to flag with subscription */ + update_timestamp_of_queue(event, subs->info.queue, + subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL); err = snd_seq_deliver_single_event(client, event, 0, atomic, hop); if (err < 0) Index: seq_ports.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/seq/seq_ports.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- seq_ports.c 30 May 2003 12:28:33 -0000 1.14 +++ seq_ports.c 25 Jul 2003 17:22:26 -0000 1.15 @@ -352,6 +352,11 @@ port->midi_voices = info->midi_voices; port->synth_voices = info->synth_voices; + /* timestamping */ + port->timestamping = (info->flags & SNDRV_SEQ_PORT_FLG_TIMESTAMP) ? 1 : 0; + port->time_real = (info->flags & SNDRV_SEQ_PORT_FLG_TIME_REAL) ? 1 : 0; + port->time_queue = info->time_queue; + return 0; } @@ -378,6 +383,15 @@ info->read_use = port->c_src.count; info->write_use = port->c_dest.count; + /* timestamping */ + info->flags = 0; + if (port->timestamping) { + info->flags |= SNDRV_SEQ_PORT_FLG_TIMESTAMP; + if (port->time_real) + info->flags |= SNDRV_SEQ_PORT_FLG_TIME_REAL; + info->time_queue = port->time_queue; + } + return 0; } Index: seq_ports.h =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/seq/seq_ports.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- seq_ports.h 28 Feb 2003 15:08:21 -0000 1.3 +++ seq_ports.h 25 Jul 2003 17:22:26 -0000 1.4 @@ -74,6 +74,9 @@ void *private_data; unsigned int callback_all : 1; unsigned int closing : 1; + unsigned int timestamping: 1; + unsigned int time_real: 1; + int time_queue; /* capability, inport, output, sync */ unsigned int capability; /* port capability bits */ ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog