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
|
$NetBSD: patch-ad,v 1.1 2009/11/28 18:37:22 kefren Exp $
--- src/plugins/ffmpeg/ffmpeg.cpp.orig 2009-11-28 18:48:32.000000000 +0200
+++ src/plugins/ffmpeg/ffmpeg.cpp 2009-11-28 19:04:32.000000000 +0200
@@ -201,7 +201,7 @@
if(pFFmpeg->audio_sync_method){
double delta = get_sync_ipts(ost, pFFmpeg) * enc->sample_rate - ost->sync_opts
- - av_fifo_size(&ost->fifo)/(ost->st->codec->channels * 2);
+ - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2);
double idelta= delta*ist->st->codec->sample_rate / enc->sample_rate;
int byte_delta= ((int)idelta)*2*ist->st->codec->channels;
@@ -238,13 +238,13 @@
assert(ost->audio_resample);
if(pFFmpeg->verbose > 2)
fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate);
-// fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(&ost->fifo)/(ost->st->codec->channels * 2));
+// fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2));
av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate);
}
}
}else
ost->sync_opts= lrintf(get_sync_ipts(ost, pFFmpeg) * enc->sample_rate)
- - av_fifo_size(&ost->fifo)/(ost->st->codec->channels * 2); //FIXME wrong
+ - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2); //FIXME wrong
if (ost->audio_resample) {
buftmp = audio_buf;
@@ -260,11 +260,11 @@
/* now encode as many frames as possible */
if (enc->frame_size > 1) {
/* output resampled raw samples */
- av_fifo_write(&ost->fifo, buftmp, size_out);
+ av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);
frame_bytes = enc->frame_size * 2 * enc->channels;
- while (av_fifo_read(&ost->fifo, audio_buf, frame_bytes) == 0) {
+ while (av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL) == 0) {
AVPacket pkt;
av_init_packet(&pkt);
@@ -1020,11 +1020,11 @@
/* XXX: allocate the subtitles in the codec ? */
if (subtitle_to_free) {
if (subtitle_to_free->rects != NULL) {
- for (i = 0; i < subtitle_to_free->num_rects; i++) {
+/* for (i = 0; i < subtitle_to_free->num_rects; i++) {
av_free(subtitle_to_free->rects[i].bitmap);
av_free(subtitle_to_free->rects[i].rgba_palette);
}
- av_freep(&subtitle_to_free->rects);
+*/ av_freep(&subtitle_to_free->rects);
}
subtitle_to_free->num_rects = 0;
subtitle_to_free = NULL;
@@ -1054,13 +1054,13 @@
switch(ost->st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
- fifo_bytes = av_fifo_size(&ost->fifo);
+ fifo_bytes = av_fifo_size(ost->fifo);
ret = 0;
/* encode any samples remaining in fifo */
if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
int fs_tmp = enc->frame_size;
enc->frame_size = fifo_bytes / (2 * enc->channels);
- if(av_fifo_read(&ost->fifo, (uint8_t *)samples, fifo_bytes) == 0) {
+ if(av_fifo_generic_read(ost->fifo, (uint8_t *)samples, fifo_bytes, NULL) == 0) {
ret = avcodec_encode_audio(enc, pFFmpeg->bit_buffer, pFFmpeg->bit_buffer_size, samples);
}
enc->frame_size = fs_tmp;
@@ -1309,7 +1309,7 @@
} else {
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
- if (av_fifo_init(&ost->fifo, 2 * MAX_AUDIO_PACKET_SIZE))
+ if ((ost->fifo = av_fifo_alloc(2 * MAX_AUDIO_PACKET_SIZE)) == NULL)
goto fail;
if (codec->channels == icodec->channels &&
@@ -1766,7 +1766,7 @@
fclose(ost->logfile);
ost->logfile = NULL;
}
- av_fifo_free(&ost->fifo); /* works even if fifo is not
+ av_fifo_free(ost->fifo); /* works even if fifo is not
initialized but set to zero */
av_free(ost->pict_tmp.data[0]);
#ifdef HAVE_LIBSWSCALE
|