VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_es.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_es.h: Elementary stream formats descriptions
3 *****************************************************************************
4 * Copyright (C) 1999-2012 VLC authors and VideoLAN
5 *
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23#ifndef VLC_ES_H
24#define VLC_ES_H 1
25
26#include <vlc_common.h>
27#include <vlc_fourcc.h>
28#include <vlc_viewpoint.h>
29#include <vlc_replay_gain.h>
30
31/**
32 * \file
33 * This file defines the elementary streams format types
34 */
35
36/**
37 * video palette data
38 * \see video_format_t
39 * \see subs_format_t
40 */
41#define VIDEO_PALETTE_COLORS_MAX 256
42#define VIDEO_PALETTE_CLUT_COUNT 16
44struct video_palette_t
46 int i_entries; /**< number of in-use palette entries */
47 uint8_t palette[VIDEO_PALETTE_COLORS_MAX][4]; /**< 4-byte RGBA/YUVA palette */
48};
49
50/**
51 * Audio channel type
52 */
53typedef enum audio_channel_type_t
59/**
60 * Bit or bitfield from AOUT_CHANS_xxx values
61 */
62typedef uint16_t vlc_channel_mask;
64/**
65 * audio format description
66 */
67struct audio_format_t
69 vlc_fourcc_t i_format; /**< audio format fourcc */
70 unsigned int i_rate; /**< audio sample-rate */
72 /* Describes the channels configuration of the samples (ie. number of
73 * channels which are available in the buffer, and positions). */
76 /* Describes the chan mode, either set from the input
77 * (demux/codec/packetizer) or overridden by the user, used by audio
78 * filters. */
79 uint16_t i_chan_mode;
81 /* Channel type */
84 /* Optional - for A/52, SPDIF and DTS types : */
85 /* Bytes used by one compressed frame, depends on bitrate. */
86 unsigned int i_bytes_per_frame;
88 /* Number of sampleframes contained in one compressed frame. */
89 unsigned int i_frame_length;
90 /* Please note that it may be completely arbitrary - buffers are not
91 * obliged to contain a integral number of so-called "frames". It's
92 * just here for the division :
93 * buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
94 */
95
96 /* FIXME ? (used by the codecs) */
97 unsigned i_bitspersample;
98 unsigned i_blockalign;
99 uint8_t i_channels; /* must be <=32 */
101
102/* Values available for audio channels */
103#define AOUT_CHAN_CENTER 0x1
104#define AOUT_CHAN_LEFT 0x2
105#define AOUT_CHAN_RIGHT 0x4
106#define AOUT_CHAN_REARCENTER 0x10
107#define AOUT_CHAN_REARLEFT 0x20
108#define AOUT_CHAN_REARRIGHT 0x40
109#define AOUT_CHAN_MIDDLELEFT 0x100
110#define AOUT_CHAN_MIDDLERIGHT 0x200
111#define AOUT_CHAN_LFE 0x1000
113#define AOUT_CHANS_FRONT (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)
114#define AOUT_CHANS_MIDDLE (AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT)
115#define AOUT_CHANS_REAR (AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT)
116#define AOUT_CHANS_CENTER (AOUT_CHAN_CENTER | AOUT_CHAN_REARCENTER)
118#define AOUT_CHANS_STEREO AOUT_CHANS_2_0
119#define AOUT_CHANS_2_0 (AOUT_CHANS_FRONT)
120#define AOUT_CHANS_2_1 (AOUT_CHANS_FRONT | AOUT_CHAN_LFE)
121#define AOUT_CHANS_3_0 (AOUT_CHANS_FRONT | AOUT_CHAN_CENTER)
122#define AOUT_CHANS_3_1 (AOUT_CHANS_3_0 | AOUT_CHAN_LFE)
123#define AOUT_CHANS_4_0 (AOUT_CHANS_FRONT | AOUT_CHANS_REAR)
124#define AOUT_CHANS_4_1 (AOUT_CHANS_4_0 | AOUT_CHAN_LFE)
125#define AOUT_CHANS_5_0 (AOUT_CHANS_4_0 | AOUT_CHAN_CENTER)
126#define AOUT_CHANS_5_1 (AOUT_CHANS_5_0 | AOUT_CHAN_LFE)
127#define AOUT_CHANS_6_0 (AOUT_CHANS_4_0 | AOUT_CHANS_MIDDLE)
128#define AOUT_CHANS_7_0 (AOUT_CHANS_6_0 | AOUT_CHAN_CENTER)
129#define AOUT_CHANS_7_1 (AOUT_CHANS_5_1 | AOUT_CHANS_MIDDLE)
130#define AOUT_CHANS_8_1 (AOUT_CHANS_7_1 | AOUT_CHAN_REARCENTER)
132#define AOUT_CHANS_4_0_MIDDLE (AOUT_CHANS_FRONT | AOUT_CHANS_MIDDLE)
133#define AOUT_CHANS_4_CENTER_REAR (AOUT_CHANS_FRONT | AOUT_CHANS_CENTER)
134#define AOUT_CHANS_5_0_MIDDLE (AOUT_CHANS_4_0_MIDDLE | AOUT_CHAN_CENTER)
135#define AOUT_CHANS_6_1_MIDDLE (AOUT_CHANS_5_0_MIDDLE | AOUT_CHAN_REARCENTER | AOUT_CHAN_LFE)
137/* Maximum number of mapped channels (or the maximum of bits set in
138 * i_physical_channels) */
139#define AOUT_CHAN_MAX 9
140/* Maximum number of unmapped channels */
141#define INPUT_CHAN_MAX 64
143static const vlc_channel_mask vlc_chan_maps[] =
157/* Values available for i_chan_mode only */
158#define AOUT_CHANMODE_DUALMONO 0x1
159#define AOUT_CHANMODE_DOLBYSTEREO 0x2
160#define AOUT_CHANMODE_BINAURAL 0x4
162/**
163 * Picture orientation.
164 */
165typedef enum video_orientation_t
167 ORIENT_TOP_LEFT = 0, /**< Top line represents top, left column left. */
168 ORIENT_TOP_RIGHT, /**< Flipped horizontally */
169 ORIENT_BOTTOM_LEFT, /**< Flipped vertically */
170 ORIENT_BOTTOM_RIGHT, /**< Rotated 180 degrees */
171 ORIENT_LEFT_TOP, /**< Transposed */
172 ORIENT_LEFT_BOTTOM, /**< Rotated 90 degrees anti-clockwise */
173 ORIENT_RIGHT_TOP, /**< Rotated 90 degrees clockwise */
174 ORIENT_RIGHT_BOTTOM, /**< Anti-transposed */
175#define ORIENT_MAX ((size_t)ORIENT_RIGHT_BOTTOM)
186/** Convert EXIF orientation to enum video_orientation_t */
187#define ORIENT_FROM_EXIF(exif) ((0x57642310U >> (4 * ((exif) - 1))) & 7)
188/** Convert enum video_orientation_t to EXIF */
189#define ORIENT_TO_EXIF(orient) ((0x76853421U >> (4 * (orient))) & 15)
190/** If the orientation is natural or mirrored */
191#define ORIENT_IS_MIRROR(orient) vlc_parity(orient)
192/** If the orientation swaps dimensions */
193#define ORIENT_IS_SWAP(orient) (((orient) & 4) != 0)
194/** Applies horizontal flip to an orientation */
195#define ORIENT_HFLIP(orient) ((orient) ^ 1)
196/** Applies vertical flip to an orientation */
197#define ORIENT_VFLIP(orient) ((orient) ^ 2)
198/** Applies 180 degree rotation to an orientation */
199#define ORIENT_ROTATE_180(orient) ((orient) ^ 3)
201VLC_API void
203
204typedef enum video_transform_t
216typedef enum video_multiview_mode_t
218 /* No stereoscopy: 2D picture. */
219 MULTIVIEW_2D = 0,
221 /* Side-by-side with left eye first. */
224 /* Top-bottom with left eye first. */
227 /* Row sequential with left eye first. */
230 /* Column sequential with left eye first. */
233 /* Frame sequential with left eye first. */
236 /* Checkerboard pattern with left eye first. */
239#define MULTIVIEW_STEREO_MAX MULTIVIEW_STEREO_CHECKERBOARD
242/**
243 * Video projection mode.
244 */
245typedef enum video_projection_mode_t
253/**
254 * Video color primaries (a.k.a. chromacities)
255 */
256typedef enum video_color_primaries_t
265#define COLOR_PRIMARIES_SRGB COLOR_PRIMARIES_BT709
266#define COLOR_PRIMARIES_SMTPE_170 COLOR_PRIMARIES_BT601_525
267#define COLOR_PRIMARIES_SMTPE_240 COLOR_PRIMARIES_BT601_525 /* Only differs from 1e10-4 in white Y */
268#define COLOR_PRIMARIES_SMTPE_RP145 COLOR_PRIMARIES_BT601_525
269#define COLOR_PRIMARIES_EBU_3213 COLOR_PRIMARIES_BT601_625
270#define COLOR_PRIMARIES_BT470_BG COLOR_PRIMARIES_BT601_625
271#define COLOR_PRIMARIES_BT470_M COLOR_PRIMARIES_FCC1953
272#define COLOR_PRIMARIES_MAX COLOR_PRIMARIES_FCC1953
275/**
276 * Video transfer functions
277 */
278typedef enum video_transfer_func_t
282 TRANSFER_FUNC_SRGB /**< Gamma 2.2 */,
289#define TRANSFER_FUNC_BT2020 TRANSFER_FUNC_BT709
290#define TRANSFER_FUNC_SMPTE_170 TRANSFER_FUNC_BT709
291#define TRANSFER_FUNC_SMPTE_274 TRANSFER_FUNC_BT709
292#define TRANSFER_FUNC_SMPTE_293 TRANSFER_FUNC_BT709
293#define TRANSFER_FUNC_SMPTE_296 TRANSFER_FUNC_BT709
294#define TRANSFER_FUNC_ARIB_B67 TRANSFER_FUNC_HLG
295#define TRANSFER_FUNC_MAX TRANSFER_FUNC_HLG
298/**
299 * Video color space (i.e. YCbCr matrices)
300 */
301typedef enum video_color_space_t
307#define COLOR_SPACE_SRGB COLOR_SPACE_BT709
308#define COLOR_SPACE_SMPTE_170 COLOR_SPACE_BT601
309#define COLOR_SPACE_SMPTE_240 COLOR_SPACE_SMPTE_170
310#define COLOR_SPACE_MAX COLOR_SPACE_BT2020
313/**
314 * Video chroma location
315 */
316typedef enum video_chroma_location_t
319 CHROMA_LOCATION_LEFT, /**< Most common in MPEG-2 Video, H.264/265 */
320 CHROMA_LOCATION_CENTER, /**< Most common in MPEG-1 Video, JPEG */
325#define CHROMA_LOCATION_MAX CHROMA_LOCATION_BOTTOM_CENTER
328typedef enum video_color_range_t
333#define COLOR_RANGE_STUDIO COLOR_RANGE_LIMITED
334#define COLOR_RANGE_MAX COLOR_RANGE_LIMITED
337/**
338 * video format description
339 */
340struct video_format_t
342 vlc_fourcc_t i_chroma; /**< picture chroma */
344 unsigned int i_width; /**< picture width */
345 unsigned int i_height; /**< picture height */
346 unsigned int i_x_offset; /**< start offset of visible area */
347 unsigned int i_y_offset; /**< start offset of visible area */
348 unsigned int i_visible_width; /**< width of visible area */
349 unsigned int i_visible_height; /**< height of visible area */
351 unsigned int i_sar_num; /**< sample/pixel aspect ratio */
352 unsigned int i_sar_den;
354 unsigned int i_frame_rate; /**< frame rate numerator */
355 unsigned int i_frame_rate_base; /**< frame rate denominator */
357 video_palette_t *p_palette; /**< video palette from demuxer */
358 video_orientation_t orientation; /**< picture orientation */
359 video_color_primaries_t primaries; /**< color primaries */
360 video_transfer_func_t transfer; /**< transfer function */
361 video_color_space_t space; /**< YCbCr color space */
362 video_color_range_t color_range; /**< 0-255 instead of 16-235 */
363 video_chroma_location_t chroma_location; /**< YCbCr chroma location */
365 video_multiview_mode_t multiview_mode; /** Multiview mode, 2D, 3D */
366 bool b_multiview_right_eye_first; /** Multiview left or right eye first*/
368 video_projection_mode_t projection_mode; /**< projection mode */
370 struct {
371 /* similar to SMPTE ST 2086 mastering display color volume */
372 uint16_t primaries[3*2]; /* G,B,R / x,y */
373 uint16_t white_point[2]; /* x,y */
377 struct {
378 /* similar to CTA-861.3 content light level */
379 uint16_t MaxCLL; /* max content light level */
380 uint16_t MaxFALL; /* max frame average light level */
382 struct {
383 uint8_t version_major;
385 unsigned profile : 7;
386 unsigned level : 6;
387 unsigned rpu_present : 1;
388 unsigned el_present : 1;
389 unsigned bl_present : 1;
391 unsigned md_compression : 2;
393 uint32_t i_cubemap_padding; /**< padding in pixels of the cube map faces */
395
396/**
397 * Initialize a video_format_t structure with chroma 'i_chroma'
398 * \param p_src pointer to video_format_t structure
399 * \param i_chroma chroma value to use
400 */
401static inline void video_format_Init( video_format_t *p_src, vlc_fourcc_t i_chroma )
403 memset( p_src, 0, sizeof( video_format_t ) );
404 p_src->i_chroma = i_chroma;
405 vlc_viewpoint_init( &p_src->pose );
406}
407
408/**
409 * Copy video_format_t including the palette
410 * \param p_dst video_format_t to copy to
411 * \param p_src video_format_t to copy from
412 */
413static inline int video_format_Copy( video_format_t *p_dst, const video_format_t *p_src )
415 memcpy( p_dst, p_src, sizeof( *p_dst ) );
416 if( p_src->p_palette )
417 {
418 p_dst->p_palette = (video_palette_t *) malloc( sizeof( video_palette_t ) );
419 if( !p_dst->p_palette )
420 return VLC_ENOMEM;
421 memcpy( p_dst->p_palette, p_src->p_palette, sizeof( *p_dst->p_palette ) );
422 }
423 return VLC_SUCCESS;
424}
425
426static inline void video_format_AdjustColorSpace( video_format_t *p_fmt )
428 if ( p_fmt->primaries == COLOR_PRIMARIES_UNDEF )
429 {
430 if ( p_fmt->i_visible_height > 576 ) // HD
432 else if ( p_fmt->i_visible_height > 525 ) // PAL
434 else
436 }
437
438 if ( p_fmt->transfer == TRANSFER_FUNC_UNDEF )
439 {
440 if ( p_fmt->i_visible_height > 576 ) // HD
442 else
444 }
445
446 if ( p_fmt->space == COLOR_SPACE_UNDEF )
447 {
448 if ( p_fmt->i_visible_height > 576 ) // HD
449 p_fmt->space = COLOR_SPACE_BT709;
450 else
451 p_fmt->space = COLOR_SPACE_BT601;
452 }
453
454 if ( p_fmt->color_range == COLOR_RANGE_UNDEF )
455 {
456 if ( vlc_fourcc_IsYUV(p_fmt->i_chroma) )
458 else
460 }
461}
462
463/**
464 * Cleanup and free palette of this video_format_t
465 * \param p_src video_format_t structure to clean
466 */
467static inline void video_format_Clean( video_format_t *p_src )
469 free( p_src->p_palette );
470 memset( p_src, 0, sizeof( video_format_t ) );
471}
472
473/**
474 * It will fill up a video_format_t using the given arguments.
475 * Note that the video_format_t must already be initialized.
476 */
478 int i_width, int i_height, int i_visible_width, int i_visible_height,
479 int i_sar_num, int i_sar_den );
480
481/**
482 * It will copy the crop properties from a video_format_t to another.
483 */
485
486static inline void video_format_CopyCropAr(video_format_t *dst,
487 const video_format_t *src)
488{
489 video_format_CopyCrop(dst, src);
490 dst->i_sar_num = src->i_sar_num;
491 dst->i_sar_den = src->i_sar_den;
492}
493
494/**
495 * It will compute the crop/ar properties when scaling.
496 */
498
499/**
500 * This function "normalizes" the formats orientation, by switching the a/r according to the orientation,
501 * producing a format whose orientation is ORIENT_NORMAL. It makes a shallow copy (palette is not alloc'ed).
502 */
504 const video_format_t *in);
505
506/**
507 * This function applies the transform operation to fmt.
508 */
510
511/**
512 * This function applies the transforms necessary to fmt so that the resulting fmt
513 * has the dst_orientation.
514 */
517/**
518 * Returns the operation required to transform src into dst.
519 */
521
522/**
523 * This function will check if the first video format is similar
524 * to the second one.
525 */
527
528/** Checks whether the video formats have the same chroma */
529static inline bool video_format_IsSameChroma( const video_format_t *f1, const video_format_t *f2 )
531 return f1->i_chroma == f2->i_chroma;
532}
533
534/**
535 * It prints details about the given video_format_t
536 */
537VLC_API void video_format_Print( vlc_object_t *, const char *, const video_format_t * );
538
539
542 switch ( transform ) {
543 case TRANSFORM_R90:
544 return TRANSFORM_R270;
545 case TRANSFORM_R270:
546 return TRANSFORM_R90;
547 default:
548 return transform;
549 }
550}
551
552
553/**
554 * subtitles format description
555 */
556struct subs_format_t
558 /* the character encoding of the text of the subtitle.
559 * all gettext recognized shorts can be used */
560 char *psz_encoding;
562
563 struct
564 {
565 /* the width of the original movie the spu was extracted from */
566 unsigned i_original_frame_width;
567 /* the height of the original movie the spu was extracted from */
570 /* */
571 uint32_t palette[VIDEO_PALETTE_CLUT_COUNT]; /* CLUT Palette AYVU */
575 struct
576 {
577 int i_id;
579 struct
580 {
581 uint8_t i_magazine; /* magazine value (3 bits), > 8 for any */
582 uint8_t i_page; /* BCD packet address value (4+4 bits) */
584 struct
585 {
586 uint8_t i_channel;
587 /* Reorder depth of transport video, -1 for no reordering */
588 int i_reorder_depth;
589 } cc;
591 /* track marked as forced */
592 bool b_forced;
594
595/**
596 * ES language definition
597 */
598typedef struct extra_languages_t
604/** ES Categories */
607 UNKNOWN_ES = 0x00,
613#define ES_CATEGORY_COUNT (DATA_ES + 1)
615/**
616 * ES format definition
617 */
618#define ES_PRIORITY_NOT_SELECTABLE -2
619#define ES_PRIORITY_NOT_DEFAULTABLE -1
620#define ES_PRIORITY_SELECTABLE_MIN 0
621#define ES_PRIORITY_MIN ES_PRIORITY_NOT_SELECTABLE
624 enum es_format_category_e i_cat; /**< ES category */
625 vlc_fourcc_t i_codec; /**< FOURCC value as used in vlc */
626 vlc_fourcc_t i_original_fourcc; /**< original FOURCC from the container */
628 int i_id; /**< es identifier, where means
629 -1: let the core mark the right id
630 >=0: valid id */
631 int i_group; /**< group identifier, where means:
632 -1 : standalone
633 >= 0 then a "group" (program) is created
634 for each value */
635 int i_priority; /**< priority, where means:
636 -2 : mean not selectable by the users
637 -1 : mean not selected by default even
638 when no other stream
639 >=0: priority */
640
641 char *psz_language; /**< human-readable language name */
642 char *psz_description; /**< human-readable description of language */
643 unsigned i_extra_languages; /**< length in bytes of extra language data pointer */
644 extra_languages_t *p_extra_languages; /**< extra language data needed by some decoders */
646 union {
647 struct {
648 audio_format_t audio; /**< description of audio format */
649 audio_replay_gain_t audio_replay_gain; /**< audio replay gain information */
650 };
651 video_format_t video; /**< description of video format */
652 subs_format_t subs; /**< description of subtitle format */
653 };
654
655 unsigned int i_bitrate; /**< bitrate of this ES */
656 int i_profile; /**< codec specific information (like real audio flavor, mpeg audio layer, h264 profile ...) */
657 int i_level; /**< codec specific information: indicates maximum restrictions on the stream (resolution, bitrate, codec features ...) */
659 bool b_packetized; /**< whether the data is packetized (ie. not truncated) */
660 size_t i_extra; /**< length in bytes of extra data pointer */
661 void *p_extra; /**< extra data needed by some decoders or muxers */
663};
664
665/**
666 * This function will initialize a es_format_t structure.
667 */
669
670/**
671 * This function will initialize a es_format_t structure from a video_format_t.
672 */
674
675/**
676 * This functions will copy a es_format_t.
677 */
678VLC_API int es_format_Copy( es_format_t *p_dst, const es_format_t *p_src );
680/**
681 * This function will clean up a es_format_t and release all associated
682 * resources.
683 * You can call it multiple times on the same structure.
684 */
686
687/**
688 * This function will check if the first ES format is similar
689 * to the second one.
690 *
691 * All descriptive fields are ignored.
692 */
693VLC_API bool es_format_IsSimilar( const es_format_t *, const es_format_t * );
694
695/**
696 * Log differences between 2 ES format.
697 * The difference checks the same fields as \ref es_format_IsSimilar
698 */
700 const char *name_a, const es_format_t *a,
701 const char *name_b, const es_format_t *b);
702/**
703 * Log differences between 2 video format.
704 * The difference checks the same fields as \ref video_format_IsSimilar
705 */
707 const char *name_a, const video_format_t *a,
708 const char *name_b, const video_format_t *b);
709
710/**
711 * Changes ES format to another category
712 * Format must have been properly initialized
713 */
714static inline void es_format_Change( es_format_t *fmt, int i_cat, vlc_fourcc_t i_codec )
716 es_format_Clean( fmt );
717 es_format_Init( fmt, i_cat, i_codec );
718}
719
720/**
721 * Increase the ES track id reference count.
722 *
723 * Any held ES tracks must be released with vlc_es_id_Release().
724 *
725 * @param es pointer to the ES id
726 * @return the same ES pointer, for convenience
727 */
730
731/**
732 * Decrease the ES track id reference count.
733 *
734 * @param id pointer to the ES track id
735 */
736VLC_API void
738
739/**
740 * Get the ES track input id
741 *
742 * @param id pointer to the ES track id
743 * @return the ES track input id (always valid)
744 */
745VLC_API int
747
748/**
749 * Return whether the ES track identifier is stable
750 *
751 * An string identifier is stable when it is certified to be the same across
752 * different playback instances for the same ES track.
753 *
754 * @param id pointer to the ES track id
755 * @return true if stable
756 */
757VLC_API bool
759
760/**
761 * Get the unique string identifier
762 *
763 * This id could be used to identify a track across different playback
764 * instances. For example, it can be used to store a track selection
765 * preference in a database.
766 *
767 * @warning Check with vlc_es_id_IsStrIdStable() if the ES track is stable
768 * before saving it for a future usage.
769 *
770 * @param id pointer to the ES track id
771 * @return the ES track string identifier, can't be NULL, valid until id is
772 * released
773 */
774VLC_API const char *
776
777/**
778 * Get the ES category
779 *
780 * @param id pointer to the ES track id
781 * @return the es track category (always valid)
782 */
785
786/**
787 * Get the native endianness mask for a RGB fourcc
788 *
789 * @note the alpha mask is 0 when the chroma doesn't contain an alpha component.
790 *
791 * @return VLC_SUCCESS if the mask values were filled
792 */
793static inline int vlc_RGBChromaToMask( vlc_fourcc_t fcc, uint32_t *rmask,
794 uint32_t *gmask, uint32_t *bmask,
795 uint32_t *amask )
796{
797 switch(fcc)
798 {
799 case VLC_CODEC_BGRA:
800 *bmask = 0xff000000;
801 *gmask = 0x00ff0000;
802 *rmask = 0x0000ff00;
803 *amask = 0x000000ff;
804 break;
805 case VLC_CODEC_BGRX:
806 *bmask = 0xff000000;
807 *gmask = 0x00ff0000;
808 *rmask = 0x0000ff00;
809 *amask = 0;
810 break;
811 case VLC_CODEC_RGBA:
812 *rmask = 0xff000000;
813 *gmask = 0x00ff0000;
814 *bmask = 0x0000ff00;
815 *amask = 0x000000ff;
816 break;
817 case VLC_CODEC_RGBX:
818 *rmask = 0xff000000;
819 *gmask = 0x00ff0000;
820 *bmask = 0x0000ff00;
821 *amask = 0;
822 break;
823 case VLC_CODEC_ABGR:
824 *amask = 0xff000000;
825 *bmask = 0x00ff0000;
826 *gmask = 0x0000ff00;
827 *rmask = 0x000000ff;
828 break;
829 case VLC_CODEC_XBGR:
830 *amask = 0;
831 *bmask = 0x00ff0000;
832 *gmask = 0x0000ff00;
833 *rmask = 0x000000ff;
834 break;
835 case VLC_CODEC_ARGB:
836 *amask = 0xff000000;
837 *rmask = 0x00ff0000;
838 *gmask = 0x0000ff00;
839 *bmask = 0x000000ff;
840 break;
841 case VLC_CODEC_XRGB:
842 *amask = 0;
843 *rmask = 0x00ff0000;
844 *gmask = 0x0000ff00;
845 *bmask = 0x000000ff;
846 break;
847 default:
848 return VLC_EINVAL;
849 }
850 return VLC_SUCCESS;
851}
852
853static inline bool es_format_HasVpxAlpha(const es_format_t *es)
855 return es->i_level != -1 && (es->i_level & 0x1000) == 0x1000;
856}
857
858#endif
#define VLC_API
Definition fourcc_gen.c:31
uint32_t vlc_fourcc_t
The vlc_fourcc_t type.
Definition fourcc_gen.c:33
#define VLC_EINVAL
Bad variable value.
Definition vlc_common.h:490
#define VLC_ENOMEM
Not enough memory.
Definition vlc_common.h:484
#define VLC_SUCCESS
No error.
Definition vlc_common.h:480
vlc_fourcc_t i_codec
Definition image.c:576
static void transform(MD5_CONTEXT *ctx, const unsigned char *data)
Definition md5.c:84
audio format description
Definition vlc_es.h:69
unsigned int i_rate
audio sample-rate
Definition vlc_es.h:71
uint8_t i_channels
Definition vlc_es.h:100
unsigned i_blockalign
Definition vlc_es.h:99
unsigned int i_frame_length
Definition vlc_es.h:90
unsigned int i_bytes_per_frame
Definition vlc_es.h:87
audio_channel_type_t channel_type
Definition vlc_es.h:83
unsigned i_bitspersample
Definition vlc_es.h:98
uint16_t i_chan_mode
Definition vlc_es.h:80
vlc_channel_mask i_physical_channels
Definition vlc_es.h:75
vlc_fourcc_t i_format
audio format fourcc
Definition vlc_es.h:70
Audio replay gain.
Definition vlc_replay_gain.h:48
Definition vlc_es.h:624
char * psz_description
human-readable description of language
Definition vlc_es.h:643
int i_level
codec specific information: indicates maximum restrictions on the stream (resolution,...
Definition vlc_es.h:658
int i_id
es identifier, where means -1: let the core mark the right id >=0: valid id
Definition vlc_es.h:629
int i_profile
codec specific information (like real audio flavor, mpeg audio layer, h264 profile ....
Definition vlc_es.h:657
audio_format_t audio
description of audio format
Definition vlc_es.h:649
int i_group
group identifier, where means: -1 : standalone >= 0 then a "group" (program) is created for each valu...
Definition vlc_es.h:632
enum es_format_category_e i_cat
ES category.
Definition vlc_es.h:625
video_format_t video
description of video format
Definition vlc_es.h:652
int i_priority
priority, where means: -2 : mean not selectable by the users -1 : mean not selected by default even w...
Definition vlc_es.h:636
bool b_packetized
whether the data is packetized (ie.
Definition vlc_es.h:660
size_t i_extra
length in bytes of extra data pointer
Definition vlc_es.h:661
audio_replay_gain_t audio_replay_gain
audio replay gain information
Definition vlc_es.h:650
extra_languages_t * p_extra_languages
extra language data needed by some decoders
Definition vlc_es.h:645
void * p_extra
extra data needed by some decoders or muxers
Definition vlc_es.h:662
subs_format_t subs
description of subtitle format
Definition vlc_es.h:653
unsigned int i_bitrate
bitrate of this ES
Definition vlc_es.h:656
vlc_fourcc_t i_codec
FOURCC value as used in vlc.
Definition vlc_es.h:626
char * psz_language
human-readable language name
Definition vlc_es.h:642
vlc_fourcc_t i_original_fourcc
original FOURCC from the container
Definition vlc_es.h:627
unsigned i_extra_languages
length in bytes of extra language data pointer
Definition vlc_es.h:644
ES language definition.
Definition vlc_es.h:600
char * psz_description
Definition vlc_es.h:602
char * psz_language
Definition vlc_es.h:601
subtitles format description
Definition vlc_es.h:558
struct subs_format_t::@054270171072232374122263070323131367027146321011 dvb
int i_reorder_depth
Definition vlc_es.h:589
char * psz_encoding
Definition vlc_es.h:561
bool b_palette
Definition vlc_es.h:573
struct subs_format_t::@205150001260223221233351157042320247065217376362 cc
uint8_t i_magazine
Definition vlc_es.h:582
int i_id
Definition vlc_es.h:578
uint32_t palette[16]
Definition vlc_es.h:572
struct subs_format_t::@326161042043134345143252335074030242327376155301 spu
struct subs_format_t::@063324172316107005004361116331044241211354002203 teletext
uint8_t i_page
Definition vlc_es.h:583
uint8_t i_channel
Definition vlc_es.h:587
bool b_forced
Definition vlc_es.h:593
unsigned i_original_frame_width
Definition vlc_es.h:567
unsigned i_original_frame_height
Definition vlc_es.h:569
video format description
Definition vlc_es.h:342
video_color_range_t color_range
0-255 instead of 16-235
Definition vlc_es.h:363
video_projection_mode_t projection_mode
Multiview left or right eye first.
Definition vlc_es.h:369
struct video_format_t::@133217257325001254111065077347357335251177210356 lighting
unsigned int i_height
picture height
Definition vlc_es.h:346
unsigned int i_y_offset
start offset of visible area
Definition vlc_es.h:348
unsigned int i_visible_width
width of visible area
Definition vlc_es.h:349
struct video_format_t::@077347217045303115323101027121073367311254221075 mastering
unsigned bl_signal_compatibility_id
Definition vlc_es.h:391
unsigned int i_sar_den
Definition vlc_es.h:353
uint16_t MaxCLL
Definition vlc_es.h:380
unsigned int i_frame_rate
frame rate numerator
Definition vlc_es.h:355
unsigned el_present
Definition vlc_es.h:389
video_orientation_t orientation
picture orientation
Definition vlc_es.h:359
unsigned md_compression
Definition vlc_es.h:392
uint32_t max_luminance
Definition vlc_es.h:375
video_palette_t * p_palette
video palette from demuxer
Definition vlc_es.h:358
bool b_multiview_right_eye_first
Multiview mode, 2D, 3D.
Definition vlc_es.h:367
video_color_space_t space
YCbCr color space.
Definition vlc_es.h:362
unsigned rpu_present
Definition vlc_es.h:388
struct video_format_t::@266173272361305325136317311172172215134335063345 dovi
vlc_viewpoint_t pose
Definition vlc_es.h:370
uint8_t version_minor
Definition vlc_es.h:385
unsigned level
Definition vlc_es.h:387
unsigned int i_x_offset
start offset of visible area
Definition vlc_es.h:347
uint8_t version_major
Definition vlc_es.h:384
unsigned bl_present
Definition vlc_es.h:390
video_multiview_mode_t multiview_mode
Definition vlc_es.h:366
unsigned profile
Definition vlc_es.h:386
unsigned int i_width
picture width
Definition vlc_es.h:345
unsigned int i_visible_height
height of visible area
Definition vlc_es.h:350
uint32_t i_cubemap_padding
padding in pixels of the cube map faces
Definition vlc_es.h:394
uint16_t MaxFALL
Definition vlc_es.h:381
uint16_t white_point[2]
Definition vlc_es.h:374
unsigned int i_sar_num
sample/pixel aspect ratio
Definition vlc_es.h:352
unsigned int i_frame_rate_base
frame rate denominator
Definition vlc_es.h:356
video_chroma_location_t chroma_location
YCbCr chroma location.
Definition vlc_es.h:364
uint32_t min_luminance
Definition vlc_es.h:376
vlc_fourcc_t i_chroma
picture chroma
Definition vlc_es.h:343
video_color_primaries_t primaries
color primaries
Definition vlc_es.h:360
video_transfer_func_t transfer
transfer function
Definition vlc_es.h:361
Definition vlc_es.h:46
int i_entries
number of in-use palette entries
Definition vlc_es.h:47
uint8_t palette[256][4]
4-byte RGBA/YUVA palette
Definition vlc_es.h:48
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:104
Definition vlc_messages.h:125
VLC object common members.
Definition vlc_objects.h:53
Viewpoints.
Definition vlc_viewpoint.h:41
This file is a collection of common definitions and types.
static video_transform_t transform_Inverse(video_transform_t transform)
Definition vlc_es.h:541
video_projection_mode_t
Video projection mode.
Definition vlc_es.h:247
@ PROJECTION_MODE_EQUIRECTANGULAR
Definition vlc_es.h:249
@ PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD
Definition vlc_es.h:251
@ PROJECTION_MODE_RECTANGULAR
Definition vlc_es.h:248
video_chroma_location_t
Video chroma location.
Definition vlc_es.h:318
@ CHROMA_LOCATION_CENTER
Most common in MPEG-1 Video, JPEG.
Definition vlc_es.h:321
@ CHROMA_LOCATION_TOP_LEFT
Definition vlc_es.h:322
@ CHROMA_LOCATION_LEFT
Most common in MPEG-2 Video, H.264/265.
Definition vlc_es.h:320
@ CHROMA_LOCATION_UNDEF
Definition vlc_es.h:319
@ CHROMA_LOCATION_TOP_CENTER
Definition vlc_es.h:323
@ CHROMA_LOCATION_BOTTOM_CENTER
Definition vlc_es.h:325
@ CHROMA_LOCATION_BOTTOM_LEFT
Definition vlc_es.h:324
#define AOUT_CHANS_7_0
Definition vlc_es.h:129
static bool es_format_HasVpxAlpha(const es_format_t *es)
Definition vlc_es.h:854
video_color_space_t
Video color space (i.e.
Definition vlc_es.h:303
@ COLOR_SPACE_BT2020
Definition vlc_es.h:307
@ COLOR_SPACE_BT601
Definition vlc_es.h:305
@ COLOR_SPACE_BT709
Definition vlc_es.h:306
@ COLOR_SPACE_UNDEF
Definition vlc_es.h:304
#define AOUT_CHANS_5_0
Definition vlc_es.h:126
bool video_format_IsSimilar(const video_format_t *, const video_format_t *)
This function will check if the first video format is similar to the second one.
Definition es_format.c:209
es_format_category_e
ES Categories.
Definition vlc_es.h:607
@ SPU_ES
Definition vlc_es.h:611
@ UNKNOWN_ES
Definition vlc_es.h:608
@ DATA_ES
Definition vlc_es.h:612
@ AUDIO_ES
Definition vlc_es.h:610
@ VIDEO_ES
Definition vlc_es.h:609
#define AOUT_CHANS_3_0
Definition vlc_es.h:122
void es_format_Init(es_format_t *, int i_cat, vlc_fourcc_t i_codec)
This function will initialize a es_format_t structure.
Definition es_format.c:292
void video_format_ScaleCropAr(video_format_t *, const video_format_t *)
It will compute the crop/ar properties when scaling.
Definition es_format.c:61
video_orientation_t
Picture orientation.
Definition vlc_es.h:167
@ ORIENT_NORMAL
Definition vlc_es.h:178
@ ORIENT_LEFT_TOP
Transposed.
Definition vlc_es.h:172
@ ORIENT_RIGHT_TOP
Rotated 90 degrees clockwise.
Definition vlc_es.h:174
@ ORIENT_VFLIPPED
Definition vlc_es.h:182
@ ORIENT_ROTATED_180
Definition vlc_es.h:183
@ ORIENT_ANTI_TRANSPOSED
Definition vlc_es.h:180
@ ORIENT_RIGHT_BOTTOM
Anti-transposed.
Definition vlc_es.h:175
@ ORIENT_ROTATED_270
Definition vlc_es.h:184
@ ORIENT_TRANSPOSED
Definition vlc_es.h:179
@ ORIENT_BOTTOM_RIGHT
Rotated 180 degrees.
Definition vlc_es.h:171
@ ORIENT_TOP_RIGHT
Flipped horizontally.
Definition vlc_es.h:169
@ ORIENT_HFLIPPED
Definition vlc_es.h:181
@ ORIENT_ROTATED_90
Definition vlc_es.h:185
@ ORIENT_LEFT_BOTTOM
Rotated 90 degrees anti-clockwise.
Definition vlc_es.h:173
@ ORIENT_BOTTOM_LEFT
Flipped vertically.
Definition vlc_es.h:170
@ ORIENT_TOP_LEFT
Top line represents top, left column left.
Definition vlc_es.h:168
#define AOUT_CHANS_8_1
Definition vlc_es.h:131
vlc_es_id_t * vlc_es_id_Hold(vlc_es_id_t *es)
Increase the ES track id reference count.
Definition es_out.c:5054
void video_format_ApplyRotation(video_format_t *out, const video_format_t *in)
This function "normalizes" the formats orientation, by switching the a/r according to the orientation...
void video_format_Print(vlc_object_t *, const char *, const video_format_t *)
It prints details about the given video_format_t.
Definition es_format.c:274
const char * vlc_es_id_GetStrId(vlc_es_id_t *id)
Get the unique string identifier.
Definition es_out.c:5079
bool es_format_IsSimilar(const es_format_t *, const es_format_t *)
This function will check if the first ES format is similar to the second one.
Definition es_format.c:415
static void video_format_Init(video_format_t *p_src, vlc_fourcc_t i_chroma)
Initialize a video_format_t structure with chroma 'i_chroma'.
Definition vlc_es.h:402
audio_channel_type_t
Audio channel type.
Definition vlc_es.h:55
@ AUDIO_CHANNEL_TYPE_AMBISONICS
Definition vlc_es.h:57
@ AUDIO_CHANNEL_TYPE_BITMAP
Definition vlc_es.h:56
void video_format_CopyCrop(video_format_t *, const video_format_t *)
It will copy the crop properties from a video_format_t to another.
Definition es_format.c:53
video_multiview_mode_t
Definition vlc_es.h:218
@ MULTIVIEW_STEREO_TB
Definition vlc_es.h:226
@ MULTIVIEW_STEREO_ROW
Definition vlc_es.h:229
@ MULTIVIEW_STEREO_CHECKERBOARD
Definition vlc_es.h:238
@ MULTIVIEW_STEREO_SBS
Definition vlc_es.h:223
@ MULTIVIEW_2D
Definition vlc_es.h:220
@ MULTIVIEW_STEREO_COL
Definition vlc_es.h:232
@ MULTIVIEW_STEREO_FRAME
Definition vlc_es.h:235
static const vlc_channel_mask vlc_chan_maps[]
Definition vlc_es.h:144
video_color_range_t
Definition vlc_es.h:330
@ COLOR_RANGE_FULL
Definition vlc_es.h:332
@ COLOR_RANGE_LIMITED
Definition vlc_es.h:333
@ COLOR_RANGE_UNDEF
Definition vlc_es.h:331
void video_format_LogDifferences(struct vlc_logger *log, const char *name_a, const video_format_t *a, const char *name_b, const video_format_t *b)
Log differences between 2 video format.
Definition es_format.c:233
video_color_primaries_t
Video color primaries (a.k.a.
Definition vlc_es.h:258
@ COLOR_PRIMARIES_BT601_625
Definition vlc_es.h:261
@ COLOR_PRIMARIES_BT601_525
Definition vlc_es.h:260
@ COLOR_PRIMARIES_FCC1953
Definition vlc_es.h:265
@ COLOR_PRIMARIES_BT2020
Definition vlc_es.h:263
@ COLOR_PRIMARIES_DCI_P3
Definition vlc_es.h:264
@ COLOR_PRIMARIES_UNDEF
Definition vlc_es.h:259
@ COLOR_PRIMARIES_BT709
Definition vlc_es.h:262
enum es_format_category_e vlc_es_id_GetCat(vlc_es_id_t *id)
Get the ES category.
Definition es_out.c:5085
static bool video_format_IsSameChroma(const video_format_t *f1, const video_format_t *f2)
Checks whether the video formats have the same chroma.
Definition vlc_es.h:530
video_transfer_func_t
Video transfer functions.
Definition vlc_es.h:280
@ TRANSFER_FUNC_BT709
Definition vlc_es.h:286
@ TRANSFER_FUNC_LINEAR
Definition vlc_es.h:282
@ TRANSFER_FUNC_BT470_M
Definition vlc_es.h:285
@ TRANSFER_FUNC_SRGB
Gamma 2.2.
Definition vlc_es.h:283
@ TRANSFER_FUNC_UNDEF
Definition vlc_es.h:281
@ TRANSFER_FUNC_HLG
Definition vlc_es.h:289
@ TRANSFER_FUNC_SMPTE_240
Definition vlc_es.h:288
@ TRANSFER_FUNC_BT470_BG
Definition vlc_es.h:284
@ TRANSFER_FUNC_SMPTE_ST2084
Definition vlc_es.h:287
static void video_format_AdjustColorSpace(video_format_t *p_fmt)
Definition vlc_es.h:427
static int video_format_Copy(video_format_t *p_dst, const video_format_t *p_src)
Copy video_format_t including the palette.
Definition vlc_es.h:414
void video_format_TransformBy(video_format_t *fmt, video_transform_t transform)
This function applies the transform operation to fmt.
Definition es_format.c:140
#define AOUT_CHANS_5_1
Definition vlc_es.h:127
void video_format_Setup(video_format_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_visible_width, int i_visible_height, int i_sar_num, int i_sar_den)
It will fill up a video_format_t using the given arguments.
Definition es_format.c:36
int es_format_Copy(es_format_t *p_dst, const es_format_t *p_src)
This functions will copy a es_format_t.
#define AOUT_CHANS_7_1
Definition vlc_es.h:130
void es_format_InitFromVideo(es_format_t *, const video_format_t *)
This function will initialize a es_format_t structure from a video_format_t.
Definition es_format.c:313
void es_format_Clean(es_format_t *fmt)
This function will clean up a es_format_t and release all associated resources.
Definition es_format.c:392
#define VIDEO_PALETTE_COLORS_MAX
video palette data
Definition vlc_es.h:42
bool vlc_es_id_IsStrIdStable(vlc_es_id_t *id)
Return whether the ES track identifier is stable.
Definition es_out.c:5073
static void es_format_Change(es_format_t *fmt, int i_cat, vlc_fourcc_t i_codec)
Changes ES format to another category Format must have been properly initialized.
Definition vlc_es.h:715
void es_format_LogDifferences(struct vlc_logger *, const char *name_a, const es_format_t *a, const char *name_b, const es_format_t *b)
Log differences between 2 ES format.
Definition es_format.c:462
#define AOUT_CHANS_4_0
Definition vlc_es.h:124
void video_format_TransformTo(video_format_t *fmt, video_orientation_t dst_orientation)
This function applies the transforms necessary to fmt so that the resulting fmt has the dst_orientati...
video_transform_t video_format_GetTransform(video_orientation_t src, video_orientation_t dst)
Returns the operation required to transform src into dst.
Definition es_format.c:124
uint16_t vlc_channel_mask
Bit or bitfield from AOUT_CHANS_xxx values.
Definition vlc_es.h:63
void vlc_viewpoint_from_orientation(vlc_viewpoint_t *vp, video_orientation_t orient)
Definition viewpoint.c:74
void vlc_es_id_Release(vlc_es_id_t *id)
Decrease the ES track id reference count.
Definition es_out.c:5061
static void video_format_Clean(video_format_t *p_src)
Cleanup and free palette of this video_format_t.
Definition vlc_es.h:468
#define VIDEO_PALETTE_CLUT_COUNT
Definition vlc_es.h:43
static void video_format_CopyCropAr(video_format_t *dst, const video_format_t *src)
Definition vlc_es.h:487
static int vlc_RGBChromaToMask(vlc_fourcc_t fcc, uint32_t *rmask, uint32_t *gmask, uint32_t *bmask, uint32_t *amask)
Get the native endianness mask for a RGB fourcc.
Definition vlc_es.h:794
#define AOUT_CHANS_2_0
Definition vlc_es.h:120
video_transform_t
Definition vlc_es.h:206
@ TRANSFORM_HFLIP
Definition vlc_es.h:208
@ TRANSFORM_R180
Definition vlc_es.h:210
@ TRANSFORM_TRANSPOSE
Definition vlc_es.h:213
@ TRANSFORM_ANTI_TRANSPOSE
Definition vlc_es.h:214
@ TRANSFORM_R90
Definition vlc_es.h:212
@ TRANSFORM_VFLIP
Definition vlc_es.h:209
@ TRANSFORM_IDENTITY
Definition vlc_es.h:207
@ TRANSFORM_R270
Definition vlc_es.h:211
int vlc_es_id_GetInputId(vlc_es_id_t *id)
Get the ES track input id.
Definition es_out.c:5067
#define AOUT_CHAN_CENTER
Definition vlc_es.h:104
#define VLC_CODEC_RGBA
Definition vlc_fourcc.h:415
#define VLC_CODEC_XBGR
Definition vlc_fourcc.h:357
#define VLC_CODEC_ABGR
Definition vlc_fourcc.h:421
#define VLC_CODEC_BGRA
Definition vlc_fourcc.h:419
#define VLC_CODEC_ARGB
Definition vlc_fourcc.h:417
#define VLC_CODEC_RGBX
Definition vlc_fourcc.h:353
static bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
It returns true if the given fourcc is YUV and false otherwise.
Definition vlc_fourcc.h:881
#define VLC_CODEC_XRGB
Definition vlc_fourcc.h:351
#define VLC_CODEC_BGRX
Definition vlc_fourcc.h:355
Video and audio viewpoint struct and helpers.
static void vlc_viewpoint_init(vlc_viewpoint_t *p_vp)
Definition vlc_viewpoint.h:48