Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 179885 | Differences between
and this patch

Collapse All | Expand All

(-)video-1.0.1/src/AVHandler.cc (-11 / +22 lines)
Lines 26-31 Link Here
26
26
27
#include <string>
27
#include <string>
28
28
29
extern "C" {
30
#if defined (HAVE_FFMPEG_AVFORMAT_H)
31
#include <ffmpeg/swscale.h>
32
#elif defined(HAVE_LIBAVFORMAT_AVFORMAT_H)
33
#include <libswscale/swscale.h>
34
#else
35
#error "Missing ffmpeg headers"
36
#endif
37
}
38
29
#ifdef _MSC_VER
39
#ifdef _MSC_VER
30
#define snprintf _snprintf
40
#define snprintf _snprintf
31
#endif
41
#endif
Lines 224-237 Link Here
224
    lock_parameters = true;
234
    lock_parameters = true;
225
235
226
    AVCodecContext *c = vstream->codec;
236
    AVCodecContext *c = vstream->codec;
227
    
237
228
    if (frame && rgbframe) {
238
    if (frame && rgbframe) {
229
	if (img_convert((AVPicture *)frame, c->pix_fmt,
239
      SwsContext *sc = sws_getContext(c->width, c->height, PIX_FMT_BGR24, 
230
			(AVPicture *)rgbframe, PIX_FMT_RGB24,
240
				      c->width, c->height, c->pix_fmt, 
231
			c->width, c->height) < 0) {
241
				      SWS_BICUBIC, 0, 0, 0);
232
	    (*out) << "AVHandler: error converting RGB image to output format" << std::endl;
242
      sws_scale(sc, rgbframe->data, rgbframe->linesize, 0,
233
	    return -1;
243
		c->height, frame->data, frame->linesize);
234
	}
235
    }
244
    }
236
    
245
    
237
    int out_size = avcodec_encode_video(c, video_outbuf,
246
    int out_size = avcodec_encode_video(c, video_outbuf,
Lines 334-342 Link Here
334
    }
343
    }
335
    cc->hurry_up = 0;
344
    cc->hurry_up = 0;
336
345
337
    img_convert((AVPicture *)rgbframe, PIX_FMT_RGB24,
346
    SwsContext *sc = sws_getContext(cc->width, cc->height, cc->pix_fmt, 
338
		(AVPicture *)frame, cc->pix_fmt,
347
				    cc->width, cc->height, PIX_FMT_BGR24, 
339
		cc->width, cc->height);
348
				    SWS_BICUBIC, 0, 0, 0);
349
    sws_scale(sc, frame->data, frame->linesize, 0,
350
              cc->height, rgbframe->data, rgbframe->linesize);
340
351
341
    av_free_packet(&packet);
352
    av_free_packet(&packet);
342
    av_free(frame); frame = NULL;
353
    av_free(frame); frame = NULL;
Lines 362-368 Link Here
362
    av_register_all();
373
    av_register_all();
363
374
364
    AVCodec *codec;
375
    AVCodec *codec;
