summarylogtreecommitdiffstats
path: root/ffmpeg_api.patch
blob: d9747476c5f665dfa8c7e4d0572863eaf457b16e (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
diff --git a/cinelerra/ffmpeg.C b/cinelerra/ffmpeg.C
index 6ab6047..7cde503 100644
--- a/cinelerra/ffmpeg.C
+++ b/cinelerra/ffmpeg.C
@@ -23,7 +23,6 @@ FFMPEG::FFMPEG(Asset *asset) {
 
 int FFMPEG::init(char *codec_string) {
 
-	avcodec_init();
 	avcodec_register_all();
 
 	CodecID id = codec_id(codec_string);
@@ -364,12 +363,15 @@ int FFMPEG::decode(uint8_t *data, long data_size, VFrame *frame_out) {
 
 	// NOTE: frame must already have data space allocated
 	
+	AVPacket pkt;
 	got_picture = 0;
-	int length = avcodec_decode_video(context,
+	av_init_packet( &pkt );
+	pkt.data = data;
+	pkt.size = data_size;
+	int length = avcodec_decode_video2(context,
 					  picture,
 					  &got_picture,
-					  data,
-					  data_size);
+					  &pkt);
 	
 	if (length < 0) {
 		printf("FFMPEG::decode error decoding frame\n");
diff --git a/cinelerra/fileac3.C b/cinelerra/fileac3.C
index a1ef61e..e56705f 100644
--- a/cinelerra/fileac3.C
+++ b/cinelerra/fileac3.C
@@ -84,7 +84,6 @@ int FileAC3::open_file(int rd, int wr)
 
 	if(wr)
 	{
-  		avcodec_init();
 		avcodec_register_all();
 		codec = avcodec_find_encoder(CODEC_ID_AC3);
 		if(!codec)
diff --git a/quicktime/mpeg4.c b/quicktime/mpeg4.c
index 81cb72b..67bcab8 100644
--- a/quicktime/mpeg4.c
+++ b/quicktime/mpeg4.c
@@ -629,7 +629,6 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
 			if(!ffmpeg_initialized)
 			{
 				ffmpeg_initialized = 1;
-  				avcodec_init();
 				avcodec_register_all();
 			}
 
@@ -674,7 +673,7 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
 			context->error_resilience = FF_ER_CAREFUL;
 #else
-			context->error_recognition = FF_ER_CAREFUL;
+			context->err_recognition = AV_EF_CRCCHECK;
 #endif
 			context->error_concealment = 3;
 			context->frame_skip_cmp = FF_CMP_DCTMAX;
@@ -699,7 +698,6 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
         	context->profile= FF_PROFILE_UNKNOWN;
 			context->rc_buffer_aggressivity = 1.0;
         	context->level= FF_LEVEL_UNKNOWN;
-			context->flags |= CODEC_FLAG_H263P_UMV;
 			context->flags |= CODEC_FLAG_AC_PRED;
 
 // All the forbidden settings can be extracted from libavcodec/mpegvideo.c of ffmpeg...
@@ -717,10 +715,8 @@ static int encode(quicktime_t *file, unsigned char **row_pointers, int track)
 				(codec->ffmpeg_id == CODEC_ID_MPEG4 ||
 			         codec->ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
 			         codec->ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
-			         codec->ffmpeg_id == CODEC_ID_H263P || 
-			         codec->ffmpeg_id == CODEC_FLAG_H263P_SLICE_STRUCT))
+			         codec->ffmpeg_id == CODEC_ID_H263P))
 			{
-				avcodec_thread_init(context, file->cpus);
 				context->thread_count = file->cpus;
 			}
 
diff --git a/quicktime/qtffmpeg.c b/quicktime/qtffmpeg.c
index 8c532c2..a2b51e9 100644
--- a/quicktime/qtffmpeg.c
+++ b/quicktime/qtffmpeg.c
@@ -54,7 +54,6 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
 	if(!ffmpeg_initialized)
 	{
 		ffmpeg_initialized = 1;
-  		avcodec_init();
 		avcodec_register_all();
 	}
 
@@ -90,10 +89,8 @@ quicktime_ffmpeg_t* quicktime_new_ffmpeg(int cpus,
 				(ffmpeg_id == CODEC_ID_MPEG4 ||
 			         ffmpeg_id == CODEC_ID_MPEG1VIDEO ||
 			         ffmpeg_id == CODEC_ID_MPEG2VIDEO ||
-			         ffmpeg_id == CODEC_ID_H263P || 
-			         ffmpeg_id == CODEC_FLAG_H263P_SLICE_STRUCT))
+			         ffmpeg_id == CODEC_ID_H263P))
 		{
-			avcodec_thread_init(context, cpus);
 			context->thread_count = cpus;
 		}
 		if(avcodec_open(context, 
@@ -181,6 +178,7 @@ static int decode_wrapper(quicktime_t *file,
  
 	if(!result) 
 	{ 
+		AVPacket pkt;
 
 
 // No way to determine if there was an error based on nonzero status.
@@ -189,11 +187,13 @@ static int decode_wrapper(quicktime_t *file,
 			ffmpeg->decoder_context[current_field]->skip_frame = AVDISCARD_NONREF /* AVDISCARD_BIDIR */;
 		else
 			ffmpeg->decoder_context[current_field]->skip_frame = AVDISCARD_DEFAULT;
-		result = avcodec_decode_video(ffmpeg->decoder_context[current_field], 
+		av_init_packet( &pkt );
+		pkt.data = ffmpeg->work_buffer;
+		pkt.size = bytes + header_bytes;
+		result = avcodec_decode_video2(ffmpeg->decoder_context[current_field], 
 			&ffmpeg->picture[current_field], 
 			&got_picture, 
-			ffmpeg->work_buffer, 
-			bytes + header_bytes);
+			&pkt);
 
 
 
diff --git a/quicktime/wma.c b/quicktime/wma.c
index c045741..abc2dc8 100644
--- a/quicktime/wma.c
+++ b/quicktime/wma.c
@@ -67,7 +67,6 @@ static int init_decode(quicktime_audio_map_t *track_map,
 		if(!ffmpeg_initialized)
 		{
 			ffmpeg_initialized = 1;
-			avcodec_init();
 			avcodec_register_all();
 		}
 
@@ -195,11 +194,14 @@ printf("decode 2 %x %llx %llx\n", chunk_size, chunk_offset, chunk_offset + chunk
 			chunk_size);
 #else
 		bytes_decoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-		result = avcodec_decode_audio2(codec->decoder_context,
+		AVPacket pkt;
+		av_init_packet( &pkt );
+		pkt.data = codec->packet_buffer;
+		pkt.size = chunk_size;
+		result = avcodec_decode_audio3(codec->decoder_context,
 			(int16_t*)(codec->work_buffer + codec->output_size * sample_size),
 			&bytes_decoded,
-			codec->packet_buffer,
-			chunk_size);
+			&pkt);
 #endif
 
 		pthread_mutex_unlock(&ffmpeg_lock);