diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-01-21 21:30:48 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-01-21 21:30:48 +0000 |
commit | b7a22d846b581bfd9eebf8710eeefa1948495db9 (patch) | |
tree | ef7c0114a5c82d1cd09663de5c12676da9ba81d7 /libavcodec/mpegvideo.c | |
parent | 68f593b48433842f3407586679fe07f3e5199ab9 (diff) |
cleanup
Originally committed as revision 1487 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c262191390..4d47dd4e0d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2627,6 +2627,35 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) #endif } +/** + * combines the (truncated) bitstream to a complete frame + * @returns -1 if no complete frame could be created + */ +int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size){ + ParseContext *pc= &s->parse_context; + + pc->last_index= pc->index; + + if(next==-1){ + pc->buffer= av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); + + memcpy(&pc->buffer[pc->index], *buf, *buf_size); + pc->index += *buf_size; + return -1; + } + + if(pc->index){ + pc->buffer= av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); + + memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE ); + pc->index = 0; + *buf= pc->buffer; + *buf_size= pc->last_index + next; + } + + return 0; +} + void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length) { int bytes= length>>4; |