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