Changeset 4543:14019152e072 in roaraudio
- Timestamp:
- 10/24/10 13:50:12 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/streams.h
r4541 r4543 130 130 131 131 int streams_set_mixer_stream(int id, int mixer); 132 int streams_get_mixer_stream(int id , int mixer);132 int streams_get_mixer_stream(int id); 133 133 134 134 int streams_set_role (int id, int role); -
roard/streams.c
r4542 r4543 321 321 int streams_set_dir (int id, int dir, int defaults) { 322 322 struct roar_stream_server * ss; 323 int mixer; 323 324 324 325 _CHECK_SID(id); … … 367 368 } 368 369 370 if ( (mixer = streams_get_mixer_stream(id)) != -1 ) { 371 if ( g_streams[mixer]->flags & ROAR_FLAG_SINGLESINK ) { 372 streams_set_mixer_stream(id, -1); 373 return -1; 374 } 375 } 376 369 377 memcpy(ss->chanmap.out, ss->chanmap.in, sizeof(ss->chanmap.out)); 370 378 streams_set_map(id, NULL, 0); … … 401 409 } 402 410 403 int streams_get_mixer_stream(int id , int mixer) {411 int streams_get_mixer_stream(int id) { 404 412 struct roar_stream_server * ss; 405 413 … … 778 786 779 787 int streams_set_single_sink(int id, int reset) { 780 _CHECK_SID(id); 781 782 return -1; 788 struct roar_stream_server * self_ss, * ss; 789 struct roar_stream * s; 790 int mixer; 791 size_t count = 0; 792 int i; 793 int ssdir; 794 795 /* FIXME: This code only uses one refc for the mixer shared with the inputs. 796 * If the flag is unset on the mixer but got set by the sources the counter 797 * may/will become corrupted. 798 * 799 * TODO: If a stream is deleted and this flag is set this rutine must be called to 800 * maintain a correct count. 801 */ 802 803 _CHECK_SID(id); 804 805 self_ss = g_streams[id]; 806 807 mixer = self_ss->mixer_stream; 808 809 if ( id == mixer ) { 810 if ( reset ) { 811 if ( self_ss->single_sink_c > 1 ) { 812 self_ss->single_sink_c--; 813 self_ss->flags |= ROAR_FLAG_SINGLESINK; 814 self_ss->flags -= ROAR_FLAG_SINGLESINK; 815 return 0; 816 } 817 } else { 818 if ( self_ss->single_sink_c ) { 819 self_ss->single_sink_c++; 820 return 0; 821 } 822 } 823 } else if ( reset ) { 824 if ( (ss = g_streams[mixer])->single_sink_c == 0 ) 825 return -1; 826 ss->single_sink_c--; 827 828 if ( ss->single_sink_c == 0 ) { 829 self_ss->flags |= ROAR_FLAG_SINGLESINK; 830 self_ss->flags -= ROAR_FLAG_SINGLESINK; 831 ss->flags |= ROAR_FLAG_SINGLESINK; 832 ss->flags -= ROAR_FLAG_SINGLESINK; 833 } 834 835 return 0; 836 } 837 838 839 840 for (i = 0; i < ROAR_STREAMS_MAX; i++) { 841 if ( (s = ROAR_STREAM((ss = g_streams[i]))) != NULL ) { 842 if ( s->dir == ROAR_DIR_THRU ) 843 if ( s->pos_rel_id == id || s->pos_rel_id == mixer ) 844 return -1; 845 846 if ( ss->mixer_stream != mixer ) 847 continue; 848 849 ssdir = streams_get_ssdir(i); 850 851 if ( ssdir & STREAM_DIR_OUT ) { 852 count++; 853 if ( streams_thru_num ) { 854 return -1; 855 } 856 } 857 } 858 } 859 860 if ( count > 1 ) 861 return -1; 862 863 ss = g_streams[mixer]; 864 865 ss->single_sink_c++; 866 867 self_ss->flags |= ROAR_FLAG_SINGLESINK; 868 ss->flags |= ROAR_FLAG_SINGLESINK; 869 870 return 0; 783 871 } 784 872
Note: See TracChangeset
for help on using the changeset viewer.