diff options
author | deva <deva> | 2005-04-14 17:28:21 +0000 |
---|---|---|
committer | deva <deva> | 2005-04-14 17:28:21 +0000 |
commit | d5e1739f5288355869eccd53ab3eb1a4000d1cab (patch) | |
tree | 15f9f20fb8d5c92fbf0b2ef5e34f150ce660168f /src/player.cc | |
parent | f742dd679138b1e3428b72e8f934fee15ade9ecb (diff) |
Unified the frame types.
Diffstat (limited to 'src/player.cc')
-rw-r--r-- | src/player.cc | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/src/player.cc b/src/player.cc index dcce6b7..2a08dc1 100644 --- a/src/player.cc +++ b/src/player.cc @@ -25,10 +25,14 @@ #include "player.h" +// Use libdv +#include <libdv/dv.h> +#include <libdv/dv_types.h> + Player::Player(Error *err, volatile int *grunning, sem_t *gsem, - Queue<FFFrame> *gqueue, + Queue<Frame> *gqueue, pthread_mutex_t *gmutex) { // No errors has ocurred... yet! @@ -85,8 +89,11 @@ void Player::player() { SDL_Event event; SDL_Rect rect; - FFFrame *f; - AVPicture pict; + Frame *frame; + // AVPicture pict; + unsigned char pixel_buffer[720 * 576 * 3]; + int pitches[3]; + int i; struct timespec ts; @@ -97,13 +104,21 @@ void Player::player() rect.y = 0; rect.w = DISPLAYWIDTH; rect.h = DISPLAYHEIGHT; - + /* //+++++Reference to the overlay pixels/pitches, only after creating a new overlay+++++ + // ????????? for(i = 0; i < 3; i++) { pict.data[i] = overlay->pixels[i]; pict.linesize[i] = overlay->pitches[i]; } - + */ + + dv_decoder_t *decoder = NULL; + decoder = dv_decoder_new(FALSE, FALSE, FALSE); + decoder->quality = DV_QUALITY_BEST; + decoder->clamp_luma = FALSE; + decoder->clamp_chroma = FALSE; + while(*running) { // Wait for the semaphore to be free... then run sem_wait(&play_sem); @@ -124,18 +139,25 @@ void Player::player() case SDL_USEREVENT: pthread_mutex_lock(mutex); - f = queue->pop(); + frame = queue->pop(); pthread_mutex_unlock(mutex); - if(!f) break; + if(!frame) break; - img_convert(&pict, PIX_FMT_YUV420P, (AVPicture *)f->frame, - PIX_FMT_YUV420P, DISPLAYWIDTH, DISPLAYHEIGHT); + // img_convert(&pict, PIX_FMT_YUV420P, (AVPicture *)f->frame, + // PIX_FMT_YUV420P, DISPLAYWIDTH, DISPLAYHEIGHT); + // libdv img decode + dv_decode_full_frame(decoder, + (const uint8_t*)frame->data, + e_dv_color_yuv, + (uint8_t**)pixel_buffer, + pitches); + SDL_LockYUVOverlay(overlay); - overlay->pixels = pict.data; + overlay->pixels = (Uint8**)pixel_buffer; SDL_UnlockYUVOverlay(overlay); SDL_DisplayYUVOverlay(overlay, &rect); - delete f; + // delete f; break; case SDL_QUIT: @@ -154,9 +176,9 @@ void Player::player() nanosleep(&ts, NULL); pthread_mutex_lock(mutex); - f = queue->pop(); + frame = queue->pop(); pthread_mutex_unlock(mutex); - if(f) delete f; + // if(f) delete f; } void Player::run() |