about the function x264_nal_encode

hao jiang txjhao at gmail.com
Sun Jul 17 19:41:21 PDT 2011


i checked the x264 daily
tarball<ftp://ftp.videolan.org/pub/videolan/x264/snapshots/>.
i found that the function "x264_nal_encode" has changed since 20100705.
before this day ,the function "x264_nal_encode" is defined as
<
/****************************************************************************
 * x264_nal_encode:
 ****************************************************************************/
int x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal, int
b_long_startcode )
{
    uint8_t *src = nal->p_payload;
    uint8_t *end = nal->p_payload + nal->i_payload;
    uint8_t *orig_dst = dst;
    if( h->param.b_annexb )
    {
        if( b_long_startcode )
            *dst++ = 0x00;
        *dst++ = 0x00;
        *dst++ = 0x00;
        *dst++ = 0x01;
    }
    else /* save room for size later */
        dst += 4;
    /* nal header */
    *dst++ = ( 0x00 << 7 ) | ( nal->i_ref_idc << 5 ) | nal->i_type;
    dst = h->bsf.nal_escape( dst, src, end );
    int size = (dst - orig_dst) - 4;
    /* Write the size header for mp4/etc */
    if( !h->param.b_annexb )
    {
        /* Size doesn't include the size of the header we're writing now. */
        orig_dst[0] = size>>24;
        orig_dst[1] = size>>16;
        orig_dst[2] = size>> 8;
        orig_dst[3] = size>> 0;
    }
    return size+4;
}
>
in the 20100705 daily tarball,the function  "x264_nal_encode" was defined as
<
/****************************************************************************
 * x264_nal_encode:
 ****************************************************************************/
void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
{
    uint8_t *src = nal->p_payload;
    uint8_t *end = nal->p_payload + nal->i_payload;
    uint8_t *orig_dst = dst;
    if( h->param.b_annexb )
    {
        if( nal->b_long_startcode )
            *dst++ = 0x00;
        *dst++ = 0x00;
        *dst++ = 0x00;
        *dst++ = 0x01;
    }
    else /* save room for size later */
        dst += 4;
    /* nal header */
    *dst++ = ( 0x00 << 7 ) | ( nal->i_ref_idc << 5 ) | nal->i_type;
    dst = h->bsf.nal_escape( dst, src, end );
    int size = (dst - orig_dst) - 4;
    /* Write the size header for mp4/etc */
    if( !h->param.b_annexb )
    {
        /* Size doesn't include the size of the header we're writing now. */
        orig_dst[0] = size>>24;
        orig_dst[1] = size>>16;
        orig_dst[2] = size>> 8;
        orig_dst[3] = size>> 0;
    }
    nal->i_payload = size+4;
    nal->p_payload = orig_dst;
}
>
in the plugin-ugly ,the plugin x264enc use the function as
<
 nal_size = x264_nal_encode (buffer + i_size + 2, &i_data, 0, &nal[sps_ni]);
>

is that mean i can't use the latest version of x264 when i use the lastest
version of gstx264enc?
-- 

Kang Ho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110718/b984151e/attachment.html>


More information about the gstreamer-devel mailing list