Changeset e603af3f7901787f11bdffa5402ffeeb57402a14
- Timestamp:
- 21/09/03 13:48:58
(5 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1064144938 +0000
- git-parent:
[7d0c93158d1afb34538de30802f9542b04db0b55]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1064144938 +0000
- Message:
* modules/stream_out/duplicate.c: improved last fix.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9a16e57 |
re603af3 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001, 2002 VideoLAN |
|---|
| 5 | | * $Id: duplicate.c,v 1.3 2003/09/20 23:46:01 gbazin Exp $ |
|---|
| | 5 | * $Id: duplicate.c,v 1.4 2003/09/21 11:48:58 gbazin Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| … | … | |
| 139 | 139 | sout_stream_sys_t *p_sys = p_stream->p_sys; |
|---|
| 140 | 140 | sout_stream_id_t *id; |
|---|
| 141 | | int i_stream; |
|---|
| | 141 | int i_stream, i_valid_streams = 0; |
|---|
| 142 | 142 | |
|---|
| 143 | 143 | id = malloc( sizeof( sout_stream_id_t ) ); |
|---|
| … | … | |
| 152 | 152 | id_new = (void*)p_sys->pp_streams[i_stream]->pf_add( |
|---|
| 153 | 153 | p_sys->pp_streams[i_stream], p_fmt ); |
|---|
| 154 | | if( id_new ) |
|---|
| 155 | | { |
|---|
| 156 | | TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new ); |
|---|
| 157 | | } |
|---|
| 158 | | } |
|---|
| 159 | | |
|---|
| 160 | | if( id->i_nb_ids <= 0 ) |
|---|
| 161 | | { |
|---|
| 162 | | free( id ); |
|---|
| | 154 | |
|---|
| | 155 | /* Append failed attempts as well to keep track of which pp_id |
|---|
| | 156 | * belong to which duplicated stream */ |
|---|
| | 157 | TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new ); |
|---|
| | 158 | if( id_new ) i_valid_streams++; |
|---|
| | 159 | } |
|---|
| | 160 | |
|---|
| | 161 | if( i_valid_streams <= 0 ) |
|---|
| | 162 | { |
|---|
| | 163 | Del( p_stream, id ); |
|---|
| 163 | 164 | return NULL; |
|---|
| 164 | 165 | } |
|---|
| … | … | |
| 174 | 175 | for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ ) |
|---|
| 175 | 176 | { |
|---|
| 176 | | if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) |
|---|
| | 177 | if( id->pp_ids[i_stream] ) |
|---|
| 177 | 178 | { |
|---|
| 178 | 179 | p_sys->pp_streams[i_stream]->pf_del( p_sys->pp_streams[i_stream], |
|---|
| … | … | |
| 196 | 197 | sout_buffer_t *p_dup; |
|---|
| 197 | 198 | |
|---|
| 198 | | if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) |
|---|
| | 199 | if( id->pp_ids[i_stream] ) |
|---|
| 199 | 200 | { |
|---|
| 200 | 201 | p_dup = sout_BufferDuplicate( p_stream->p_sout, p_buffer ); |
|---|
| … | … | |
| 207 | 208 | |
|---|
| 208 | 209 | i_stream = p_sys->i_nb_streams - 1; |
|---|
| 209 | | if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) |
|---|
| | 210 | if( id->pp_ids[i_stream] ) |
|---|
| 210 | 211 | { |
|---|
| 211 | 212 | p_sys->pp_streams[i_stream]->pf_send( p_sys->pp_streams[i_stream], |
|---|
| … | … | |
| 213 | 214 | p_buffer); |
|---|
| 214 | 215 | } |
|---|
| | 216 | else |
|---|
| | 217 | { |
|---|
| | 218 | sout_BufferDelete( p_stream->p_sout, p_buffer ); |
|---|
| | 219 | } |
|---|
| 215 | 220 | |
|---|
| 216 | 221 | return VLC_SUCCESS; |
|---|