History

lavfi: make ff_framequeue_skip_samples() more useful.

Instead of just updating statistics and leaving the work to the call site, have it actually do the work.

Nicolas George committed 9 years ago

Commit 383057f1 parent e05d2dd3 files · +33 −13Browse files

Showing the changes to libavfilter/framequeue.c (1 of 3 files). Show all

Unified · Split

libavfilter/framequeue.c+27−0
@@ -121,3 +121,30 @@ AVFrame *ff_framequeue_peek(FFFrameQueue *fq, size_t idx) · 120 unmodified lines
121121 check_consistency(fq);
122122 return b->frame;
123123 }
124+
125+void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base)
126+{
127+ FFFrameBucket *b;
128+ size_t bytes;
129+ int planar, planes, i;
130+
131+ check_consistency(fq);
132+ av_assert1(fq->queued);
133+ b = bucket(fq, 0);
134+ av_assert1(samples < b->frame->nb_samples);
135+ planar = av_sample_fmt_is_planar(b->frame->format);
136+ planes = planar ? b->frame->channels : 1;
137+ bytes = samples * av_get_bytes_per_sample(b->frame->format);
138+ if (!planar)
139+ bytes *= b->frame->channels;
140+ if (b->frame->pts != AV_NOPTS_VALUE)
141+ b->frame->pts += av_rescale_q(samples, av_make_q(1, b->frame->sample_rate), time_base);
142+ b->frame->nb_samples -= samples;
143+ b->frame->linesize[0] -= bytes;
144+ for (i = 0; i < planes; i++)
145+ b->frame->extended_data[i] += bytes;
146+ for (i = 0; i < planes && i < AV_NUM_DATA_POINTERS; i++)
147+ b->frame->data[i] = b->frame->extended_data[i];
148+ fq->total_samples_tail += samples;
149+ ff_framequeue_update_peeked(fq, 0);
150+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t