summaryrefslogtreecommitdiff
blob: 9711f9e556f925b53aa82a9803cb2ebfebd80139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Index: karlyriceditor-1.4/src/ffmpegvideoencoder.cpp
===================================================================
--- karlyriceditor-1.4.orig/src/ffmpegvideoencoder.cpp
+++ karlyriceditor-1.4/src/ffmpegvideoencoder.cpp
@@ -397,6 +397,13 @@ int FFMpegVideoEncoderPriv::encodeImage(
 	// SWS conversion
 	convertImage_sws(img);
 
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,2,0)
+	int out_size = avcodec_encode_video(pVideoCodecCtx,outbuf,outbuf_size,ppicture);
+
+	if (out_size > 0)
+	{
+		av_init_packet(&pkt);
+#else
 	av_init_packet( &pkt );
 	pkt.data = NULL;
 	pkt.size = 0;
@@ -408,6 +415,7 @@ int FFMpegVideoEncoderPriv::encodeImage(
 
 	if ( got_packet )
 	{
+#endif
 		if ( pVideoCodecCtx->coded_frame->pts != (int64_t) (0x8000000000000000LL) )
 			pkt.pts= av_rescale_q(pVideoCodecCtx->coded_frame->pts, pVideoCodecCtx->time_base, pVideoStream->time_base);
 
@@ -415,6 +423,10 @@ int FFMpegVideoEncoderPriv::encodeImage(
 			pkt.flags |= AV_PKT_FLAG_KEY;
 
 		pkt.stream_index = pVideoStream->index;
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,2,0)
+		pkt.data = outbuf;
+		pkt.size = out_size;
+#endif
 
 		int ret = av_interleaved_write_frame(pOutputCtx, &pkt);