History

lavfi: add audio channel packing negotiation fields

Mina Nagy Zaki committed 15 years ago

Commit b57df291 parent 7bda0c96 files · +51 −3Browse files

Unified · Split

6 files
  1. doc/APIchanges +8 −0
  2. libavfilter/avfilter.c +3 −0
  3. libavfilter/avfilter.h +16 −2
  4. libavfilter/avfiltergraph.c +5 −1
  5. libavfilter/defaults.c +8 −0
  6. libavfilter/formats.c +11 −0
doc/APIchanges+8−0
@@ -13,6 +13,14 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-07-16 - xxxxxx - lavfi 2.27.0
17 Add audio packing negotiation fields and helper functions.
18
19 In particular, add AVFilterPacking enum, planar, in_packings and
20 out_packings fields to AVFilterLink, and the functions:
21 avfilter_set_common_packing_formats()
22 avfilter_all_packing_formats()
23
162011-07-10 - a67c061 - lavf 53.3.0242011-07-10 - a67c061 - lavf 53.3.0
17 Add avformat_find_stream_info(), deprecate av_find_stream_info().25 Add avformat_find_stream_info(), deprecate av_find_stream_info().
18 26
libavfilter/avfilter.c+3−0
@@ -221,6 +221,9 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, · 220 unmodified lines
221 if (link->out_chlayouts)221 if (link->out_chlayouts)
222 avfilter_formats_changeref(&link->out_chlayouts,222 avfilter_formats_changeref(&link->out_chlayouts,
223 &filt->outputs[filt_dstpad_idx]->out_chlayouts);223 &filt->outputs[filt_dstpad_idx]->out_chlayouts);
224 if (link->out_packing)
225 avfilter_formats_changeref(&link->out_packing,
226 &filt->outputs[filt_dstpad_idx]->out_packing);
224 227
225 return 0;228 return 0;
226}229}
libavfilter/avfilter.h+16−2
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/rational.h"29#include "libavutil/rational.h"
30 30
31#define LIBAVFILTER_VERSION_MAJOR 231#define LIBAVFILTER_VERSION_MAJOR 2
32#define LIBAVFILTER_VERSION_MINOR 2632#define LIBAVFILTER_VERSION_MINOR 27
33#define LIBAVFILTER_VERSION_MICRO 033#define LIBAVFILTER_VERSION_MICRO 0
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -264,6 +264,11 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type); · 228 unmodified lines
264 */264 */
265AVFilterFormats *avfilter_all_channel_layouts(void);265AVFilterFormats *avfilter_all_channel_layouts(void);
266 266
267/**
268 * Return a list of all audio packing formats.
269 */
270AVFilterFormats *avfilter_all_packing_formats(void);
271
267/**272/**
268 * Return a format list which contains the intersection of the formats of273 * Return a format list which contains the intersection of the formats of
269 * a and b. Also, all the references of a, all the references of b, and274 * a and b. Also, all the references of a, all the references of b, and
@@ -482,6 +487,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per · 212 unmodified lines
482void avfilter_set_common_pixel_formats(AVFilterContext *ctx, AVFilterFormats *formats);487void avfilter_set_common_pixel_formats(AVFilterContext *ctx, AVFilterFormats *formats);
483void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *formats);488void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *formats);
484void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats);489void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats);
490void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats);
485 491
486/** Default handler for query_formats() */492/** Default handler for query_formats() */
487int avfilter_default_query_formats(AVFilterContext *ctx);493int avfilter_default_query_formats(AVFilterContext *ctx);
@@ -570,6 +576,11 @@ struct AVFilterContext { · 82 unmodified lines
570 void *priv; ///< private data for use by the filter576 void *priv; ///< private data for use by the filter
571};577};
572 578
579enum AVFilterPacking {
580 AVFILTER_PACKED = 0,
581 AVFILTER_PLANAR,
582};
583
573/**584/**
574 * A link between two filters. This contains pointers to the source and585 * A link between two filters. This contains pointers to the source and
575 * destination filters between which this link exists, and the indexes of586 * destination filters between which this link exists, and the indexes of
@@ -597,9 +608,10 @@ struct AVFilterLink { · 21 unmodified lines
597 int w; ///< agreed upon image width608 int w; ///< agreed upon image width
598 int h; ///< agreed upon image height609 int h; ///< agreed upon image height
599 AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio610 AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
600 /* These two parameters apply only to audio */611 /* These parameters apply only to audio */
601 int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)612 int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)
602 int64_t sample_rate; ///< samples per second613 int64_t sample_rate; ///< samples per second
614 int planar; ///< agreed upon packing mode of audio buffers. true if planar.
603 615
604 int format; ///< agreed upon media format616 int format; ///< agreed upon media format
605 617
@@ -615,6 +627,8 @@ struct AVFilterLink { · 9 unmodified lines
615 627
616 AVFilterFormats *in_chlayouts;628 AVFilterFormats *in_chlayouts;
617 AVFilterFormats *out_chlayouts;629 AVFilterFormats *out_chlayouts;
630 AVFilterFormats *in_packing;
631 AVFilterFormats *out_packing;
618 632
619 /**633 /**
620 * The buffer reference currently being sent across the link by the source634 * The buffer reference currently being sent across the link by the source
libavfilter/avfiltergraph.c+5−1
@@ -203,8 +203,12 @@ static void pick_format(AVFilterLink *link) · 202 unmodified lines
203 link->channel_layout = link->in_chlayouts->formats[0];203 link->channel_layout = link->in_chlayouts->formats[0];
204 avfilter_formats_unref(&link->in_chlayouts);204 avfilter_formats_unref(&link->in_chlayouts);
205 avfilter_formats_unref(&link->out_chlayouts);205 avfilter_formats_unref(&link->out_chlayouts);
206 }
207 206
207 link->in_packing->format_count = 1;
208 link->planar = link->in_packing->formats[0] == AVFILTER_PLANAR;
209 avfilter_formats_unref(&link->in_packing);
210 avfilter_formats_unref(&link->out_packing);
211 }
208}212}
209 213
210static void pick_formats(AVFilterGraph *graph)214static void pick_formats(AVFilterGraph *graph)
libavfilter/defaults.c+8−0
@@ -239,11 +239,19 @@ void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats * · 238 unmodified lines
239 offsetof(AVFilterLink, out_chlayouts));239 offsetof(AVFilterLink, out_chlayouts));
240}240}
241 241
242void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats)
243{
244 set_common_formats(ctx, formats, AVMEDIA_TYPE_AUDIO,
245 offsetof(AVFilterLink, in_packing),
246 offsetof(AVFilterLink, out_packing));
247}
248
242int avfilter_default_query_formats(AVFilterContext *ctx)249int avfilter_default_query_formats(AVFilterContext *ctx)
243{250{
244 avfilter_set_common_pixel_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_VIDEO));251 avfilter_set_common_pixel_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_VIDEO));
245 avfilter_set_common_sample_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_AUDIO));252 avfilter_set_common_sample_formats(ctx, avfilter_all_formats(AVMEDIA_TYPE_AUDIO));
246 avfilter_set_common_channel_layouts(ctx, avfilter_all_channel_layouts());253 avfilter_set_common_channel_layouts(ctx, avfilter_all_channel_layouts());
254 avfilter_set_common_packing_formats(ctx, avfilter_all_packing_formats());
247 255
248 return 0;256 return 0;
249}257}
libavfilter/formats.c+11−0
@@ -173,6 +173,17 @@ AVFilterFormats *avfilter_all_channel_layouts(void) · 172 unmodified lines
173 return avfilter_make_format64_list(chlayouts);173 return avfilter_make_format64_list(chlayouts);
174}174}
175 175
176AVFilterFormats *avfilter_all_packing_formats(void)
177{
178 static int packing[] = {
179 AVFILTER_PACKED,
180 AVFILTER_PLANAR,
181 -1,
182 };
183
184 return avfilter_make_format_list(packing);
185}
186
176void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)187void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
177{188{
178 *ref = f;189 *ref = f;

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