summaryrefslogtreecommitdiff
path: root/lib/libdv_wrapper.cc
diff options
context:
space:
mode:
authordeva <deva>2006-06-15 17:35:33 +0000
committerdeva <deva>2006-06-15 17:35:33 +0000
commit897867cc9d3bc869317666993a9cc6ef38c163e2 (patch)
tree49127ab698c52d0a7a2c7749081f15784cddf4bc /lib/libdv_wrapper.cc
parentd8404ce282917ef81418387f20fc5ee3607be391 (diff)
Prepared for the client to use uncompressed frames (YUV422 instead of DV).
Still a lot of work to do though!
Diffstat (limited to 'lib/libdv_wrapper.cc')
-rw-r--r--lib/libdv_wrapper.cc68
1 files changed, 48 insertions, 20 deletions
diff --git a/lib/libdv_wrapper.cc b/lib/libdv_wrapper.cc
index df624b6..cb9cc7c 100644
--- a/lib/libdv_wrapper.cc
+++ b/lib/libdv_wrapper.cc
@@ -40,6 +40,7 @@ LibDVWrapper::LibDVWrapper(DV::Quality quality,
setSampling(sampling);
yuv[0] = yuv[1] = yuv[2] = NULL;
+ pitches[0] = pitches[1] = pitches[2] = 0;
width = 720;
height = 576;
@@ -73,56 +74,83 @@ void LibDVWrapper::setSampling(DV::Sampling sampling)
decoder->sampling = (dv_sample_t)sampling;
}
-void LibDVWrapper::setOutputBuffer(char *output, DV::ColorSpace c)
+Frame *LibDVWrapper::decode(Frame *input, DV::ColorSpace c)
{
- colorspace = c;
+ if(input->vformat != VF_DV) {
+ fprintf(stderr, "Wrong format in LibDVWrapper, expected VF_DV, got: %i\n", input->vformat);
+ return NULL;
+ }
+
+ /*
+ if(first) {
+ dv_parse_header(decoder, (const uint8_t*)input);
+ //dv_parse_packs(decoder, frame->data); // Not needed anyway!
+ decoder->std = e_dv_std_iec_61834;
+ decoder->num_dif_seqs = 12;
+ first = false;
+ }
+ */
+
+
+ int size = 0;
+ char* buf = NULL;
+ int type = VF_NONE;
+ DV::ColorSpace colorspace = c;
switch(colorspace) {
case DV::YUV:
#ifdef COLORSPACE_YV12
- yuv[0] = (unsigned char*)output;
+ size = width*height*2;
+ buf = (char*)malloc(size);
+ type = VF_YV12;
+ yuv[0] = (unsigned char*)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] = (unsigned char*)output;
+ printf("!\n");
+ size = width*height*2;
+ buf = (char*)malloc(size);
+ type = VF_YUV422;
+ yuv[0] = (unsigned char*)buf;
+ yuv[1] = yuv[2] = NULL;
pitches[0] = width * 2;
+ pitches[1] = pitches[2] = 0;
#endif
break;
case DV::RGB:
- yuv[0] = (unsigned char*)output;
+ size = width*height*3;
+ buf = (char*)malloc(size);
+ type = VF_RGB;
+ yuv[0] = (unsigned char*)buf;
yuv[1] = yuv[2] = NULL;
pitches[0] = width * 3;
+ pitches[1] = pitches[2] = 0;
break;
case DV::BGR0:
- yuv[0] = (unsigned char*)output;
+ size = width*height*4;
+ buf = (char*)malloc(size);
+ type = VF_BRG0;
+ yuv[0] = (unsigned char*)buf;
yuv[1] = yuv[2] = NULL;
pitches[0] = width * 4;
+ pitches[1] = pitches[2] = 0;
break;
}
-}
-
-void LibDVWrapper::decode(char *input)
-{
- if(!yuv[0]) return; // outputbuffer not set!
- /*
- if(first) {
- dv_parse_header(decoder, (const uint8_t*)input);
- //dv_parse_packs(decoder, frame->data); // Not needed anyway!
- decoder->std = e_dv_std_iec_61834;
- decoder->num_dif_seqs = 12;
- first = false;
- }
- */
dv_decode_full_frame(decoder,
(const uint8_t*)input,
(dv_color_space_t)colorspace,
yuv,
pitches);
+ // memset(buf, 1, width*height);
+ // memset(buf+width*height, 100, width*height/2);
+ // memset(buf+width*height+width*height/2, 200, width*height/2);
+ Frame *frame = new Frame(buf, size, type, NULL, 0, AF_NONE);
+ return frame;
}