~ubuntu-branches/debian/experimental/ffmpeg/experimental

« back to all changes in this revision

Viewing changes to libavfilter/af_resample.c

  • Committer: Package Import Robot
  • Author(s): Andreas Cadhalpun, Andreas Cadhalpun, Carl Eugen Hoyos
  • Date: 2015-07-09 23:42:42 UTC
  • mfrom: (0.1.17) (3.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20150709234242-mf3vk9qgvcv9zh3s
Tags: 7:2.7.1-2
[ Andreas Cadhalpun ]
* Build libavcodec-extra flavor.
* Add encdec-extra autopkgtest for the libavcodec-extra flavor.
* Add lib*-dev and libav-tools-links packages.
* Drop README.Debian.
* Remove bogus apng-ffm autopkg test.
* Explicitly build-depend on liblzma-dev used by the tiff decoder.
* Use the pkg-multimedia repository for the Vcs links.
* Use the plain lib*-dev packages for the test dependencies.
* Disable libssh on sparc due to #790067.
* Remove temporary gdb dependency on sparc64.
* Enable openal on sparc64.

[ Carl Eugen Hoyos ]
* Disable x265 on alpha due to #789807.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    AVDictionary *options;
42
42
 
43
43
    int64_t next_pts;
 
44
    int64_t next_in_pts;
44
45
 
45
46
    /* set by filter_frame() to signal an output frame to request_frame() */
46
47
    int got_output;
134
135
        return AVERROR(ENOMEM);
135
136
 
136
137
    if (s->options) {
 
138
        int ret;
137
139
        AVDictionaryEntry *e = NULL;
138
140
        while ((e = av_dict_get(s->options, "", e, AV_DICT_IGNORE_SUFFIX)))
139
141
            av_log(ctx, AV_LOG_VERBOSE, "lavr option: %s=%s\n", e->key, e->value);
140
142
 
141
 
        av_opt_set_dict(s->avr, &s->options);
 
143
        ret = av_opt_set_dict(s->avr, &s->options);
 
144
        if (ret < 0)
 
145
            return ret;
142
146
    }
143
147
 
144
148
    av_opt_set_int(s->avr,  "in_channel_layout", inlink ->channel_layout, 0);
153
157
 
154
158
    outlink->time_base = (AVRational){ 1, outlink->sample_rate };
155
159
    s->next_pts        = AV_NOPTS_VALUE;
 
160
    s->next_in_pts     = AV_NOPTS_VALUE;
156
161
 
157
162
    av_get_channel_layout_string(buf1, sizeof(buf1),
158
163
                                 -1, inlink ->channel_layout);
254
259
            }
255
260
 
256
261
            out->sample_rate = outlink->sample_rate;
257
 
            if (in->pts != AV_NOPTS_VALUE) {
 
262
            /* Only convert in->pts if there is a discontinuous jump.
 
263
               This ensures that out->pts tracks the number of samples actually
 
264
               output by the resampler in the absence of such a jump.
 
265
               Otherwise, the rounding in av_rescale_q() and av_rescale()
 
266
               causes off-by-1 errors. */
 
267
            if (in->pts != AV_NOPTS_VALUE && in->pts != s->next_in_pts) {
258
268
                out->pts = av_rescale_q(in->pts, inlink->time_base,
259
269
                                            outlink->time_base) -
260
270
                               av_rescale(delay, outlink->sample_rate,
263
273
                out->pts = s->next_pts;
264
274
 
265
275
            s->next_pts = out->pts + out->nb_samples;
 
276
            s->next_in_pts = in->pts + in->nb_samples;
266
277
 
267
278
            ret = ff_filter_frame(outlink, out);
268
279
            s->got_output = 1;