Changeset 0afe6776db69252dbba8dbb5a6bbe51f8f1c4822

Show
Ignore:
Timestamp:
10/26/07 10:35:52 (11 months ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1193387752 +0000
git-parent:

[79f436dba64987ab10aa0c8660adfc501f35e55e]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1193387752 +0000
Message:

Fix small issues in mux/ts.c:

- Fix potential memleak with SDT descriptors
- Fix compiler warning about unused variables when not using SDT descriptors
- Fix compiler warning about wrong type of psz_sdt_desc
- Add parenthesis

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/mux/mpeg/ts.c

    r22ec91d r0afe677  
    13371337                p_stream = (ts_stream_t*)p_input->p_sys; 
    13381338 
    1339                 if( ( p_stream == p_pcr_stream && 
    1340                       p_stream->i_pes_length < i_shaping_delay ) || 
    1341                     p_stream->i_pes_dts + p_stream->i_pes_length < 
    1342                     p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length
     1339                if( ( ( p_stream == p_pcr_stream ) && 
     1340                      ( p_stream->i_pes_length < i_shaping_delay ) ) || 
     1341                    ( p_stream->i_pes_dts + p_stream->i_pes_length < 
     1342                      p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length )
    13431343                { 
    13441344                    /* Need more data */ 
    13451345                    if( block_FifoCount( p_input->p_fifo ) <= 1 ) 
    13461346                    { 
    1347                         if( p_input->p_fmt->i_cat == AUDIO_ES || 
    1348                             p_input->p_fmt->i_cat == VIDEO_ES
     1347                        if( ( p_input->p_fmt->i_cat == AUDIO_ES ) || 
     1348                            ( p_input->p_fmt->i_cat == VIDEO_ES )
    13491349                        { 
    13501350                            /* We need more data */ 
     
    13561356                            continue; 
    13571357                        } 
    1358                         else 
     1358                        else if( p_input->p_fmt->i_cat == SPU_ES ) 
    13591359                        { 
    13601360                            /* Don't mux the SPU yet if it is too early */ 
     
    13641364                                p_spu->i_dts - p_pcr_stream->i_pes_dts; 
    13651365 
    1366                             if( i_spu_delay > i_shaping_delay && 
    1367                                 i_spu_delay < I64C(100000000) ) 
     1366                            if( ( i_spu_delay > i_shaping_delay ) && 
     1367                                ( i_spu_delay < I64C(100000000) ) ) 
    13681368                                continue; 
    13691369 
    1370                             if ( i_spu_delay >= I64C(100000000) 
    1371                                   || i_spu_delay < I64C(10000) ) 
     1370                            if ( ( i_spu_delay >= I64C(100000000) ) || 
     1371                                 ( i_spu_delay < I64C(10000) ) ) 
    13721372                            { 
    13731373                                BufferChainClean( p_mux->p_sout, 
     
    22122212    sout_mux_sys_t  *p_sys = p_mux->p_sys; 
    22132213    block_t   *p_pmt[MAX_PMT]; 
    2214     block_t   *p_sdt; 
    2215  
    2216     dvbpsi_sdt_t        sdt; 
     2214 
    22172215    dvbpsi_pmt_es_t     *p_es; 
    2218     dvbpsi_psi_section_t *p_section[MAX_PMT], *p_section2; 
    2219     dvbpsi_sdt_service_t *p_service; 
    2220     char            *psz_sdt_desc; 
     2216    dvbpsi_psi_section_t *p_section[MAX_PMT]; 
     2217 
    22212218    int             i_pidinput; 
    2222  
    22232219    int             i_stream; 
    22242220    int             i; 
    22252221    int             *p_usepid = NULL; 
     2222 
     2223#ifdef HAVE_DVBPSI_SDT 
     2224    block_t         *p_sdt; 
     2225    dvbpsi_sdt_t    sdt; 
     2226 
     2227    dvbpsi_psi_section_t* p_section2; 
     2228    dvbpsi_sdt_service_t *p_service; 
     2229 
     2230    uint8_t         *psz_sdt_desc; 
     2231#endif 
    22262232 
    22272233    if( p_sys->dvbpmt == NULL ) 
     
    22542260 
    22552261            /* FIXME: Ineffecient malloc's & ugly code......  */ 
    2256             if( psz_sdtprov != NULL && psz_sdtserv != NULL
     2262            if( ( psz_sdtprov != NULL ) && ( psz_sdtserv != NULL )
    22572263            { 
    22582264                psz_sdt_desc = malloc( 3 + strlen(psz_sdtprov) 
    22592265                                         + strlen(psz_sdtserv) ); 
    2260                 psz_sdt_desc[0] = 0x01; /* digital television service */ 
    2261  
    2262                 /* service provider name length */ 
    2263                 psz_sdt_desc[1] = (char)strlen(psz_sdtprov); 
    2264                 memcpy( &psz_sdt_desc[2], psz_sdtprov, strlen(psz_sdtprov) ); 
    2265  
    2266                 /* service name length */ 
    2267                 psz_sdt_desc[ 2 + strlen(psz_sdtprov) ] 
    2268                     = (char)strlen(psz_sdtserv); 
    2269                 memcpy( &psz_sdt_desc[3+strlen(psz_sdtprov)], psz_sdtserv, 
    2270                         strlen(psz_sdtserv) ); 
    2271  
    2272                 dvbpsi_SDTServiceAddDescriptor( p_service, 0x48, 
    2273                         3 + strlen(psz_sdtprov) + strlen(psz_sdtserv), 
    2274                         psz_sdt_desc ); 
    2275                 free( psz_sdt_desc ); 
     2266                if( psz_sdt_desc ) 
     2267                { 
     2268                    psz_sdt_desc[0] = 0x01; /* digital television service */ 
     2269 
     2270                    /* service provider name length */ 
     2271                    psz_sdt_desc[1] = (char)strlen(psz_sdtprov); 
     2272                    memcpy( &psz_sdt_desc[2], psz_sdtprov, strlen(psz_sdtprov) ); 
     2273 
     2274                    /* service name length */ 
     2275                    psz_sdt_desc[ 2 + strlen(psz_sdtprov) ] 
     2276                        = (char)strlen(psz_sdtserv); 
     2277                    memcpy( &psz_sdt_desc[3+strlen(psz_sdtprov)], psz_sdtserv, 
     2278                            strlen(psz_sdtserv) ); 
     2279 
     2280                    dvbpsi_SDTServiceAddDescriptor( p_service, 0x48, 
     2281                            3 + strlen(psz_sdtprov) + strlen(psz_sdtserv), 
     2282                            (uint8_t *)psz_sdt_desc ); 
     2283                    free( psz_sdt_desc ); 
     2284                    psz_sdt_desc = NULL; 
     2285                } 
    22762286            } 
    22772287#undef psz_sdtprov