summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Scheel <julian@jusst.de>2010-01-15 17:01:07 +0100
committerJulian Scheel <julian@jusst.de>2010-01-15 17:01:07 +0100
commitbf3c4913014b78598b021c61b7275d72ab947cdb (patch)
tree894701baf0c1c5cf2cc1b9493827db40dd2c25c9
parente3fe265b0651f3544326a2e010db646957f3be55 (diff)
downloadxine-lib-bf3c4913014b78598b021c61b7275d72ab947cdb.tar.gz
xine-lib-bf3c4913014b78598b021c61b7275d72ab947cdb.tar.bz2
Fix seeking
Do not discard the parser, but reset fields that won't be valid after a decoder reset (ie seek) anymore
-rw-r--r--src/video_dec/libvdpau/h264_parser.c22
-rw-r--r--src/video_dec/libvdpau/h264_parser.h1
-rw-r--r--src/video_dec/libvdpau/vdpau_h264.c3
3 files changed, 24 insertions, 2 deletions
diff --git a/src/video_dec/libvdpau/h264_parser.c b/src/video_dec/libvdpau/h264_parser.c
index 6bad1ac4d..505891caf 100644
--- a/src/video_dec/libvdpau/h264_parser.c
+++ b/src/video_dec/libvdpau/h264_parser.c
@@ -1549,9 +1549,31 @@ struct h264_parser* init_parser(xine_t *xine)
return parser;
}
+void reset_parser(struct h264_parser *parser)
+{
+ parser->position = NON_VCL;
+ parser->buf_len = parser->prebuf_len = 0;
+ parser->next_nal_position = 0;
+ parser->last_nal_res = 0;
+
+ if(parser->last_vcl_nal) {
+ release_nal_unit(parser->last_vcl_nal);
+ }
+ parser->last_vcl_nal = NULL;
+
+ parser->prev_pic_order_cnt_msb = 1 << 16;
+ parser->prev_pic_order_cnt_lsb = 0;
+ parser->frame_num_offset = 0;
+ parser->prev_top_field_order_cnt = 0;
+ parser->curr_pic_num = 0;
+ parser->flag_mask = 0;
+}
+
void free_parser(struct h264_parser *parser)
{
dpb_free_all(&parser->dpb);
+ free_nal_buffer(parser->pps_buffer);
+ free_nal_buffer(parser->sps_buffer);
free(parser);
}
diff --git a/src/video_dec/libvdpau/h264_parser.h b/src/video_dec/libvdpau/h264_parser.h
index 71b99514b..d75a1e4d7 100644
--- a/src/video_dec/libvdpau/h264_parser.h
+++ b/src/video_dec/libvdpau/h264_parser.h
@@ -94,6 +94,7 @@ int parse_nal(uint8_t *buf, int buf_len, struct h264_parser *parser,
int seek_for_nal(uint8_t *buf, int buf_len, struct h264_parser *parser);
struct h264_parser* init_parser(xine_t *xine);
+void reset_parser(struct h264_parser *parser);
void free_parser(struct h264_parser *parser);
int parse_frame(struct h264_parser *parser, uint8_t *inbuf, int inbuf_len,
int64_t pts,
diff --git a/src/video_dec/libvdpau/vdpau_h264.c b/src/video_dec/libvdpau/vdpau_h264.c
index 0f7a039f9..6341a1b9a 100644
--- a/src/video_dec/libvdpau/vdpau_h264.c
+++ b/src/video_dec/libvdpau/vdpau_h264.c
@@ -709,13 +709,12 @@ static void vdpau_h264_reset (video_decoder_t *this_gen) {
this->decoder = VDP_INVALID_HANDLE;
}
- free_parser(this->nal_parser);
+ reset_parser(this->nal_parser);
this->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601;
this->wait_for_bottom_field = 0;
this->video_step = 0;
- this->nal_parser = init_parser(this->stream->xine);
if(this->codec_private_len > 0) {
parse_codec_private(this->nal_parser, this->codec_private, this->codec_private_len);