summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libvdpau/dpb.c5
-rw-r--r--src/libvdpau/dpb.h5
-rw-r--r--src/libvdpau/vdpau_h264.c19
3 files changed, 18 insertions, 11 deletions
diff --git a/src/libvdpau/dpb.c b/src/libvdpau/dpb.c
index a13e758bf..d6a6c25df 100644
--- a/src/libvdpau/dpb.c
+++ b/src/libvdpau/dpb.c
@@ -10,14 +10,16 @@
#include <string.h>
#include "dpb.h"
+#include "video_out.h"
struct decoded_picture* init_decoded_picture(struct nal_unit *src_nal,
- VdpVideoSurface surface)
+ VdpVideoSurface surface, vo_frame_t *img)
{
struct decoded_picture *pic = malloc(sizeof(struct decoded_picture));
pic->nal = init_nal_unit();
copy_nal_unit(pic->nal, src_nal);
pic->surface = surface;
+ pic->img = img;
pic->next = NULL;
return pic;
@@ -25,6 +27,7 @@ struct decoded_picture* init_decoded_picture(struct nal_unit *src_nal,
void free_decoded_picture(struct decoded_picture *pic)
{
+ pic->img->free(pic->img);
free_nal_unit(pic->nal);
}
diff --git a/src/libvdpau/dpb.h b/src/libvdpau/dpb.h
index 8aa430c26..857f2fa5f 100644
--- a/src/libvdpau/dpb.h
+++ b/src/libvdpau/dpb.h
@@ -9,9 +9,12 @@
#define DPB_H_
#include "nal.h"
+#include "video_out.h"
struct decoded_picture {
VdpVideoSurface surface;
+ vo_frame_t *img; /* this is the image we block, to make sure
+ * the surface is not double-used */
struct nal_unit *nal;
struct decoded_picture *next;
@@ -23,7 +26,7 @@ struct dpb {
};
struct decoded_picture* init_decoded_picture(struct nal_unit *src_nal,
- VdpVideoSurface surface);
+ VdpVideoSurface surface, vo_frame_t *img);
void free_decoded_picture(struct decoded_picture *pic);
struct decoded_picture* dpb_get_picture(struct dpb *dpb, uint32_t picnum);
diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c
index 35e45bb0e..b53e77551 100644
--- a/src/libvdpau/vdpau_h264.c
+++ b/src/libvdpau/vdpau_h264.c
@@ -240,7 +240,7 @@ static void vdpau_h264_decode_data (video_decoder_t *this_gen,
this->profile, this->width, this->height, &this->decoder);
if(status != VDP_STATUS_OK)
- xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: ERROR: VdpDecoderCreate returned status != OK (%d)\n", status);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: ERROR: VdpDecoderCreate returned status != OK (%s)\n", this->vdpau_accel->vdp_get_error_string(status));
else
this->decoder_initialized = 1;
@@ -334,7 +334,7 @@ static void vdpau_h264_decode_data (video_decoder_t *this_gen,
&surface);
this->vdpau_accel->surface = surface;
if(status != VDP_STATUS_OK)
- xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: Surface creation failed\n");
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: Surface creation failed: %s\n", this->vdpau_accel->vdp_get_error_string(status));
}
printf("Decode: NUM: %d, REF: %d, BYTES: %d, PTS: %lld\n", pic.frame_num, pic.is_reference, vdp_buffer.bitstream_bytes, buf->pts);
@@ -342,21 +342,22 @@ static void vdpau_h264_decode_data (video_decoder_t *this_gen,
surface, (VdpPictureInfo*)&pic, 1, &vdp_buffer);
if(status != VDP_STATUS_OK)
- xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: Decoder failure: %d\n", status);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "vdpau_h264: Decoder failure: %s\n", this->vdpau_accel->vdp_get_error_string(status));
else {
printf("DECODING SUCCESS\n");
- if(pic.is_reference) {
- struct decoded_picture *pic = init_decoded_picture(this->nal_parser->current_nal, surface);
- dpb_add_picture(&(this->nal_parser->dpb), pic);
- }
-
img->duration = this->video_step;
img->pts = buf->pts;
img->bad_frame = 0;
img->draw(img, this->stream);
- img->free(img);
+
+ if(pic.is_reference) {
+ struct decoded_picture *pic = init_decoded_picture(this->nal_parser->current_nal, surface, img);
+ dpb_add_picture(&(this->nal_parser->dpb), pic);
+ } else {
+ img->free(img);
+ }
img = NULL;
}