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 << " "; |