365
    for (codec = first_avcodec; codec != NULL; codec = codec->next) {
376
    for (codec = av_codec_next(0); codec != NULL; codec = av_codec_next(codec)) {
366
	if ((codec->type == CODEC_TYPE_VIDEO) &&
377
	if ((codec->type == CODEC_TYPE_VIDEO) &&
367
	    (codec->encode)) {	    
378
	    (codec->encode)) {	    
368
	    (*out) << codec->name << " ";
379
	    (*out) << codec->name << " ";
(-)video-1.0.1/src/aviread.cc (-3 / +3 lines)
Lines 71-79 Link Here
71
    NDArray image = NDArray(d, 0);
71
    NDArray image = NDArray(d, 0);
72
    for (unsigned int y = 0; y < av.get_height(); y++) {	
72
    for (unsigned int y = 0; y < av.get_height(); y++) {	
73
	for (unsigned int x = 0; x < av.get_width(); x++) {
73
	for (unsigned int x = 0; x < av.get_width(); x++) {
74
	    for (short rgb = 0; rgb < 3; rgb++) {
74
	  image(y, x, 0) = (double)frame->data[0][y * frame->linesize[0] + 3*x + 2]/255;
75
		image(y, x, rgb) = (double)frame->data[0][y * frame->linesize[0] + 3*x + rgb]/255;
75
	  image(y, x, 1) = (double)frame->data[0][y * frame->linesize[0] + 3*x + 1]/255;
76
	    }
76
	  image(y, x, 2) = (double)frame->data[0][y * frame->linesize[0] + 3*x + 0]/255;
77
	}
77
	}
78
    }
78
    }
79
79
(-)video-1.0.1/src/configure (-1 / +80 lines)
Lines 3228-3234 Link Here
3228
  FFMPEG_FLAGS="-lavcodec -lavutil -lm"
3228
  FFMPEG_FLAGS="-lavcodec -lavutil -lm"
3229
  echo $FFMPEG_FLAGS
3229
  echo $FFMPEG_FLAGS
3230
else
3230
else
3231
  FFMPEG_FLAGS=`pkg-config libavformat --libs --cflags`
3231
  FFMPEG_FLAGS=`pkg-config libavformat libavcodec libavutil libswscale --libs --cflags`
3232
  echo $FFMPEG_FLAGS
3232
fi
3233
fi
3233
3234
3234
3235
Lines 3383-3388 Link Here
3383
fi
3384
fi
3384
3385
3385
3386
3387
{ echo "$as_me:$LINENO: checking for sws_scale in -lswscale" >&5
3388
echo $ECHO_N "checking for sws_scale in -lswscale... $ECHO_C" >&6; }
3389
if test "${ac_cv_lib_swscale_sws_scale+set}" = set; then
3390
  echo $ECHO_N "(cached) $ECHO_C" >&6
3391
else
3392
  ac_check_lib_save_LIBS=$LIBS
3393
LIBS="-lswscale $FFMPEG_FLAGS $LIBS"
3394
cat >conftest.$ac_ext <<_ACEOF
3395
/* confdefs.h.  */
3396
_ACEOF
3397
cat confdefs.h >>conftest.$ac_ext
3398
cat >>conftest.$ac_ext <<_ACEOF
3399
/* end confdefs.h.  */
3400
3401
/* Override any GCC internal prototype to avoid an error.
3402
   Use char because int might match the return type of a GCC
3403
   builtin and then its argument prototype would still apply.  */
3404
#ifdef __cplusplus
3405
extern "C"
3406
#endif
3407
char sws_scale ();
3408
int
3409
main ()
3410
{
3411
return sws_scale ();
3412
  ;
3413
  return 0;
3414
}
3415
_ACEOF
3416
rm -f conftest.$ac_objext conftest$ac_exeext
3417
if { (ac_try="$ac_link"
3418
case "(($ac_try" in
3419
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3420
  *) ac_try_echo=$ac_try;;
3421
esac
3422
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3423
  (eval "$ac_link") 2>conftest.er1
3424
  ac_status=$?
3425
  grep -v '^ *+' conftest.er1 >conftest.err
3426
  rm -f conftest.er1
3427
  cat conftest.err >&5
3428
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
3429
  (exit $ac_status); } && {
3430
	 test -z "$ac_c_werror_flag" ||
3431
	 test ! -s conftest.err
3432
       } && test -s conftest$ac_exeext &&
3433
       $as_test_x conftest$ac_exeext; then
3434
  ac_cv_lib_swscale_sws_scale=yes
3435
else
3436
  echo "$as_me: failed program was:" >&5
3437
sed 's/^/| /' conftest.$ac_ext >&5
3438
3439
	ac_cv_lib_swscale_sws_scale=no
3440
fi
3441
3442
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
3443
      conftest$ac_exeext conftest.$ac_ext
3444
LIBS=$ac_check_lib_save_LIBS
3445
fi
3446
{ echo "$as_me:$LINENO: result: $ac_cv_lib_swscale_sws_scale" >&5
3447
echo "${ECHO_T}$ac_cv_lib_swscale_sws_scale" >&6; }
3448
if test $ac_cv_lib_swscale_sws_scale = yes; then
3449
  cat >>confdefs.h <<_ACEOF
3450
#define HAVE_LIBSWSCALE 1
3451
_ACEOF
3452
3453
  LIBS="-lswscale $LIBS"
3454
3455
else
3456
  { { echo "$as_me:$LINENO: error: need libswscale from FFMpeg" >&5
3457
echo "$as_me: error: need libswscale from FFMpeg" >&2;}
3458
   { (exit 1); exit 1; }; }
3459
fi
3460
3461
3462
OLD_CPPFLAGS=$CPPFLAGS
3463
CPPFLAGS="$CPPFLAGS $FFMPEG_FLAGS"
3386
FFMPEG_DEFS=
3464
FFMPEG_DEFS=
3387
3465
3388
ac_ext=c
3466
ac_ext=c
Lines 4659-4664 Link Here
4659
   { (exit 1); exit 1; }; }
4737
   { (exit 1); exit 1; }; }
4660
fi
4738
fi
4661
4739
4740
CPPFLAGS=$OLD_CPPFLAGS
4662
4741
4663
ac_config_files="$ac_config_files Makefile"
4742
ac_config_files="$ac_config_files Makefile"
4664
4743
(-)video-1.0.1/src/configure.base (-1 / +8 lines)
Lines 333-339 Link Here
333
  FFMPEG_FLAGS="-lavcodec -lavutil -lm"
333
  FFMPEG_FLAGS="-lavcodec -lavutil -lm"
334
  echo $FFMPEG_FLAGS
334
  echo $FFMPEG_FLAGS
335
else
335
else
336
  FFMPEG_FLAGS=`pkg-config libavformat --libs --cflags`
336
  FFMPEG_FLAGS=`pkg-config libavformat libavcodec libavutil libswscale --libs --cflags`
337
  echo $FFMPEG_FLAGS
337
fi
338
fi
338
339
339
AC_CHECK_LIB([avformat], [av_write_frame], [],
340
AC_CHECK_LIB([avformat], [av_write_frame], [],
Lines 342-348 Link Here
342
AC_CHECK_LIB([avcodec], [av_malloc], [],
343
AC_CHECK_LIB([avcodec], [av_malloc], [],
343
			[AC_MSG_ERROR([need libavcodec from FFMpeg])],
344
			[AC_MSG_ERROR([need libavcodec from FFMpeg])],
344
			[$FFMPEG_FLAGS])
345
			[$FFMPEG_FLAGS])
346
AC_CHECK_LIB([swscale], [sws_scale], [],
347
			[AC_MSG_ERROR([need libswscale from FFMpeg])],
348
			[$FFMPEG_FLAGS])
345
349
350
OLD_CPPFLAGS=$CPPFLAGS
351
CPPFLAGS="$CPPFLAGS $FFMPEG_FLAGS"
346
FFMPEG_DEFS=
352
FFMPEG_DEFS=
347
AC_SUBST(FFMPEG_DEFS)
353
AC_SUBST(FFMPEG_DEFS)
348
AC_CHECK_HEADERS(ffmpeg/avformat.h,
354
AC_CHECK_HEADERS(ffmpeg/avformat.h,
Lines 362-367 Link Here
362
#elif defined(HAVE_LIBAVFORMAT_AVFORMAT_H)
368
#elif defined(HAVE_LIBAVFORMAT_AVFORMAT_H)
363
#include <libavformat/avformat.h>
369
#include <libavformat/avformat.h>
364
#endif])
370
#endif])
371
CPPFLAGS=$OLD_CPPFLAGS
365
372
366
AC_CONFIG_FILES([Makefile])
373
AC_CONFIG_FILES([Makefile])
367
AC_SUBST([FFMPEG_CONFIG])
374
AC_SUBST([FFMPEG_CONFIG])
(-)video-1.0.1/src/Makefile.in (-3 / +3 lines)
Lines 4-13 Link Here
4
4
5
FFMPEG_CONFIG = @FFMPEG_CONFIG@
5
FFMPEG_CONFIG = @FFMPEG_CONFIG@
6
ifdef FFMPEG_CONFIG
6
ifdef FFMPEG_CONFIG
7
  FFMPEG_LIBS = $(shell pkg-config libavformat --libs)
7
  FFMPEG_LIBS = $(shell pkg-config libavformat libavcodec libavutil libswscale --libs)
8
  FFMPEG_CFLAGS = $(shell pkg-config libavformat --cflags)
8
  FFMPEG_CFLAGS = $(shell pkg-config libavformat libavcodec libavutil libswscale --cflags)
9
else
9
else
10
  FFMPEG_LIBS = -lavformat -lavcodec -lz -lm
10
  FFMPEG_LIBS = -lavformat -lavcodec -lavutil -lswscale -lz -lm
11
  FFMPEG_CFLAGS =
11
  FFMPEG_CFLAGS =
12
endif
12
endif
13
13
(-)video-1.0.1/src/oct-avifile.cc (-8 / +12 lines)
Lines 101-115 Link Here
101
	return;
101
	return;
102
    }
102
    }
103
    
103
    
104
    for (int rgb = 0; rgb < 3; rgb++) {
104
    for (unsigned int y = 0; y < frame_rows; y++) {
105
	for (unsigned int y = 0; y < frame_rows; y++) {
105
      for (unsigned int x = 0; x < frame_columns; x++) {
106
	    for (unsigned int x = 0; x < frame_columns; x++) {
106
	if (bands == 3) {
107
		if (bands == 3)
107
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 2] = (unsigned char)(f(y,x,0)*255);
108
		    rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + rgb] = (unsigned char)(f(y,x,rgb)*255);
108
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 1] = (unsigned char)(f(y,x,1)*255);
109
		else
109
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 0] = (unsigned char)(f(y,x,2)*255);
110
		    rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + rgb] = (unsigned char)(f(y,x)*255);
110
	}
111
	    }
111
	else {
112
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 0] = (unsigned char)(f(y,x)*255);
113
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 1] = (unsigned char)(f(y,x)*255);
114
	  rgbframe->data[0][y * rgbframe->linesize[0] + 3*x + 2] = (unsigned char)(f(y,x)*255);
112
	}
115
	}
116
      }
113
    }
117
    }
114
    
118
    
115
    if (av->write_frame() < 0) {
119
    if (av->write_frame() < 0) {

Return to bug 179885