From 46b3c21f079a10e1ed072976d355a8026bcb7580 Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 8 Apr 2006 15:20:51 +0000 Subject: *** empty log message *** --- client/player.cc | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) (limited to 'client/player.cc') diff --git a/client/player.cc b/client/player.cc index fad7df4..1edf2cb 100644 --- a/client/player.cc +++ b/client/player.cc @@ -26,23 +26,35 @@ */ #include "player.h" -static unsigned char yuv[720*576*4]; +#define WIDTH 720 +#define HEIGHT 576 + +static unsigned char yuv_buf[WIDTH*HEIGHT*3]; static int num = 0; +static bool first = true; -Player::Player(VideoWidget *w) +Player::Player(VideoWidget *w, Decoder *d) { widget = w; + decoder = d; - render.init(widget, 720, 576);//widget->getWidth(), widget->getHeight() + render.init(widget, WIDTH, HEIGHT);//widget->getWidth(), widget->getHeight() connect(this, SIGNAL(timeout()), this, SLOT(show_frame())); + /* for(int x = 1; x < 720; x++) for(int y = 1; y < 576; y++) { yuv[x + y * 576 * 1] = x % 720 * 255; yuv[x + y * 576 * 2] = y % 576 * 255; yuv[x + y * 576 * 3] = (unsigned char)x % y; } + */ + + dvdecoder = dv_decoder_new(FALSE/*this value is unused*/, FALSE, FALSE); + dvdecoder->quality = DV_QUALITY_BEST; + + // reader.connect(); } Player::~Player() @@ -52,10 +64,45 @@ Player::~Player() void Player::show_frame() { + uint8_t *frame; fprintf(stderr, "Frame!%d\n", num++); + + frame = decoder->getFrame(); + + if(!frame) return; + if(first) { +#ifdef COLORSPACE_YV12 + yuv[0] = yuv_buf; + yuv[1] = (unsigned char*)yuv[0] + (WIDTH * HEIGHT); + yuv[2] = (unsigned char*)yuv[1] + (WIDTH * HEIGHT / 4); + pitches[0] = WIDTH; + pitches[1] = WIDTH / 2; + pitches[2] = WIDTH / 2; +#else + yuv[0] = yuv_buf; + pitches[0] = WIDTH * 2; +#endif + + dv_parse_header(dvdecoder, frame); + //dv_parse_packs(decoder, frame->data); // Not needed anyway! + + dvdecoder->system = e_dv_system_625_50; // PAL lines, PAL framerate + dvdecoder->sampling = e_dv_sample_422; // 4 bytes y, 2 bytes u, 2 bytes v + dvdecoder->std = e_dv_std_iec_61834; + dvdecoder->num_dif_seqs = 12; + first = false; + } + + dv_decode_full_frame(dvdecoder, + frame, + e_dv_color_yuv, + yuv, + pitches); + render.width = widget->getWidth(); render.height = widget->getHeight(); - render.display(yuv, 720, 576);//widget->width(), widget->height()); + render.display(yuv_buf, WIDTH, HEIGHT);//widget->width(), widget->height()); + } -- cgit v1.2.3