From 64a1c261e9dbbe32372cd2d8970186e4b62a5d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Wed, 20 Jan 2010 23:42:48 +0100 Subject: demux_ts: pass each pts just once to buf (and to decoder) The content of large PES packets must be split into several input buffers. The current code attaches the PTS of the PES packet to all input buffers. A decoder must attach PTS to the image for example which starts next in the data. If the same PTS appears on several input buffers, a decoder might buffer the PTS and attach it to the next image for which the broadcaster didn't supply a PTS. Finally xine's metronom gets confused about those incorrect PTS and tries to correct that issue which usually makes things even more worse. By passing on PTS just once to the decoder it is less likely that the decoder behaves incorrect. I must admit that this is the second approach to fix this issue. The first approach slipped through into a totally different changeset and instead of passing the PTS just on the first buf, it passed it on the last buf of a PES packet which was totally wrong. This incorrect approach has been reverted recently. --- src/demuxers/demux_ts.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1a19340f3..1a016fea9 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -987,6 +987,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->decoder_flags |= BUF_FLAG_FRAME_END; } m->buf->pts = m->pts; + m->pts = 0; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) @@ -995,12 +996,12 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); +#ifdef TS_LOG + printf ("demux_ts: produced buffer, pts=%lld\n", m->buf->pts); +#endif m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = NULL; /* forget about buf -- not our responsibility anymore */ -#ifdef TS_LOG - printf ("demux_ts: produced buffer, pts=%lld\n", m->pts); -#endif } /* allocate the buffer here, as pes_header needs a valid buf for dvbsubs */ m->buf = m->fifo->buffer_pool_alloc(m->fifo); @@ -1033,6 +1034,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->size = m->buffered_bytes; m->buf->type = m->type; m->buf->pts = m->pts; + m->pts = 0; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * @@ -1040,15 +1042,12 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); - +#ifdef TS_LOG + printf ("demux_ts: produced buffer, pts=%lld\n", m->buf->pts); +#endif m->fifo->put(m->fifo, m->buf); m->buffered_bytes = 0; m->buf = m->fifo->buffer_pool_alloc(m->fifo); - -#ifdef TS_LOG - printf ("demux_ts: produced buffer, pts=%lld\n", m->pts); -#endif - } memcpy(m->buf->mem + m->buffered_bytes, ts, len); m->buffered_bytes += len; -- cgit v1.2.3 From a9ab2429f5b734f832349f4c3d32a23faebd2343 Mon Sep 17 00:00:00 2001 From: Eddie Goodall Date: Thu, 21 Jan 2010 00:06:48 +0000 Subject: Fix width and padding bugs in opengl fragprog renderer There's a rendering bug when using the opengl fragment program if the width of the video is not a multiple of 16. U and V channels will have padding on each row because they always have pitches which are a multiple of 8, glTexSubImage2D will copy the padding data to the texture and the U & V channels will be skewed. The same also applies to the Y channel when width is not a multiple of 8. Fixed by passing pitch to glTexSubImage2D instead of width. The U & V channels also have to be outlined in grey on the texture and if there's padding then we need to add the line on the right to every frame before calling glTexSubImage. It also looks like the location of the V channel in the texture was off by one pixel in the call to glProgramEnvParameter4fARB. --HG-- extra : rebase_source : 1984e493f77e80081e55b7c3b816d3baea965e4e --- src/video_out/video_out_opengl.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index 1904fe6af..648cd38c5 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -606,7 +606,7 @@ static int render_image_fp_yuv (opengl_driver_t *this, opengl_frame_t *frame) { return 0; } - ret = render_help_image_tex (this, frame->width+3, frame->height + h2 + 3, + ret = render_help_image_tex (this, w2 + frame->vo_frame.pitches[2] + 3, frame->height + h2 + 3, GL_LUMINANCE, GL_LUMINANCE); if (! ret) return 0; @@ -628,16 +628,21 @@ static int render_image_fp_yuv (opengl_driver_t *this, opengl_frame_t *frame) { this->glProgramEnvParameter4fARB (MYGL_FRAGMENT_PROGRAM_ARB, 0, 1.0 /this->tex_width, (float)(frame->height+2)/this->tex_height, - (float)(w2+1) /this->tex_width, + (float)(w2+2) /this->tex_width, 0); } + if (w2 & 7) + for (i = 0; i < h2; i++) { + frame->vo_frame.base[1][i*frame->vo_frame.pitches[1]+w2] = 128; + frame->vo_frame.base[2][i*frame->vo_frame.pitches[2]+w2] = 128; + } /* Load texture */ CHECKERR ("pre-texsubimage"); - glTexSubImage2D (GL_TEXTURE_2D, 0, 1, 0, frame->width, frame->height, + glTexSubImage2D (GL_TEXTURE_2D, 0, 1, 0, frame->vo_frame.pitches[0], frame->height, GL_LUMINANCE, GL_UNSIGNED_BYTE, frame->vo_frame.base[0]); - glTexSubImage2D (GL_TEXTURE_2D, 0, 1, frame->height+2, w2, h2, + glTexSubImage2D (GL_TEXTURE_2D, 0, 1, frame->height+2, frame->vo_frame.pitches[1], h2, GL_LUMINANCE, GL_UNSIGNED_BYTE, frame->vo_frame.base[1]); - glTexSubImage2D (GL_TEXTURE_2D, 0, w2+2, frame->height+2, w2, h2, + glTexSubImage2D (GL_TEXTURE_2D, 0, w2+2, frame->height+2, frame->vo_frame.pitches[2], h2, GL_LUMINANCE, GL_UNSIGNED_BYTE, frame->vo_frame.base[2]); CHECKERR ("texsubimage"); return 1; -- cgit v1.2.3 From 52e5b0620e7579faa998e53e3e3e00f0449d2387 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 21 Jan 2010 03:00:41 +0000 Subject: Undo libavutil workaround (fixed upstream). --- src/combined/ffmpeg/ff_video_decoder.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src') diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 876ac2217..727508847 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -51,22 +51,6 @@ # include #endif -/* As of 2010-01-17, libavutil trunk doesn't define a few useful macros. - * While we may still be able to #define things to cause them to be used, - * it's safest to assume that they'll go away. - */ -#ifndef PIX_FMT_RGB32 -# ifdef WORDS_BIGENDIAN -# define PIX_FMT_RGB32 PIX_FMT_ARGB -# define PIX_FMT_RGB555 PIX_FMT_RGB555BE -# define PIX_FMT_RGB565 PIX_FMT_RGB565BE -# else -# define PIX_FMT_RGB32 PIX_FMT_BGRA -# define PIX_FMT_RGB555 PIX_FMT_RGB555LE -# define PIX_FMT_RGB565 PIX_FMT_RGB565LE -# endif -#endif - #define VIDEOBUFSIZE (128*1024) #define SLICE_BUFFER_SIZE (1194*1024) -- cgit v1.2.3