summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/adpcmenc.c4
-rw-r--r--libavcodec/utils.c9
-rw-r--r--libavdevice/timefilter.c7
-rw-r--r--libavfilter/af_resample.c7
-rw-r--r--libavformat/gxf.c2
5 files changed, 19 insertions, 10 deletions
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 747b9fe4c4..284fbb60e8 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -538,8 +538,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ADPCMChannelStatus *status = &c->status[ch];
const int16_t *smp = &samples_p[ch][1 + i * 8];
for (j = 0; j < 8; j += 2) {
- uint8_t v = adpcm_ima_compress_sample(status, smp[j ]);
- v |= (adpcm_ima_compress_sample(status, smp[j + 1]) << 4);
+ uint8_t v = adpcm_ima_compress_sample(status, smp[j ]);
+ v |= adpcm_ima_compress_sample(status, smp[j + 1]) << 4;
*dst++ = v;
}
}
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 36ac878540..be86fa0a6f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -947,9 +947,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (av_codec_is_encoder(avctx->codec)) {
int i;
if (avctx->codec->sample_fmts) {
- for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
+ for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
break;
+ if (avctx->channels == 1 &&
+ av_get_planar_sample_fmt(avctx->sample_fmt) ==
+ av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
+ avctx->sample_fmt = avctx->codec->sample_fmts[i];
+ break;
+ }
+ }
if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n");
ret = AVERROR(EINVAL);
diff --git a/libavdevice/timefilter.c b/libavdevice/timefilter.c
index 330f26e367..343f1b1c44 100644
--- a/libavdevice/timefilter.c
+++ b/libavdevice/timefilter.c
@@ -28,8 +28,8 @@
#include "timefilter.h"
struct TimeFilter {
- /// Delay Locked Loop data. These variables refer to mathematical
- /// concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf
+ // Delay Locked Loop data. These variables refer to mathematical
+ // concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf
double cycle_time;
double feedback2_factor;
double feedback3_factor;
@@ -69,15 +69,12 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
{
self->count++;
if (self->count == 1) {
- /// init loop
self->cycle_time = system_time;
} else {
double loop_error;
self->cycle_time += self->clock_period * period;
- /// calculate loop error
loop_error = system_time - self->cycle_time;
- /// update loop
self->cycle_time += FFMAX(self->feedback2_factor, 1.0 / self->count) * loop_error;
self->clock_period += self->feedback3_factor * loop_error;
}
diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c
index c51f9d243b..58a9b2a99e 100644
--- a/libavfilter/af_resample.c
+++ b/libavfilter/af_resample.c
@@ -93,7 +93,11 @@ static int config_output(AVFilterLink *outlink)
if (inlink->channel_layout == outlink->channel_layout &&
inlink->sample_rate == outlink->sample_rate &&
- inlink->format == outlink->format)
+ (inlink->format == outlink->format ||
+ (av_get_channel_layout_nb_channels(inlink->channel_layout) == 1 &&
+ av_get_channel_layout_nb_channels(outlink->channel_layout) == 1 &&
+ av_get_planar_sample_fmt(inlink->format) ==
+ av_get_planar_sample_fmt(outlink->format))))
return 0;
if (!(s->avr = avresample_alloc_context()))
@@ -226,6 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
fail:
avfilter_unref_buffer(buf);
} else {
+ buf->format = outlink->format;
ret = ff_filter_samples(outlink, buf);
s->got_output = 1;
}
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 9f000d0d16..c63cafb598 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -23,6 +23,7 @@
#include "avformat.h"
#include "internal.h"
#include "gxf.h"
+#include "libavcodec/mpeg12data.h"
struct gxf_stream_info {
int64_t first_field;
@@ -207,7 +208,6 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info
* @return fps as AVRational, or 0 / 0 if unknown
*/
static AVRational fps_tag2avr(int32_t fps) {
- extern const AVRational avpriv_frame_rate_tab[];
if (fps < 1 || fps > 9) fps = 9;
return avpriv_frame_rate_tab[9 - fps]; // values have opposite order
}