Changeset 235529f2aca9d8ee263d0723792e91d582f1816a

Show
Ignore:
Timestamp:
08/07/08 21:36:48 (5 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1215545808 +0000
git-parent:

[da12022b26ca3f95c4038ceb73926603c27b8f1e]

git-author:
Laurent Aimar <fenrir@videolan.org> 1215545576 +0000
Message:

Fixed used of uninitialized memory on unsupported track.
Fixed usage of start_time.
(It should fix #799)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/avformat/demux.c

    rd9330dd r235529f  
    201201        es_format_t  fmt; 
    202202        vlc_fourcc_t fcc; 
     203        const char *psz_type = "unknown"; 
    203204 
    204205        if( !GetVlcFourcc( cc->codec_id, NULL, &fcc, NULL ) ) 
     
    222223            fmt.audio.i_bitspersample = cc->bits_per_sample; 
    223224            fmt.audio.i_blockalign = cc->block_align; 
     225            psz_type = "audio"; 
    224226            break; 
    225227        case CODEC_TYPE_VIDEO: 
     
    232234                *fmt.video.p_palette = *(video_palette_t *)cc->palctrl; 
    233235            } 
     236            psz_type = "video"; 
    234237            break; 
    235238        case CODEC_TYPE_SUBTITLE: 
    236239            es_format_Init( &fmt, SPU_ES, fcc ); 
    237             break; 
     240            psz_type = "subtitle"; 
     241            break; 
     242 
    238243        default: 
     244            es_format_Init( &fmt, UNKNOWN_ES, 0 ); 
     245            if( cc->codec_type == CODEC_TYPE_DATA ) 
     246                psz_type = "data"; 
     247            else if( cc->codec_type == CODEC_TYPE_ATTACHMENT ) 
     248                psz_type = "attachment"; 
     249 
    239250            msg_Warn( p_demux, "unsupported track type in ffmpeg demux" ); 
    240251            break; 
     
    247258 
    248259        msg_Dbg( p_demux, "adding es: %s codec = %4.4s", 
    249                  cc->codec_type == CODEC_TYPE_AUDIO ? "audio" : "video", 
    250                  (char*)&fcc ); 
     260                 psz_type, (char*)&fcc ); 
    251261        TAB_APPEND( p_sys->i_tk, p_sys->tk, es ); 
    252262    } 
     
    316326 
    317327    i_start_time = ( p_sys->ic->start_time != (int64_t)AV_NOPTS_VALUE ) ? 
    318         ( p_sys->ic->start_time / AV_TIME_BASE )  : 0; 
     328        ( p_sys->ic->start_time * 1000000 / AV_TIME_BASE )  : 0; 
    319329 
    320330    p_frame->i_dts = ( pkt.dts == (int64_t)AV_NOPTS_VALUE ) ? 
    321         0 : (pkt.dts - i_start_time) * 1000000 * 
     331        0 : (pkt.dts) * 1000000 * 
    322332        p_sys->ic->streams[pkt.stream_index]->time_base.num / 
    323         p_sys->ic->streams[pkt.stream_index]->time_base.den
     333        p_sys->ic->streams[pkt.stream_index]->time_base.den - i_start_time
    324334    p_frame->i_pts = ( pkt.pts == (int64_t)AV_NOPTS_VALUE ) ? 
    325         0 : (pkt.pts - i_start_time) * 1000000 * 
     335        0 : (pkt.pts) * 1000000 * 
    326336        p_sys->ic->streams[pkt.stream_index]->time_base.num / 
    327         p_sys->ic->streams[pkt.stream_index]->time_base.den
     337        p_sys->ic->streams[pkt.stream_index]->time_base.den - i_start_time
    328338 
    329339#ifdef AVFORMAT_DEBUG