Changeset e114bdd7ffd180a04bf83e8c1af5c4132a3771ad

Show
Ignore:
Timestamp:
21/08/08 19:08:54 (3 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1219338534 +0200
git-parent:

[0bf165646d0dd39ad1bc698cdde0bbff1711e24d]

git-author:
Laurent Aimar <fenrir@videolan.org> 1219338381 +0200
Message:

Added BLOCK_FLAG_END_OF_SEQUENCE and use it for mpeg2.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_block.h

    rebd8003 re114bdd  
    6969/** This is not a key frame for bitrate shaping */ 
    7070#define BLOCK_FLAG_NO_KEYFRAME   0x0080 
     71/** This block contains the last part of a sequence  */ 
     72#define BLOCK_FLAG_END_OF_SEQUENCE 0x0100 
    7173/** This block contains a clock reference */ 
    7274#define BLOCK_FLAG_CLOCK         0x0200 
  • modules/codec/avcodec/video.c

    ra827517 re114bdd  
    8282    int i_buffer_orig, i_buffer; 
    8383    char *p_buffer_orig, *p_buffer; 
     84 
     85 
     86    /* */ 
     87    bool b_flush; 
    8488}; 
    8589 
     
    319323    p_sys->b_has_b_frames = false; 
    320324    p_sys->b_first_frame = true; 
     325    p_sys->b_flush = false; 
    321326    p_sys->i_late_frames = 0; 
    322327    p_sys->i_buffer = 0; 
     
    479484    if( p_block->i_buffer > 0 ) 
    480485    { 
     486        p_sys->b_flush = ( p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE ) != 0; 
     487 
    481488        p_sys->i_buffer = p_block->i_buffer; 
    482489        if( p_sys->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE > 
     
    502509    } 
    503510 
    504     while( p_sys->i_buffer > 0
     511    while( p_sys->i_buffer > 0 || p_sys->b_flush
    505512    { 
    506513        int i_used, b_gotpicture; 
     
    509516        i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic, 
    510517                                       &b_gotpicture, 
    511                                        (uint8_t*)p_sys->p_buffer, p_sys->i_buffer ); 
     518                                       p_sys->i_buffer <= 0 && p_sys->b_flush ? NULL : (uint8_t*)p_sys->p_buffer, p_sys->i_buffer ); 
     519 
    512520        if( b_null_size && p_sys->p_context->width > 0 && 
    513             p_sys->p_context->height > 0 ) 
     521            p_sys->p_context->height > 0 && 
     522            !p_sys->b_flush ) 
    514523        { 
    515524            /* Reparse it to not drop the I frame */ 
     
    522531        } 
    523532 
     533        if( p_sys->b_flush ) 
     534            p_sys->b_first_frame = true; 
     535 
     536        if( p_sys->i_buffer <= 0 ) 
     537            p_sys->b_flush = false; 
     538 
    524539        if( i_used < 0 ) 
    525540        { 
     
    537552        p_sys->i_buffer -= i_used; 
    538553        p_sys->p_buffer += i_used; 
     554 
     555    p_sys->b_first_frame = true; 
    539556 
    540557        /* Nothing to display */ 
  • modules/packetizer/mpegvideo.c

    r3561b9b re114bdd  
    446446             (p_frag->p_buffer[3] == 0x00 || p_frag->p_buffer[3] > 0xaf) ) 
    447447    { 
     448        const bool b_eos = p_frag->p_buffer[3] == 0xb7; 
     449 
    448450        mtime_t i_duration; 
    449451 
     452        if( b_eos ) 
     453        { 
     454            block_ChainLastAppend( &p_sys->pp_last, p_frag ); 
     455            p_frag = NULL; 
     456        } 
     457 
    450458        p_pic = block_ChainGather( p_sys->p_frame ); 
     459 
     460        if( b_eos ) 
     461            p_pic->i_flags |= BLOCK_FLAG_END_OF_SEQUENCE; 
    451462 
    452463        i_duration = (mtime_t)( 1000000 * p_sys->i_frame_rate_base / 
     
    564575    } 
    565576 
     577    if( !p_frag ) 
     578        return p_pic; 
    566579    /* 
    567580     * Check info of current fragment