From d5a7cc2511025abd9d092c65514c0b624a0505dd Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 25 Apr 2005 17:11:53 +0000 Subject: Fixed playback in player window (SDL now correctly initialized wioth correct YUV stadard) --- src/player.cc | 51 +++++++++++---------------------------------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/src/player.cc b/src/player.cc index 684e571..bb712f6 100644 --- a/src/player.cc +++ b/src/player.cc @@ -70,7 +70,8 @@ Player::Player(Error *err, overlay = SDL_CreateYUVOverlay(DISPLAYWIDTH, DISPLAYHEIGHT, - SDL_IYUV_OVERLAY, screen); + SDL_YUY2_OVERLAY, // Match for the libdv decoder output + screen); if(!overlay) { sprintf(errbuf, "Unable to create SDL overlay: %s.", SDL_GetError()); errobj->pushError(errbuf); @@ -91,7 +92,6 @@ void Player::player() SDL_Rect rect; Frame *frame; - unsigned char pixel_buffer[3][720 * 576]; unsigned char *pxs[3]; int pitches[3]; @@ -135,42 +135,19 @@ void Player::player() if(!frame) break; if(first) { - for(i = 0; i < 3; i++) { - pxs[i] = overlay->pixels[i]; - pitches[i] = overlay->pitches[i]; - } + pitches[0] = overlay->pitches[0]; + pitches[1] = overlay->pitches[1]; + pitches[2] = overlay->pitches[2]; - fprintf(stderr, "pitch[0]: %d - pitch[1]: %d - pitch[2]: %d\n", pitches[0], pitches[1], pitches[2]); fflush(stderr); + // fprintf(stderr, "pitch[0]: %d - pitch[1]: %d - pitch[2]: %d\n", pitches[0], pitches[1], pitches[2]); fflush(stderr); dv_parse_header(decoder, frame->data); - dv_parse_packs(decoder, frame->data); + //dv_parse_packs(decoder, frame->data); // Not needed anyway! - // dv_parse_header(decoder, NULL); - // dv_parse_packs(decoder, NULL); - // PAL/IEC 68134 - decoder->sampling = e_dv_sample_422; - - /* - decoder->system = e_dv_system_625_50; + decoder->system = e_dv_system_625_50; // PAL lines, PAL framerate + decoder->sampling = e_dv_sample_422; // 4 bytes y, 2 bytes u, 2 bytes v decoder->std = e_dv_std_iec_61834; - - decoder->height = DISPLAYHEIGHT; - decoder->width = DISPLAYWIDTH; - */ - // PAL/SMPTE 314M - // decoder->system = e_dv_system_625_50; - // decoder->std = e_dv_std_smpte_314m; - - // decoder->system = e_dv_system_none; - // decoder->std = e_dv_std_none; - - // Reference to the overlay pixels/pitches. - // pitches[0] = overlay->pitches[0] = decoder->width * 2; - // pxs[2] = pxs[1] = pxs[0] = overlay->pixels[0] = overlay->pixels[2] = overlay->pixels[1];// = (uint8_t*)pixel_buffer; - // pitches[1] = overlay->pitches[1] = 0;// = 0; - // pitches[2] = overlay->pitches[2] = 0;// = 0; - - // pitches[0] = overlay->pitches[0] = DISPLAYWIDTH; + decoder->num_dif_seqs = 12; first = false; } @@ -182,15 +159,9 @@ void Player::player() dv_decode_full_frame(decoder, frame->data, e_dv_color_yuv, - pxs, + overlay->pixels, pitches); - overlay->pitches[0] = pitches[0]; - overlay->pitches[1] = pitches[1]; - overlay->pitches[2] = pitches[2]; - - //overlay->pixels = pxs; - SDL_UnlockYUVOverlay(overlay); SDL_DisplayYUVOverlay(overlay, &rect); // delete frame; -- cgit v1.2.3