Example #1
0
static int
startTransfer (t_pdp_ieee1394 *x)
{
  //if ((x->dvfd=openDevice(format))<0){
  //  verbose(1, "DV4L: closed");
  //  return(0);
  //}
  //x->x_image.newimage=0;
  //x->x_image.image.data=0;
  //x->x_image.image.xsize=720;
  //x->x_image.image.ysize=576;
  //x->x_image.image.setCsizeByFormat(x->x_reqFormat);
  //x->x_image.image.reallocate();
  x->videobuf=NULL;

  x->x_frame_ready = false; 

  if(x->x_decoder!=NULL)dv_decoder_free(x->x_decoder);
  if (!(x->x_decoder=dv_decoder_new(1, 1, 1))){
    //error("DV4L: unable to create DV-decoder...closing");
    close_device(x);
    return(0);
  }
  //x->x_decoder->quality=x->x_quality;
  x->x_decoder->quality = DV_QUALITY_BEST;
  verbose(1, "DV4L: DV decoding quality %d ", x->x_decoder->quality);
  //fprintf(stderr,"before");
  x->x_continue_thread = true;
  pthread_create(&x->x_thread_id, 0, pdp_ieee1394_thread, x);
  return 1;
}
static int rawdv_check_file(demuxer_t *demuxer)
{
   unsigned char tmp_buffer[DV_PAL_FRAME_SIZE];
   int bytes_read=0;
   int result=0;
   dv_decoder_t *td;

   mp_msg(MSGT_DEMUX,MSGL_V,"Checking for DV\n");

   bytes_read=stream_read(demuxer->stream,tmp_buffer,DV_PAL_FRAME_SIZE);
   if ((bytes_read!=DV_PAL_FRAME_SIZE) && (bytes_read!=DV_NTSC_FRAME_SIZE))
      return 0;

   td=dv_decoder_new(TRUE,TRUE,FALSE);
   if (!td)
      return 0;

   td->quality=DV_QUALITY_BEST;
   result=dv_parse_header(td, tmp_buffer);
   if (result<0)
      return 0;

   if ((( td->num_dif_seqs==10) || (td->num_dif_seqs==12))
       && (td->width==720)
       && ((td->height==576) || (td->height==480)))
      result=1;
   dv_decoder_free(td);
   if (result)
      return DEMUXER_TYPE_RAWDV;
   else
      return 0;
}
Example #3
0
dv_decoder_t* init_global_rawdv_decoder(void)
{
 if(!global_rawdv_decoder){
   global_rawdv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
   global_rawdv_decoder->quality=DV_QUALITY_BEST;
   global_rawdv_decoder->prev_frame_decoded = 0;
 }
 return global_rawdv_decoder;
}
Example #4
0
dv_decoder_t *dv_decoder_alloc( )
{
	// We'll return a dv_decoder
	dv_decoder_t *this = NULL;

	// Lock the mutex
	pthread_mutex_lock( &decoder_lock );

	// Create the properties if necessary
	if ( dv_decoders == NULL )
	{
		// Create the properties
		dv_decoders = mlt_properties_new( );

		// Create the stack
		mlt_properties_set_data( dv_decoders, "stack", mlt_deque_init( ), 0, ( mlt_destructor )mlt_deque_close, NULL );

		// Register the properties for clean up
		mlt_factory_register_for_clean_up( dv_decoders, ( mlt_destructor )mlt_properties_close );
	}

	// Now try to obtain a decoder
	if ( dv_decoders != NULL )
	{
		// Obtain the stack
		mlt_deque stack = mlt_properties_get_data( dv_decoders, "stack", NULL );

		// Pop the top of the stack
		this = mlt_deque_pop_back( stack );

		// Create a new decoder if none available
		if ( this == NULL )
		{
			// We'll need a unique property ID for this
			char label[ 256 ];

			// Configure the decoder
			this = dv_decoder_new( FALSE, FALSE, FALSE );
			this->quality = DV_QUALITY_COLOR | DV_QUALITY_AC_2;
			this->audio->arg_audio_emphasis = 2;
			dv_set_audio_correction( this, DV_AUDIO_CORRECT_AVERAGE );
			dv_set_error_log( this, NULL );

			// Register it with the properties to ensure clean up
			sprintf( label, "%p", this );
			mlt_properties_set_data( dv_decoders, label, this, 0, ( mlt_destructor )dv_decoder_free, NULL );
		}
	}

	// Unlock the mutex
	pthread_mutex_unlock( &decoder_lock );

	return this;
}
Example #5
0
static GstStateChangeReturn
gst_dvdec_change_state (GstElement * element, GstStateChange transition)
{
  GstDVDec *dvdec = GST_DVDEC (element);
  GstStateChangeReturn ret;


  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      break;
    case GST_STATE_CHANGE_READY_TO_PAUSED:
      dvdec->decoder =
          dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
      dvdec->decoder->quality = qualities[dvdec->quality];
      dv_set_error_log (dvdec->decoder, NULL);
      gst_video_info_init (&dvdec->vinfo);
      gst_segment_init (&dvdec->segment, GST_FORMAT_UNDEFINED);
      dvdec->src_negotiated = FALSE;
      dvdec->sink_negotiated = FALSE;
      dvdec->need_segment = FALSE;
      /* 
       * Enable this function call when libdv2 0.100 or higher is more
       * common
       */
      /* dv_set_quality (dvdec->decoder, qualities [dvdec->quality]); */
      break;
    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);

  switch (transition) {
    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
      break;
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      dv_decoder_free (dvdec->decoder);
      dvdec->decoder = NULL;
      if (dvdec->pool) {
        gst_buffer_pool_set_active (dvdec->pool, FALSE);
        gst_object_unref (dvdec->pool);
        dvdec->pool = NULL;
      }
      break;
    case GST_STATE_CHANGE_READY_TO_NULL:
      break;
    default:
      break;
  }
  return ret;
}
int lp_libdv_in::init(int audio_buffer_len, int nb_audio_channels)
{
	int i;

	pv_decoder = dv_decoder_new(TRUE, FALSE, FALSE);
	if(pv_decoder == 0){
		std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": cannot initialise the dv decoder\n";
		return -1;
	}

	// we init buffers here - make this else later ?? -> Ok for file buffer

	// File buffer - is the size OK ?
	pv_file_buf_size = 150000;
	pv_file_buffer = (uint8_t*)malloc(pv_file_buf_size * sizeof(uint8_t));
	if(pv_file_buffer == 0){
		std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": cannot allocate memory for file buffer\n";
		return -1;
	}

	// Audio
	for(i=0; i<4; i++){
		pv_dv_audio_buffers[i] = (int16_t*)malloc(DV_AUDIO_MAX_SAMPLES * sizeof(int16_t));
		if(pv_dv_audio_buffers[i] == 0){
			std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": cannot allocate memory for dv audio buffers\n";
			return -1;
		}
	}
	// Alloc audio ready data buffer for 2 total data length (for storage)
	pv_audio_ready_buffer = new int16_t[audio_buffer_len * 4 * 2];
	if(pv_audio_ready_buffer == 0){
			std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": cannot allocate memory for pv_audio_ready_buffer\n";
			return -1;
	}
	pv_audio_channels = nb_audio_channels;

	pv_lp_audio_buffer.init(audio_buffer_len * 4 * 4);

	// Debug - infos
	if(dv_format_wide(pv_decoder)){
		std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": Format video 16/9\n";
	}
	if(dv_format_normal(pv_decoder)){
		std::cerr << "lp_libdv_in::" << __FUNCTION__ << ": Format video 4/3\n";
	}

	return 0;
}
Example #7
0
dv_t* dv_new()
{
	dv_t *dv = calloc(1, sizeof(dv_t));
	if(!dv_initted)
	{
		pthread_mutexattr_t attr;
		dv_initted = 1;
//		dv_init();
		pthread_mutexattr_init(&attr);
		pthread_mutex_init(&dv_lock, &attr);
	}

	dv->decoder = dv_decoder_new(0, 0, 0);
	dv_set_error_log (dv->decoder, 0);
	dv->decoder->quality = DV_QUALITY_BEST;
	dv->decoder->prev_frame_decoded = 0;
	dv->use_mmx = 1;
	return dv;
}
static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
{
   unsigned char dv_frame[DV_PAL_FRAME_SIZE];
   sh_video_t *sh_video = NULL;
   rawdv_frames_t *frames = malloc(sizeof(rawdv_frames_t));
   dv_decoder_t *dv_decoder=NULL;

   mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() end_pos %"PRId64"\n",(int64_t)demuxer->stream->end_pos);

   // go back to the beginning
   stream_reset(demuxer->stream);
   stream_seek(demuxer->stream, 0);

   //get the first frame
   stream_read(demuxer->stream, dv_frame, DV_PAL_FRAME_SIZE);

   //read params from this frame
   dv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
   dv_decoder->quality=DV_QUALITY_BEST;

   if (dv_parse_header(dv_decoder, dv_frame) == -1)
	   return NULL;

   // create a new video stream header
   sh_video = new_sh_video(demuxer, 0);
   if (!sh_video)
	   return NULL;

   // make sure the demuxer knows about the new video stream header
   // (even though new_sh_video() ought to take care of it)
   demuxer->seekable = 1;
   demuxer->video->sh = sh_video;

   // make sure that the video demuxer stream header knows about its
   // parent video demuxer stream (this is getting wacky), or else
   // video_read_properties() will choke
   sh_video->ds = demuxer->video;

   // custom fourcc for internal MPlayer use
//   sh_video->format = mmioFOURCC('R', 'A', 'D', 'V');
   sh_video->format = mmioFOURCC('D', 'V', 'S', 'D');

   sh_video->disp_w = dv_decoder->width;
   sh_video->disp_h = dv_decoder->height;
   mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() frame_size: %d w: %d h: %d dif_seq: %d system: %d\n",dv_decoder->frame_size,dv_decoder->width, dv_decoder->height,dv_decoder->num_dif_seqs,dv_decoder->system);

   sh_video->fps= (dv_decoder->system==e_dv_system_525_60?29.97:25);
   sh_video->frametime = 1.0/sh_video->fps;

  // emulate BITMAPINFOHEADER for win32 decoders:
  sh_video->bih=malloc(sizeof(BITMAPINFOHEADER));
  memset(sh_video->bih,0,sizeof(BITMAPINFOHEADER));
  sh_video->bih->biSize=40;
  sh_video->bih->biWidth = dv_decoder->width;
  sh_video->bih->biHeight = dv_decoder->height;
  sh_video->bih->biPlanes=1;
  sh_video->bih->biBitCount=24;
  sh_video->bih->biCompression=sh_video->format; // "DVSD"
  sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*3;


   frames->current_filepos=0;
   frames->current_frame=0;
   frames->frame_size=dv_decoder->frame_size;
   frames->frame_number=demuxer->stream->end_pos/frames->frame_size;

   mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() seek to %qu, size: %d, dv_dec->frame_size: %d\n",frames->current_filepos,frames->frame_size, dv_decoder->frame_size);
    if (dv_decoder->audio != NULL && demuxer->audio->id>=-1){
       sh_audio_t *sh_audio =  new_sh_audio(demuxer, 0);
	    demuxer->audio->sh = sh_audio;
	    sh_audio->ds = demuxer->audio;
       mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() chan: %d samplerate: %d\n",dv_decoder->audio->num_channels,dv_decoder->audio->frequency );
       // custom fourcc for internal MPlayer use
       sh_audio->format = mmioFOURCC('R', 'A', 'D', 'V');

	sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
	memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX));
	sh_audio->wf->wFormatTag = sh_audio->format;
	sh_audio->wf->nChannels = dv_decoder->audio->num_channels;
	sh_audio->wf->wBitsPerSample = 16;
	sh_audio->wf->nSamplesPerSec = dv_decoder->audio->frequency;
	// info about the input stream:
	sh_audio->wf->nAvgBytesPerSec = sh_video->fps*dv_decoder->frame_size;
	sh_audio->wf->nBlockAlign = dv_decoder->frame_size;

