Changeset 211100f4853aa5cfcc8a735355e0971fe84596c1
- Timestamp:
- 15/05/04 16:42:16
(5 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1084632136 +0000
- git-parent:
[62b379567e145f0ae9eb6204fc86cdbbb11faeb6]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1084632136 +0000
- Message:
- all: improved perfs (using block_ChainLastAppend).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4fc24a1 |
r211100f |
|
| 113 | 113 | } |
|---|
| 114 | 114 | VLC_EXPORT( void, block_ChainAppend, ( block_t **, block_t * ) ); |
|---|
| | 115 | VLC_EXPORT( void, block_ChainLastAppend, ( block_t ***ppp_last, block_t * ) ); |
|---|
| 115 | 116 | VLC_EXPORT( void, block_ChainRelease, ( block_t * ) ); |
|---|
| 116 | 117 | VLC_EXPORT( int, block_ChainExtract, ( block_t *, void *, int ) ); |
|---|
| rda6ecee |
r211100f |
|
| 187 | 187 | es_out_id_t *id; |
|---|
| 188 | 188 | block_t *p_pes; |
|---|
| | 189 | block_t **pp_last; |
|---|
| 189 | 190 | |
|---|
| 190 | 191 | es_mpeg4_descriptor_t *p_mpeg4desc; |
|---|
| | 192 | int b_gather; |
|---|
| 191 | 193 | } ts_es_t; |
|---|
| 192 | 194 | |
|---|
| … | … | |
| 791 | 793 | pid->es->id = NULL; |
|---|
| 792 | 794 | pid->es->p_pes = NULL; |
|---|
| | 795 | pid->es->pp_last = &pid->es->p_pes; |
|---|
| 793 | 796 | pid->es->p_mpeg4desc = NULL; |
|---|
| | 797 | pid->es->b_gather = VLC_FALSE; |
|---|
| 794 | 798 | } |
|---|
| 795 | 799 | } |
|---|
| … | … | |
| 858 | 862 | /* remove the pes from pid */ |
|---|
| 859 | 863 | pid->es->p_pes = NULL; |
|---|
| | 864 | pid->es->pp_last = &pid->es->p_pes; |
|---|
| 860 | 865 | |
|---|
| 861 | 866 | /* FIXME find real max size */ |
|---|
| … | … | |
| 1004 | 1009 | } |
|---|
| 1005 | 1010 | |
|---|
| 1006 | | /* For mpeg4/mscodec we first gather the packet. |
|---|
| 1007 | | * This will make ffmpeg a lot happier */ |
|---|
| 1008 | | p_block = block_ChainGather( p_pes ); |
|---|
| | 1011 | if( pid->es->b_gather ) |
|---|
| | 1012 | { |
|---|
| | 1013 | /* For mpeg4/mscodec we first gather the packet. |
|---|
| | 1014 | * This will make ffmpeg a lot happier */ |
|---|
| | 1015 | p_block = block_ChainGather( p_pes ); |
|---|
| | 1016 | } |
|---|
| | 1017 | else |
|---|
| | 1018 | { |
|---|
| | 1019 | p_block = p_pes; |
|---|
| | 1020 | } |
|---|
| 1009 | 1021 | |
|---|
| 1010 | 1022 | for( i = 0; i < pid->i_extra_es; i++ ) |
|---|
| … | … | |
| 1155 | 1167 | } |
|---|
| 1156 | 1168 | |
|---|
| 1157 | | pid->es->p_pes = p_bk; |
|---|
| | 1169 | block_ChainLastAppend( &pid->es->pp_last, p_bk ); |
|---|
| 1158 | 1170 | } |
|---|
| 1159 | 1171 | else |
|---|
| … | … | |
| 1168 | 1180 | /* TODO check if when have gathered enough packets to form a |
|---|
| 1169 | 1181 | * PES (ie read PES size)*/ |
|---|
| 1170 | | block_ChainAppend( &pid->es->p_pes, p_bk ); |
|---|
| | 1182 | block_ChainLastAppend( &pid->es->pp_last, p_bk ); |
|---|
| 1171 | 1183 | } |
|---|
| 1172 | 1184 | } |
|---|
| … | … | |
| 1197 | 1209 | case 0x10: /* MPEG4 (video) */ |
|---|
| 1198 | 1210 | es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', '4', 'v' ) ); |
|---|
| | 1211 | pid->es->b_gather = VLC_TRUE; |
|---|
| 1199 | 1212 | break; |
|---|
| 1200 | 1213 | case 0x1B: /* H264 <- check transport syntax/needed descriptor */ |
|---|
| … | … | |
| 1231 | 1244 | break; |
|---|
| 1232 | 1245 | |
|---|
| | 1246 | case 0xa0: /* MSCODEC vlc (video) (fixed later) */ |
|---|
| | 1247 | es_format_Init( fmt, UNKNOWN_ES, 0 ); |
|---|
| | 1248 | pid->es->b_gather = VLC_TRUE; |
|---|
| | 1249 | break; |
|---|
| | 1250 | |
|---|
| 1233 | 1251 | case 0x06: /* PES_PRIVATE (fixed later) */ |
|---|
| 1234 | | case 0xa0: /* MSCODEC vlc (video) (fixed later) */ |
|---|
| 1235 | 1252 | default: |
|---|
| 1236 | 1253 | es_format_Init( fmt, UNKNOWN_ES, 0 ); |
|---|
| … | … | |
| 1850 | 1867 | p_es->id = NULL; |
|---|
| 1851 | 1868 | p_es->p_pes = NULL; |
|---|
| | 1869 | p_es->pp_last = &p_es->p_pes; |
|---|
| 1852 | 1870 | p_es->p_mpeg4desc = NULL; |
|---|
| 1853 | 1871 | |
|---|
| r694b417 |
r211100f |
|
| 83 | 83 | /* Current frame being built */ |
|---|
| 84 | 84 | block_t *p_frame; |
|---|
| | 85 | block_t **pp_last; |
|---|
| | 86 | |
|---|
| 85 | 87 | vlc_bool_t b_frame_slice; |
|---|
| 86 | 88 | mtime_t i_pts; |
|---|
| … | … | |
| 148 | 150 | p_sys->p_ext = NULL; |
|---|
| 149 | 151 | p_sys->p_frame = NULL; |
|---|
| | 152 | p_sys->pp_last = &p_sys->p_frame; |
|---|
| 150 | 153 | p_sys->b_frame_slice = VLC_FALSE; |
|---|
| 151 | 154 | |
|---|
| … | … | |
| 217 | 220 | if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame ); |
|---|
| 218 | 221 | p_sys->p_frame = NULL; |
|---|
| | 222 | p_sys->pp_last = &p_sys->p_frame; |
|---|
| 219 | 223 | p_sys->b_frame_slice = VLC_FALSE; |
|---|
| 220 | 224 | block_Release( *pp_block ); |
|---|
| … | … | |
| 333 | 337 | if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame ); |
|---|
| 334 | 338 | p_sys->p_frame = NULL; |
|---|
| | 339 | p_sys->pp_last = &p_sys->p_frame; |
|---|
| 335 | 340 | p_sys->b_frame_slice = VLC_FALSE; |
|---|
| 336 | 341 | |
|---|
| … | … | |
| 441 | 446 | /* Reset context */ |
|---|
| 442 | 447 | p_sys->p_frame = NULL; |
|---|
| | 448 | p_sys->pp_last = &p_sys->p_frame; |
|---|
| 443 | 449 | p_sys->b_frame_slice = VLC_FALSE; |
|---|
| 444 | 450 | } |
|---|
| … | … | |
| 454 | 460 | { |
|---|
| 455 | 461 | /* Usefull for mpeg1: repeat sequence header every second */ |
|---|
| 456 | | block_ChainAppend( &p_sys->p_frame, |
|---|
| 457 | | block_Duplicate( p_sys->p_seq ) ); |
|---|
| | 462 | block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_seq ) ); |
|---|
| 458 | 463 | if( p_sys->p_ext ) |
|---|
| 459 | 464 | { |
|---|
| 460 | | block_ChainAppend( &p_sys->p_frame, |
|---|
| 461 | | block_Duplicate( p_sys->p_ext ) ); |
|---|
| | 465 | block_ChainLastAppend( &p_sys->pp_last, block_Duplicate( p_sys->p_ext ) ); |
|---|
| 462 | 466 | } |
|---|
| 463 | 467 | |
|---|
| … | … | |
| 573 | 577 | |
|---|
| 574 | 578 | /* Append the block */ |
|---|
| 575 | | block_ChainAppend( &p_sys->p_frame, p_frag ); |
|---|
| | 579 | block_ChainLastAppend( &p_sys->pp_last, p_frag ); |
|---|
| 576 | 580 | |
|---|
| 577 | 581 | return p_pic; |
|---|
| ra7bac1e |
r211100f |
|
| 240 | 240 | void block_ChainAppend( block_t **pp_list, block_t *p_block ) |
|---|
| 241 | 241 | { |
|---|
| 242 | | |
|---|
| 243 | 242 | if( *pp_list == NULL ) |
|---|
| 244 | 243 | { |
|---|
| … | … | |
| 255 | 254 | p->p_next = p_block; |
|---|
| 256 | 255 | } |
|---|
| | 256 | } |
|---|
| | 257 | |
|---|
| | 258 | void block_ChainLastAppend( block_t ***ppp_last, block_t *p_block ) |
|---|
| | 259 | { |
|---|
| | 260 | block_t *p_last = p_block; |
|---|
| | 261 | |
|---|
| | 262 | /* Append the block */ |
|---|
| | 263 | **ppp_last = p_block; |
|---|
| | 264 | |
|---|
| | 265 | /* Update last pointer */ |
|---|
| | 266 | while( p_last->p_next ) p_last = p_last->p_next; |
|---|
| | 267 | *ppp_last = &p_last->p_next; |
|---|
| 257 | 268 | } |
|---|
| 258 | 269 | |
|---|