diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2009-03-23 11:18:27 +0000 |
---|---|---|
committer | Reinhard Nißl <rnissl@gmx.de> | 2009-03-23 11:18:27 +0000 |
commit | 6b74e1ea780e2f1f20aa45f5a130ca20151a12fe (patch) | |
tree | fce560862919f1220b71faa961d4d0b1f9f5bdb9 /src/libvdpau/dpb.c | |
parent | dad0229ab95b40e83ad8368bf00c33f1aa73b4ad (diff) | |
download | xine-lib-6b74e1ea780e2f1f20aa45f5a130ca20151a12fe.tar.gz xine-lib-6b74e1ea780e2f1f20aa45f5a130ca20151a12fe.tar.bz2 |
Allow interception of vdpau frame type by post plugins; fix dpb issues on broken streams (missing or doubled images in dpb).
Diffstat (limited to 'src/libvdpau/dpb.c')
-rw-r--r-- | src/libvdpau/dpb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libvdpau/dpb.c b/src/libvdpau/dpb.c index 9aa2f4298..01f147639 100644 --- a/src/libvdpau/dpb.c +++ b/src/libvdpau/dpb.c @@ -240,6 +240,31 @@ int dpb_remove_picture(struct dpb *dpb, struct decoded_picture *rempic) return -1; } +static int dpb_remove_picture_by_img(struct dpb *dpb, vo_frame_t *remimg) +{ + struct decoded_picture *pic = dpb->pictures; + struct decoded_picture *last_pic = NULL; + + if (pic != NULL) + do { + if (pic->img == remimg) { + // FIXME: free the picture.... + + if (last_pic != NULL) + last_pic->next = pic->next; + else + dpb->pictures = pic->next; + free_decoded_picture(pic); + dpb->used--; + return 0; + } + + last_pic = pic; + } while ((pic = pic->next) != NULL); + + return -1; +} + int dpb_remove_picture_by_picnum(struct dpb *dpb, uint32_t picnum) { struct decoded_picture *pic = dpb->pictures; @@ -259,6 +284,12 @@ int dpb_remove_picture_by_picnum(struct dpb *dpb, uint32_t picnum) int dpb_add_picture(struct dpb *dpb, struct decoded_picture *pic, uint32_t num_ref_frames) { + pic->img->lock(pic->img); + if (0 == dpb_remove_picture_by_img(dpb, pic->img)) + fprintf(stderr, "broken stream: current img was already in dpb -- freed it\n"); + else + pic->img->free(pic->img); + int i = 0; struct decoded_picture *last_pic = dpb->pictures; |