It will allow to refernce it as a whole without clunky macros. Most of the changes have been automatically made with sed: sed -i ' s/-> *in_formats/->incfg.formats/g; s/-> *out_formats/->outcfg.formats/g; s/-> *in_channel_layouts/->incfg.channel_layouts/g; s/-> *out_channel_layouts/->outcfg.channel_layouts/g; s/-> *in_samplerates/->incfg.samplerates/g; s/-> *out_samplerates/->outcfg.samplerates/g; ' src/libavfilter/*(.)
Showing the changes to libavfilter/avfilter.h (1 of 70 files). Show all
Unified · Split
| @@ -68,6 +68,7 @@ typedef struct AVFilterContext AVFilterContext; · 67 unmodified lines | ||
| 68 | 68 | typedef struct AVFilterLink AVFilterLink; |
| 69 | 69 | typedef struct AVFilterPad AVFilterPad; |
| 70 | 70 | typedef struct AVFilterFormats AVFilterFormats; |
| 71 | +typedef struct AVFilterChannelLayouts AVFilterChannelLayouts; | |
| 71 | 72 | |
| 72 | 73 | /** |
| 73 | 74 | * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. |
| @@ -264,13 +265,13 @@ typedef struct AVFilter { · 190 unmodified lines | ||
| 264 | 265 | * and outputs are fixed), shortly before the format negotiation. This |
| 265 | 266 | * callback may be called more than once. |
| 266 | 267 | * |
| 267 | − * This callback must set AVFilterLink.out_formats on every input link and | |
| 268 | − * AVFilterLink.in_formats on every output link to a list of pixel/sample | |
| 268 | + * This callback must set AVFilterLink.outcfg.formats on every input link and | |
| 269 | + * AVFilterLink.incfg.formats on every output link to a list of pixel/sample | |
| 269 | 270 | * formats that the filter supports on that link. For audio links, this |
| 270 | − * filter must also set @ref AVFilterLink.in_samplerates "in_samplerates" / | |
| 271 | − * @ref AVFilterLink.out_samplerates "out_samplerates" and | |
| 272 | − * @ref AVFilterLink.in_channel_layouts "in_channel_layouts" / | |
| 273 | − * @ref AVFilterLink.out_channel_layouts "out_channel_layouts" analogously. | |
| 271 | + * filter must also set @ref AVFilterLink.incfg.samplerates "in_samplerates" / | |
| 272 | + * @ref AVFilterLink.outcfg.samplerates "out_samplerates" and | |
| 273 | + * @ref AVFilterLink.incfg.channel_layouts "in_channel_layouts" / | |
| 274 | + * @ref AVFilterLink.outcfg.channel_layouts "out_channel_layouts" analogously. | |
| 274 | 275 | * |
| 275 | 276 | * This callback may be NULL for filters with one input, in which case |
| 276 | 277 | * libavfilter assumes that it supports all input formats and preserves |
| @@ -424,6 +425,35 @@ struct AVFilterContext { · 147 unmodified lines | ||
| 424 | 425 | int extra_hw_frames; |
| 425 | 426 | }; |
| 426 | 427 | |
| 428 | +/** | |
| 429 | + * Lists of formats / etc. supported by an end of a link. | |
| 430 | + * | |
| 431 | + * This structure is directly part of AVFilterLink, in two copies: | |
| 432 | + * one for the source filter, one for the destination filter. | |
| 433 | + | |
| 434 | + * These lists are used for negotiating the format to actually be used, | |
| 435 | + * which will be loaded into the format and channel_layout members of | |
| 436 | + * AVFilterLink, when chosen. | |
| 437 | + */ | |
| 438 | +typedef struct AVFilterFormatsConfig { | |
| 439 | + | |
| 440 | + /** | |
| 441 | + * List of supported formats (pixel or sample). | |
| 442 | + */ | |
| 443 | + AVFilterFormats *formats; | |
| 444 | + | |
| 445 | + /** | |
| 446 | + * Lists of supported sample rates, only for audio. | |
| 447 | + */ | |
| 448 | + AVFilterFormats *samplerates; | |
| 449 | + | |
| 450 | + /** | |
| 451 | + * Lists of supported channel layouts, only for audio. | |
| 452 | + */ | |
| 453 | + AVFilterChannelLayouts *channel_layouts; | |
| 454 | + | |
| 455 | +} AVFilterFormatsConfig; | |
| 456 | + | |
| 427 | 457 | /** |
| 428 | 458 | * A link between two filters. This contains pointers to the source and |
| 429 | 459 | * destination filters between which this link exists, and the indexes of |
| @@ -471,24 +501,16 @@ struct AVFilterLink { · 41 unmodified lines | ||
| 471 | 501 | * New public fields should be added right above. |
| 472 | 502 | ***************************************************************** |
| 473 | 503 | */ |
| 504 | + | |
| 474 | 505 | /** |
| 475 | − * Lists of formats and channel layouts supported by the input and output | |
| 476 | − * filters respectively. These lists are used for negotiating the format | |
| 477 | − * to actually be used, which will be loaded into the format and | |
| 478 | − * channel_layout members, above, when chosen. | |
| 479 | − * | |
| 506 | + * Lists of supported formats / etc. supported by the input filter. | |
| 480 | 507 | */ |
| 481 | − AVFilterFormats *in_formats; | |
| 482 | − AVFilterFormats *out_formats; | |
| 508 | + AVFilterFormatsConfig incfg; | |
| 483 | 509 | |
| 484 | 510 | /** |
| 485 | − * Lists of channel layouts and sample rates used for automatic | |
| 486 | − * negotiation. | |
| 511 | + * Lists of supported formats / etc. supported by the output filter. | |
| 487 | 512 | */ |
| 488 | − AVFilterFormats *in_samplerates; | |
| 489 | − AVFilterFormats *out_samplerates; | |
| 490 | − struct AVFilterChannelLayouts *in_channel_layouts; | |
| 491 | − struct AVFilterChannelLayouts *out_channel_layouts; | |
| 513 | + AVFilterFormatsConfig outcfg; | |
| 492 | 514 | |
| 493 | 515 | /** stage of the initialization of the link properties (dimensions, etc) */ |
| 494 | 516 | enum { |