Revision a686caf0

View differences:

ffmpeg.c
467 467
    static uint8_t *video_buffer;
468 468
    uint8_t *buf = NULL, *buf1 = NULL;
469 469
    AVCodecContext *enc, *dec;
470
    enum PixelFormat target_pixfmt;
470 471

  
471 472
#define VIDEO_BUFFER_SIZE (1024*1024)
472 473

  
......
534 535
        return;
535 536

  
536 537
    /* convert pixel format if needed */
537
    if (enc->pix_fmt != dec->pix_fmt) {
538
    target_pixfmt = ost->video_resample ? PIX_FMT_YUV420P : enc->pix_fmt;
539
    if (dec->pix_fmt != target_pixfmt) {
538 540
        int size;
539 541

  
540 542
        /* create temporary picture */
......
545 547
        formatted_picture = &picture_format_temp;
546 548
        avpicture_fill(formatted_picture, buf, enc->pix_fmt, dec->width, dec->height);
547 549
        
548
        if (img_convert(formatted_picture, enc->pix_fmt, 
550
        if (img_convert(formatted_picture, target_pixfmt, 
549 551
                        in_picture, dec->pix_fmt, 
550 552
                        dec->width, dec->height) < 0) {
551 553
            fprintf(stderr, "pixel format conversion not handled\n");
......
561 563
    if (ost->video_resample) {
562 564
        final_picture = &ost->pict_tmp;
563 565
        img_resample(ost->img_resample_ctx, final_picture, formatted_picture);
566
	if (enc->pix_fmt != PIX_FMT_YUV420P) {
567
            int size;
568
	    
569
	    av_free(buf);
570
            /* create temporary picture */
571
            size = avpicture_get_size(enc->pix_fmt, enc->width, enc->height);
572
            buf = av_malloc(size);
573
            if (!buf)
574
                return;
575
            final_picture = &picture_format_temp;
576
            avpicture_fill(final_picture, buf, enc->pix_fmt, enc->width, enc->height);
577
        
578
            if (img_convert(final_picture, enc->pix_fmt, 
579
                            &ost->pict_tmp, PIX_FMT_YUV420P, 
580
                            enc->width, enc->height) < 0) {
581
                fprintf(stderr, "pixel format conversion not handled\n");
582
                goto the_end;
583
            }
584
	}
564 585
    } else if (ost->video_crop) {
565 586
        picture_crop_temp.data[0] = formatted_picture->data[0] +
566 587
                (ost->topBand * formatted_picture->linesize[0]) + ost->leftBand;
libavformat/dv.c
660 660
    c->has_audio = c->has_video = 0;
661 661
    c->start_time = time(NULL);
662 662
    c->aspect = 0; /* 4:3 is the default */
663
    if (vst->codec.aspect_ratio == 16.0 / 9.0)
663
    if ((int)(vst->codec.aspect_ratio * 10) == 17) /* 16:9 */ 
664 664
        c->aspect = 0x07;
665 665

  
666 666
    if (fifo_init(&c->audio_data, 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0)

Also available in: Unified diff