diff options
-rw-r--r-- | libmpcodecs/mp_image.h | 9 | ||||
-rw-r--r-- | libmpcodecs/vd_libmpeg2.c | 9 | ||||
-rw-r--r-- | libmpcodecs/vf.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_softpulldown.c | 18 |
4 files changed, 22 insertions, 16 deletions
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index 0ff66d27d8..9efe128954 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -64,8 +64,11 @@ #define MP_MAX_PLANES 4 -#define MP_IMGMPEG2FLAG_TOP_FIELD_FIRST 0x01 -#define MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD 0x02 +#define MP_IMGFIELD_ORDERED 0x01 +#define MP_IMGFIELD_TOP_FIRST 0x02 +#define MP_IMGFIELD_REPEAT_FIRST 0x04 +#define MP_IMGFIELD_TOP 0x08 +#define MP_IMGFIELD_BOTTOM 0x10 typedef struct mp_image_s { unsigned short flags; @@ -79,7 +82,7 @@ typedef struct mp_image_s { char * qscale; int qstride; int pict_type; // 0->unknown, 1->I, 2->P, 3->B - int mpeg2_flags; + int fields; int qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 int num_planes; /* these are only used by planar formats Y,U(Cb),V(Cr) */ diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c index d01be511c7..41f8fc37a9 100644 --- a/libmpcodecs/vd_libmpeg2.c +++ b/libmpcodecs/vd_libmpeg2.c @@ -144,11 +144,12 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ if(!mpi) return 0; // VO ERROR!!!!!!!! mpeg2_set_buf(mpeg2dec, mpi->planes, mpi); if (info->current_picture->flags&PIC_FLAG_TOP_FIELD_FIRST) - mpi->mpeg2_flags |= MP_IMGMPEG2FLAG_TOP_FIELD_FIRST; - else mpi->mpeg2_flags &= ~MP_IMGMPEG2FLAG_TOP_FIELD_FIRST; + mpi->fields |= MP_IMGFIELD_TOP_FIRST; + else mpi->fields &= ~MP_IMGFIELD_TOP_FIRST; if (info->current_picture->flags&PIC_FLAG_REPEAT_FIRST_FIELD) - mpi->mpeg2_flags |= MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD; - else mpi->mpeg2_flags &= ~MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD; + mpi->fields |= MP_IMGFIELD_REPEAT_FIRST; + else mpi->fields &= ~MP_IMGFIELD_REPEAT_FIRST; + mpi->fields |= MP_IMGFIELD_ORDERED; #ifdef MPEG12_POSTPROC if(!mpi->qscale){ diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 861b128ec7..d50e52aeec 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -439,7 +439,7 @@ unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int pr void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){ dst->pict_type= src->pict_type; - dst->mpeg2_flags = src->mpeg2_flags; + dst->fields = src->fields; dst->qscale_type= src->qscale_type; if(dst->width == src->width && dst->height == src->height){ dst->qstride= src->qstride; diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c index 909a22bc50..67811a1362 100644 --- a/libmpcodecs/vf_softpulldown.c +++ b/libmpcodecs/vf_softpulldown.c @@ -37,7 +37,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) { mp_image_t *dmpi; int ret = 0; - int flags = mpi->mpeg2_flags; + int flags = mpi->fields; int state = vf->priv->state; dmpi = vf_get_image(vf->next, mpi->imgfmt, @@ -47,19 +47,21 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) vf->priv->in++; if ((state == 0 && - !(flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST)) || + !(flags & MP_IMGFIELD_TOP_FIRST)) || (state == 1 && - flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST)) + flags & MP_IMGFIELD_TOP_FIRST)) { mp_msg(MSGT_VFILTER, MSGL_WARN, - "softpulldown: Unexpected mpeg2 flags: state=%d top_field_first=%d repeat_first_field=%d\n", + "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", state, - (flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST) == 1, - (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) == 1); + (flags & MP_IMGFIELD_TOP_FIRST) != 0, + (flags & MP_IMGFIELD_REPEAT_FIRST) != 0); + state ^= 1; + } if (state == 0) { ret = vf_next_put_image(vf, mpi); vf->priv->out++; - if (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) { + if (flags & MP_IMGFIELD_REPEAT_FIRST) { my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, dmpi->stride[0]*2, mpi->stride[0]*2); @@ -95,7 +97,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) } ret = vf_next_put_image(vf, dmpi); vf->priv->out++; - if (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) { + if (flags & MP_IMGFIELD_REPEAT_FIRST) { ret |= vf_next_put_image(vf, mpi); vf->priv->out++; state=0; |