summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/player.cc76
1 files changed, 56 insertions, 20 deletions
diff --git a/src/player.cc b/src/player.cc
index fe02b01..684e571 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -91,7 +91,7 @@ void Player::player()
SDL_Rect rect;
Frame *frame;
- // unsigned char pixel_buffer[720 * 576 * 3];
+ unsigned char pixel_buffer[3][720 * 576];
unsigned char *pxs[3];
int pitches[3];
@@ -106,21 +106,9 @@ void Player::player()
rect.w = DISPLAYWIDTH;
rect.h = DISPLAYHEIGHT;
- // Reference to the overlay pixels/pitches.
- for(i = 0; i < 3; i++) {
- pxs[i] = overlay->pixels[i];
- pitches[i] = overlay->pitches[i];
- }
-
- dv_decoder_t *decoder = dv_decoder_new(0/*this value is unused*/, FALSE, FALSE);
- decoder->quality = DV_QUALITY_BEST;
- // PAL/IEC 68134
- decoder->system = e_dv_system_625_50;
- decoder->std = e_dv_std_iec_61834;
-
- // PAL/SMPTE 314M
- // decoder->system = e_dv_system_625_50;
- // decoder->std = e_dv_std_smpte_314m;
+ bool first = true;
+ dv_decoder_t *decoder = dv_decoder_new(FALSE/*this value is unused*/, FALSE, FALSE);
+ decoder->quality = DV_QUALITY_BEST;
while(*running) {
// Wait for the semaphore to be free... then run
@@ -146,17 +134,63 @@ void Player::player()
pthread_mutex_unlock(mutex);
if(!frame) break;
+ if(first) {
+ for(i = 0; i < 3; i++) {
+ pxs[i] = overlay->pixels[i];
+ pitches[i] = overlay->pitches[i];
+ }
+
+ 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_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->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;
+ first = false;
+ }
+
fprintf(stderr, "[%d]", dv_is_PAL(decoder)); fflush(stderr);
- // libdv img decode
+ SDL_LockYUVOverlay(overlay);
+
+ // libdv img decode to yuv
dv_decode_full_frame(decoder,
frame->data,
e_dv_color_yuv,
- pxs,
+ pxs,
pitches);
- SDL_LockYUVOverlay(overlay);
- overlay->pixels = pxs;
+ 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;
@@ -171,6 +205,8 @@ void Player::player()
break;
}
}
+ if(decoder) dv_decoder_free(decoder);
+
/* Remove any late buffer */
/* We don't care, the encoder finishes them all */
ts.tv_sec = 0;