--- branches/release-1_1-branch/xvidcore/vfw/src/codec.c 2005/11/22 10:23:02 1654 +++ branches/release-1_1-branch/xvidcore/vfw/src/codec.c 2006/07/10 17:26:13 1717 @@ -580,11 +580,12 @@ create.global |= XVID_GLOBAL_CLOSED_GOP; - /* dxn: restrict max bframes and enable packed bframes */ - if ((profiles[codec->config.profile].flags & PROFILE_EXTRA)) { + /* restrict max bframes */ + if ((create.max_bframes > profiles[codec->config.profile].xvid_max_bframes) && (profiles[codec->config.profile].xvid_max_bframes >= 0)) + create.max_bframes = profiles[codec->config.profile].xvid_max_bframes; - if (create.max_bframes > profiles[codec->config.profile].xvid_max_bframes) - create.max_bframes = profiles[codec->config.profile].xvid_max_bframes; + /* dxn: enable packed bframes */ + if ((profiles[codec->config.profile].flags & PROFILE_PACKED)) { create.global |= XVID_GLOBAL_PACKED; } @@ -630,6 +631,9 @@ LRESULT compress_end(CODEC * codec) { + if (codec==NULL) + return ICERR_OK; + if (codec->m_hdll != NULL) { if (codec->ehandle != NULL) { codec->xvid_encore_func(codec->ehandle, XVID_ENC_DESTROY, NULL, NULL);