diff options
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/mp_image.h | 3 | ||||
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf.c | 4 |
3 files changed, 4 insertions, 5 deletions
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index 7d82707d10..ddf52c71c5 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -54,8 +54,6 @@ // buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) #define MP_IMGFLAG_TYPE_DISPLAYED 0x8000 -// set if it can not be reused yet (for MP_IMGTYPE_NUMBERED) -#define MP_IMGFLAG_IN_USE 0x10000 // codec doesn't support any form of direct rendering - it has own buffer // allocation. so we just export its buffer pointers: @@ -101,6 +99,7 @@ typedef struct mp_image_s { int chroma_height; int chroma_x_shift; // horizontal int chroma_y_shift; // vertical + int usage_count; /* for private use by filter or vo driver (to store buffer id or dmpi) */ void* priv; } mp_image_t; diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index a35f4ddd2c..e8e53cae2b 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -719,7 +719,7 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){ } #endif // release mpi (in case MPI_IMGTYPE_NUMBERED is used, e.g. for VDPAU) - mpi->flags &= ~MP_IMGFLAG_IN_USE; + mpi->usage_count--; } if(pic->type!=FF_BUFFER_TYPE_USER){ diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index ad72f304d3..0f286d6e3e 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -304,7 +304,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, if (number == -1) { int i; for (i = 0; i < NUM_NUMBERED_MPI; i++) - if (!vf->imgctx.numbered_images[i] || !(vf->imgctx.numbered_images[i]->flags & MP_IMGFLAG_IN_USE)) + if (!vf->imgctx.numbered_images[i] || !vf->imgctx.numbered_images[i]->usage_count) break; number = i; } @@ -431,7 +431,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->qscale = NULL; } - mpi->flags |= MP_IMGFLAG_IN_USE; + mpi->usage_count++; // printf("\rVF_MPI: %p %p %p %d %d %d \n", // mpi->planes[0],mpi->planes[1],mpi->planes[2], // mpi->stride[0],mpi->stride[1],mpi->stride[2]); |