//       sh_audio->context=(void*)dv_decoder;
    }
   stream_reset(demuxer->stream);
   stream_seek(demuxer->stream, 0);
   dv_decoder_free(dv_decoder);  //we keep this in the context of both stream headers
   demuxer->priv=frames;
   return demuxer;
}
Example #9
0
int main( int argc, char **argv)
{
    int infile = 0;
    unsigned char dv_buffer[144000];
    unsigned char video_buffer[720 * 576 * 3];
    int16_t *audio_bufs[4];
    dv_decoder_t *decoder = NULL;
    dv_encoder_t *encoder = NULL;
    int pitches[3];
    unsigned char *pixels[3];
    int i = 0, j;
    int isPAL = FALSE;

    pitches[0] = 720 * 2;
    pixels[0] = video_buffer;

    for(i = 0; i < 4; i++) {
        audio_bufs[i] = malloc(DV_AUDIO_MAX_SAMPLES*sizeof(int16_t));
    }

    /* assume NTSC for now, switch to PAL later if needed */
    decoder = dv_decoder_new(FALSE, FALSE, FALSE);
    encoder = dv_encoder_new(FALSE, FALSE, FALSE);

    decoder->quality = DV_QUALITY_BEST;
    encoder->vlc_encode_passes = 3;
    encoder->static_qno = 0;
    encoder->force_dct = DV_DCT_AUTO;

    i = 0;
    while (read_frame(stdin, dv_buffer, &isPAL)) {
        dv_parse_header(decoder, dv_buffer);
        if (isPAL != encoder->isPAL && isPAL == TRUE) {
            decoder->clamp_luma = FALSE;
            decoder->clamp_chroma = FALSE;
            encoder->clamp_luma = FALSE;
            encoder->clamp_chroma = FALSE;
            dv_reconfigure(FALSE, FALSE);
        } else if (isPAL != encoder->isPAL) {
            decoder->clamp_luma = TRUE;
            decoder->clamp_chroma = TRUE;
            decoder->add_ntsc_setup = TRUE;
            encoder->clamp_luma = TRUE;
            encoder->clamp_chroma = TRUE;
            encoder->rem_ntsc_setup = TRUE;
            dv_reconfigure(TRUE, TRUE);
        }
        encoder->isPAL = isPAL;
        encoder->is16x9 = (dv_format_wide(decoder)>0);
        dv_decode_full_audio(decoder, dv_buffer, audio_bufs);
        for (j = 0; j < TIMES; j++) {
            dv_decode_full_frame(decoder, dv_buffer, e_dv_color_yuv,
                                 pixels, pitches);

            dv_encode_full_frame(encoder, pixels, e_dv_color_yuv, dv_buffer);
        }
        dv_encode_full_audio(encoder, audio_bufs, 2, 48000, dv_buffer);
        fwrite(dv_buffer, 1, (isPAL ? 144000 : 120000), stdout);
    }

    close(infile);

    for(i=0; i < 4; i++) free(audio_bufs[i]);
    dv_decoder_free(decoder);
    dv_encoder_free(encoder);

    return 0;
}
Example #10
0
static int decode(quicktime_t *file, unsigned char **row_pointers, int track)
{
    long bytes;
    quicktime_video_map_t *vtrack = &(file->vtracks[track]);
    quicktime_dv_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv;
    int width = vtrack->track->tkhd.track_width;
    int height = vtrack->track->tkhd.track_height;
    int result = 0;
    int i;
    int decode_colormodel = 0;
    int pitches[3] = { 720 * 2, 0, 0 };


    quicktime_set_video_position(file, vtrack->current_position, track);
    bytes = quicktime_frame_size(file, vtrack->current_position, track);
    result = !quicktime_read_data(file, (char*)codec->data, bytes);

    if( codec->dv_decoder && codec->parameters_changed )
    {
        dv_decoder_free( codec->dv_decoder );
        codec->dv_decoder = NULL;
        codec->parameters_changed = 0;
    }

    if( ! codec->dv_decoder )
    {
        pthread_mutex_lock( &libdv_init_mutex );


        codec->dv_decoder = dv_decoder_new( codec->add_ntsc_setup,
                                            codec->clamp_luma,
                                            codec->clamp_chroma );
        codec->dv_decoder->prev_frame_decoded = 0;

        codec->parameters_changed = 0;
        pthread_mutex_unlock( &libdv_init_mutex );
    }

    if(codec->dv_decoder)
    {
        int is_sequential =
            check_sequentiality( row_pointers,
                                 720 * cmodel_calculate_pixelsize(file->color_model),
                                 file->out_h );

        codec->dv_decoder->quality = codec->decode_quality;

        dv_parse_header( codec->dv_decoder, codec->data );

// Libdv improperly decodes RGB colormodels.
        if((file->color_model == BC_YUV422 ||
                file->color_model == BC_RGB888) &&
                file->in_x == 0 &&
                file->in_y == 0 &&
                file->in_w == width &&
                file->in_h == height &&
                file->out_w == width &&
                file->out_h == height &&
                is_sequential)
        {
            if( file->color_model == BC_YUV422 )
            {
                pitches[0] = 720 * 2;
                dv_decode_full_frame( codec->dv_decoder, codec->data,
                                      e_dv_color_yuv, row_pointers,
                                      pitches );
            }
            else if( file->color_model == BC_RGB888)
            {
                pitches[0] = 720 * 3;
                dv_decode_full_frame( codec->dv_decoder, codec->data,
                                      e_dv_color_rgb, row_pointers,
                                      pitches );
            }
        }
        else
        {
            if(!codec->temp_frame)
            {
                codec->temp_frame = malloc(720 * 576 * 2);
                codec->temp_rows = malloc(sizeof(unsigned char*) * 576);
                for(i = 0; i < 576; i++)
                    codec->temp_rows[i] = codec->temp_frame + 720 * 2 * i;
            }

            decode_colormodel = BC_YUV422;
            pitches[0] = 720 * 2;
            dv_decode_full_frame( codec->dv_decoder, codec->data,
                                  e_dv_color_yuv, codec->temp_rows,
                                  pitches );




            cmodel_transfer(row_pointers,
                            codec->temp_rows,
                            row_pointers[0],
                            row_pointers[1],
                            row_pointers[2],
                            codec->temp_rows[0],
                            codec->temp_rows[1],
                            codec->temp_rows[2],
                            file->in_x,
                            file->in_y,
                            file->in_w,
                            file->in_h,
                            0,
                            0,
                            file->out_w,
                            file->out_h,
                            decode_colormodel,
                            file->color_model,
                            0,
                            width,
                            file->out_w);
        }
    }

//printf(__FUNCTION__ " 2\n");
    return result;
}
Example #11
0
dv_t	*rawdv_open_input_file(const char *filename, int mmap_size)
{
	dv_t *dv = (dv_t*) vj_malloc(sizeof(dv_t));
	if(!dv) return NULL;
	memset(dv, 0, sizeof(dv_t));
	dv_decoder_t *decoder = NULL;

	uint8_t *tmp = (uint8_t*) vj_malloc(sizeof(uint8_t) * DV_HEADER_SIZE);
	memset( tmp, 0, sizeof(uint8_t) * DV_HEADER_SIZE);
	off_t file_size = 0;
	int n = 0;

	decoder = dv_decoder_new( 1,0,0);
	dv->fd = open( filename, O_RDONLY );
	
	if(!dv->fd)
	{
		dv_decoder_free(decoder); 
		rawdv_free(dv);
		veejay_msg(VEEJAY_MSG_ERROR, "Unable to open file '%s'",filename);
		if(tmp)free(tmp);
		return NULL;
	}
	/* fseek sometimes lies about filesize - seek to end (lseek returns file offset from start)*/
	file_size = lseek( dv->fd, 0, SEEK_END );
	if( file_size < DV_HEADER_SIZE)
	{
		dv_decoder_free(decoder);
		veejay_msg(VEEJAY_MSG_ERROR, "File %s is not a DV file", filename);
		rawdv_free(dv);
		if(tmp) free(tmp);
		return NULL;
	}
	/* And back to start offset */
	if( lseek(dv->fd,0, SEEK_SET ) < 0)
	{
		dv_decoder_free(decoder);
		veejay_msg(VEEJAY_MSG_ERROR, "Seek error in %s", filename);
		rawdv_free(dv);
		if(tmp) free(tmp);
		return NULL;
	}

	dv->mmap_region = NULL;
	if( mmap_size > 0 ) // user wants mmap
	{
		dv->mmap_region = mmap_file( dv->fd, 0, (mmap_size * 720 * 576 * 3),
			file_size );
	}

	if( dv->mmap_region == NULL )
	{
		if(mmap_size>0)
			veejay_msg(VEEJAY_MSG_DEBUG, "Mmap of DV file failed - fallback to read");
		n = read( dv->fd, tmp, DV_HEADER_SIZE );
	}
	else
	{
		n = mmap_read( dv->mmap_region, 0, DV_HEADER_SIZE, tmp );
	}

	if( n <= 0 )
	{
		dv_decoder_free(decoder);
		rawdv_free(dv);
		if(tmp) free(tmp);
		veejay_msg(VEEJAY_MSG_ERROR, "Cannot read from '%s'", filename);
		return NULL;
	}

	if( dv_parse_header( decoder, tmp) < 0 )
	{
		dv_decoder_free( decoder );
		rawdv_free(dv);
		if(tmp) free(tmp);
		veejay_msg(VEEJAY_MSG_ERROR, "Cannot parse header of file %s", filename);
		return NULL;
	}
/*	if(decoder->sampling == e_dv_sample_411)
	{
		dv_decoder_free( decoder );
		rawdv_free(dv);
		if(tmp) free(tmp);
		return NULL;
	}*/


	if(dv_is_PAL( decoder ) )
		dv->chunk_size = DV_PAL_SIZE;
	else
		dv->chunk_size = DV_NTSC_SIZE;

	dv->width = decoder->width;
	dv->height = decoder->height;
	dv->audio_rate = decoder->audio->frequency;
	dv->audio_chans = decoder->audio->num_channels;
	dv->audio_qbytes = decoder->audio->quantization;
	dv->fps = ( dv_is_PAL( decoder) ? 25.0 : 29.97 );
	dv->size = decoder->frame_size;
	dv->num_frames = (file_size - DV_HEADER_SIZE) / dv->size;
	dv->fmt = decoder->sampling;	
//	dv->fmt = ( decoder->sampling == e_dv_sample_422 ? 1 : 0);
	dv->buf = (uint8_t*) vj_malloc(sizeof(uint8_t*) * dv->size);
	dv->offset = 0;

	veejay_msg(VEEJAY_MSG_DEBUG,
			"DV properties %d x %d, %f, %d frames, %d sampling",
			dv->width,dv->height, dv->fps, dv->num_frames,
			dv->fmt );
	
	dv_decoder_free( decoder );

	if(tmp)
		free(tmp);

/*	if(dv->audio_rate)
	{
		int i;
		for( i = 0; i < 4; i ++ )
		dv->audio_buffers[i] = (int16_t*) vj_malloc(sizeof(int16_t) * 2 * DV_AUDIO_MAX_SAMPLES);
	}*/

/*
	veejay_msg(VEEJAY_MSG_DEBUG,
		"rawDV: num frames %ld, dimensions %d x %d, at %2.2f in %s",
		dv->num_frames,
		dv->width,
		dv->height,
		dv->fps,
		(dv->fmt==1?"422":"420"));
	veejay_msg(VEEJAY_MSG_DEBUG,
		"rawDV: frame size %d, rate %d, channels %d, bits %d",
		dv->size,
		dv->audio_rate,
		dv->audio_chans,
		dv->audio_qbytes);*/

	return dv;
}
Example #12
0
DVFrame::DVFrame()
{
//#ifdef HAVE_LIBDV

	decoder = dv_decoder_new( 0, 0, 0 );
	decoder->quality = DV_QUALITY_COLOR | DV_QUALITY_AC_1;
	decoder->audio->arg_audio_emphasis = 2;
	dv_set_audio_correction ( decoder, DV_AUDIO_CORRECT_AVERAGE );
	FILE* libdv_log = fopen( "/dev/null", "w" );
	dv_set_error_log( decoder, libdv_log );
//#else

	//if ( maps_initialized == false )
	//{

		//for ( int n = 0; n < 1944; ++n )
		//{
			//int sequence1 = ( ( n / 3 ) + 2 * ( n % 3 ) ) % 6;
			//int sequence2 = sequence1 + 6;
			//int block = 3 * ( n % 3 ) + ( ( n % 54 ) / 18 );

			//block = 6 + block * 16;
			//{
				//register int byte = 8 + 2 * ( n / 54 );
				//palmap_ch1[ n ] = sequence1 * 150 * 80 + block * 80 + byte;
				//palmap_ch2[ n ] = sequence2 * 150 * 80 + block * 80 + byte;
				//byte += ( n / 54 );
				//palmap_2ch1[ n ] = sequence1 * 150 * 80 + block * 80 + byte;
				//palmap_2ch2[ n ] = sequence2 * 150 * 80 + block * 80 + byte;
			//}
		//}
		//for ( int n = 0; n < 1620; ++n )
		//{
			//int sequence1 = ( ( n / 3 ) + 2 * ( n % 3 ) ) % 5;
			//int sequence2 = sequence1 + 5;
			//int block = 3 * ( n % 3 ) + ( ( n % 45 ) / 15 );

			//block = 6 + block * 16;
			//{
				//register int byte = 8 + 2 * ( n / 45 );
				//ntscmap_ch1[ n ] = sequence1 * 150 * 80 + block * 80 + byte;
				//ntscmap_ch2[ n ] = sequence2 * 150 * 80 + block * 80 + byte;
				//byte += ( n / 45 );
				//ntscmap_2ch1[ n ] = sequence1 * 150 * 80 + block * 80 + byte;
				//ntscmap_2ch2[ n ] = sequence2 * 150 * 80 + block * 80 + byte;
			//}
		//}
		//for ( int y = 0x700; y <= 0x7ff; ++y )
			//compmap[ y ] = ( y - 0x600 ) << 6;
		//for ( int y = 0x600; y <= 0x6ff; ++y )
			//compmap[ y ] = ( y - 0x500 ) << 5;
		//for ( int y = 0x500; y <= 0x5ff; ++y )
			//compmap[ y ] = ( y - 0x400 ) << 4;
		//for ( int y = 0x400; y <= 0x4ff; ++y )
			//compmap[ y ] = ( y - 0x300 ) << 3;
		//for ( int y = 0x300; y <= 0x3ff; ++y )
			//compmap[ y ] = ( y - 0x200 ) << 2;
		//for ( int y = 0x200; y <= 0x2ff; ++y )
			//compmap[ y ] = ( y - 0x100 ) << 1;
		//for ( int y = 0x000; y <= 0x1ff; ++y )
			//compmap[ y ] = y;
		//for ( int y = 0x800; y <= 0xfff; ++y )
			//compmap[ y ] = -1 - compmap[ 0xfff - y ];
		//maps_initialized = true;
	//}
//#endif
	for ( int n = 0; n < 4; n++ )
		audio_buffers[ n ] = ( int16_t * ) malloc( 2 * DV_AUDIO_MAX_SAMPLES * sizeof( int16_t ) );
}
Example #13
0
void lav_init_dv_decoder()
{
   decoder = dv_decoder_new(0,0,0);
   decoder->quality = DV_QUALITY_BEST;
}