[MPlayer-cvslog] r31356 - in trunk: libmpcodecs/vd_libmpeg2.c libmpeg2/libmpeg2_changes.diff libmpeg2/mpeg2_internal.h
diego
subversion at mplayerhq.hu
Wed Jun 9 18:56:22 CEST 2010
Author: diego
Date: Wed Jun 9 18:56:21 2010
New Revision: 31356
Log:
libmpeg2: Move pending_buffer stuff to local decoder context.
It is only used in our wrapper code, so there is no point to patch it into our
libmpeg2 copy. This also helps when trying to use external libmpeg2.
patch by Luca Barbato
Modified:
trunk/libmpcodecs/vd_libmpeg2.c
trunk/libmpeg2/libmpeg2_changes.diff
trunk/libmpeg2/mpeg2_internal.h
Modified: trunk/libmpcodecs/vd_libmpeg2.c
==============================================================================
--- trunk/libmpcodecs/vd_libmpeg2.c Wed Jun 9 18:07:46 2010 (r31355)
+++ trunk/libmpcodecs/vd_libmpeg2.c Wed Jun 9 18:56:21 2010 (r31356)
@@ -52,6 +52,8 @@ typedef struct {
int width;
int height;
double aspect;
+ unsigned char *pending_buffer;
+ int pending_length;
} vd_libmpeg2_ctx_t;
// to set/get/query special features/parameters
@@ -115,9 +117,6 @@ static int init(sh_video_t *sh){
context->mpeg2dec = mpeg2dec;
sh->context = context;
- mpeg2dec->pending_buffer = 0;
- mpeg2dec->pending_length = 0;
-
return 1;
}
@@ -126,7 +125,7 @@ static void uninit(sh_video_t *sh){
int i;
vd_libmpeg2_ctx_t *context = sh->context;
mpeg2dec_t * mpeg2dec = context->mpeg2dec;
- if (mpeg2dec->pending_buffer) free(mpeg2dec->pending_buffer);
+ if (context->pending_buffer) free(context->pending_buffer);
mpeg2dec->decoder.convert=NULL;
mpeg2dec->decoder.convert_id=NULL;
mpeg2_close (mpeg2dec);
@@ -170,8 +169,8 @@ static mp_image_t* decode(sh_video_t *sh
((char*)data+len)[3]=0xff;
len+=4;
- if (mpeg2dec->pending_length) {
- mpeg2_buffer (mpeg2dec, mpeg2dec->pending_buffer, mpeg2dec->pending_buffer + mpeg2dec->pending_length);
+ if (context->pending_length) {
+ mpeg2_buffer (mpeg2dec, context->pending_buffer, context->pending_buffer + context->pending_length);
} else {
mpeg2_buffer (mpeg2dec, data, (uint8_t *)data+len);
}
@@ -185,9 +184,9 @@ static mp_image_t* decode(sh_video_t *sh
switch(state){
case STATE_BUFFER:
- if (mpeg2dec->pending_length) {
+ if (context->pending_length) {
// just finished the pending data, continue with processing of the passed buffer
- mpeg2dec->pending_length = 0;
+ context->pending_length = 0;
mpeg2_buffer (mpeg2dec, data, (uint8_t *)data+len);
} else {
// parsing of the passed buffer finished, return.
@@ -288,17 +287,17 @@ static mp_image_t* decode(sh_video_t *sh
// decoding done:
if(info->display_fbuf) {
mp_image_t* mpi = info->display_fbuf->id;
- if (mpeg2dec->pending_length == 0) {
- mpeg2dec->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start;
- mpeg2dec->pending_buffer = realloc(mpeg2dec->pending_buffer, mpeg2dec->pending_length);
- memcpy(mpeg2dec->pending_buffer, mpeg2dec->buf_start, mpeg2dec->pending_length);
+ if (context->pending_length == 0) {
+ context->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start;
+ context->pending_buffer = realloc(context->pending_buffer, context->pending_length);
+ memcpy(context->pending_buffer, mpeg2dec->buf_start, context->pending_length);
} else {
// still some data in the pending buffer, shouldn't happen
- mpeg2dec->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start;
- memmove(mpeg2dec->pending_buffer, mpeg2dec->buf_start, mpeg2dec->pending_length);
- mpeg2dec->pending_buffer = realloc(mpeg2dec->pending_buffer, mpeg2dec->pending_length + len);
- memcpy(mpeg2dec->pending_buffer+mpeg2dec->pending_length, data, len);
- mpeg2dec->pending_length += len;
+ context->pending_length = mpeg2dec->buf_end - mpeg2dec->buf_start;
+ memmove(context->pending_buffer, mpeg2dec->buf_start, context->pending_length);
+ context->pending_buffer = realloc(context->pending_buffer, context->pending_length + len);
+ memcpy(context->pending_buffer+context->pending_length, data, len);
+ context->pending_length += len;
}
return mpi;
}
Modified: trunk/libmpeg2/libmpeg2_changes.diff
==============================================================================
--- trunk/libmpeg2/libmpeg2_changes.diff Wed Jun 9 18:07:46 2010 (r31355)
+++ trunk/libmpeg2/libmpeg2_changes.diff Wed Jun 9 18:56:21 2010 (r31356)
@@ -355,16 +355,6 @@ Index: libmpeg2/motion_comp_vis.c
};
typedef struct {
-@@ -223,6 +232,9 @@
- //int8_t q_scale_type, scaled[4];
- uint8_t quantizer_matrix[4][64];
- uint8_t new_quantizer_matrix[4][64];
-+
-+ unsigned char *pending_buffer;
-+ int pending_length;
- };
-
- typedef struct {
@@ -226,7 +238,7 @@
};
Modified: trunk/libmpeg2/mpeg2_internal.h
==============================================================================
--- trunk/libmpeg2/mpeg2_internal.h Wed Jun 9 18:07:46 2010 (r31355)
+++ trunk/libmpeg2/mpeg2_internal.h Wed Jun 9 18:56:21 2010 (r31356)
@@ -232,9 +232,6 @@ struct mpeg2dec_s {
//int8_t q_scale_type, scaled[4];
uint8_t quantizer_matrix[4][64];
uint8_t new_quantizer_matrix[4][64];
-
- unsigned char *pending_buffer;
- int pending_length;
};
typedef struct {
More information about the MPlayer-cvslog
mailing list