History

avutil/channel_layout: add av_channel_layout_custom_init()

Marton Balint committed 2 years ago

Commit 4569b861 parent 0748d2b4 files · +42 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/channel_layout.c +20 −0
  3. libavutil/channel_layout.h +17 −0
  4. libavutil/version.h +2 −2
doc/APIchanges+3−0
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 · 1 unmodified line
2 2
3API changes, most recent first:3API changes, most recent first:
4 4
52024-02-xx - xxxxxxxxxx - lavu 58.37.100 - channel_layout.h
6 Add av_channel_layout_custom_init().
7
52024-02-04 - xxxxxxxxxx - lavc 60.39.100 - packet.h82024-02-04 - xxxxxxxxxx - lavc 60.39.100 - packet.h
6 Add AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT.9 Add AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT.
7 10
libavutil/channel_layout.c+20−0
@@ -398,6 +398,26 @@ int av_get_standard_channel_layout(unsigned index, uint64_t *layout, · 397 unmodified lines
398FF_ENABLE_DEPRECATION_WARNINGS398FF_ENABLE_DEPRECATION_WARNINGS
399#endif399#endif
400 400
401int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels)
402{
403 AVChannelCustom *map;
404
405 if (nb_channels <= 0)
406 return AVERROR(EINVAL);
407
408 map = av_calloc(nb_channels, sizeof(*channel_layout->u.map));
409 if (!map)
410 return AVERROR(ENOMEM);
411 for (int i = 0; i < nb_channels; i++)
412 map[i].id = AV_CHAN_UNKNOWN;
413
414 channel_layout->order = AV_CHANNEL_ORDER_CUSTOM;
415 channel_layout->nb_channels = nb_channels;
416 channel_layout->u.map = map;
417
418 return 0;
419}
420
401int av_channel_layout_from_mask(AVChannelLayout *channel_layout,421int av_channel_layout_from_mask(AVChannelLayout *channel_layout,
402 uint64_t mask)422 uint64_t mask)
403{423{
libavutil/channel_layout.h+17−0
@@ -617,6 +617,23 @@ void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_i · 616 unmodified lines
617 */617 */
618enum AVChannel av_channel_from_string(const char *name);618enum AVChannel av_channel_from_string(const char *name);
619 619
620/**
621 * Initialize a custom channel layout with the specified number of channels.
622 * The channel map will be allocated and the designation of all channels will
623 * be set to AV_CHAN_UNKNOWN.
624 *
625 * This is only a convenience helper function, a custom channel layout can also
626 * be constructed without using this.
627 *
628 * @param channel_layout the layout structure to be initialized
629 * @param nb_channels the number of channels
630 *
631 * @return 0 on success
632 * AVERROR(EINVAL) if the number of channels <= 0
633 * AVERROR(ENOMEM) if the channel map could not be allocated
634 */
635int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels);
636
620/**637/**
621 * Initialize a native channel layout from a bitmask indicating which channels638 * Initialize a native channel layout from a bitmask indicating which channels
622 * are present.639 * are present.
libavutil/version.h+2−2
@@ -79,8 +79,8 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5881#define LIBAVUTIL_VERSION_MAJOR 58
82#define LIBAVUTIL_VERSION_MINOR 3682#define LIBAVUTIL_VERSION_MINOR 37
83#define LIBAVUTIL_VERSION_MICRO 10183#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
86 LIBAVUTIL_VERSION_MINOR, \86 LIBAVUTIL_VERSION_MINOR, \

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