codec_desc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Codec descriptors public API
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_CODEC_DESC_H
  21. #define AVCODEC_CODEC_DESC_H
  22. #include "libavutil/avutil.h"
  23. #include "codec_id.h"
  24. /**
  25. * @addtogroup lavc_core
  26. * @{
  27. */
  28. /**
  29. * This struct describes the properties of a single codec described by an
  30. * AVCodecID.
  31. * @see avcodec_descriptor_get()
  32. */
  33. typedef struct AVCodecDescriptor {
  34. enum AVCodecID id;
  35. enum AVMediaType type;
  36. /**
  37. * Name of the codec described by this descriptor. It is non-empty and
  38. * unique for each codec descriptor. It should contain alphanumeric
  39. * characters and '_' only.
  40. */
  41. const char *name;
  42. /**
  43. * A more descriptive name for this codec. May be NULL.
  44. */
  45. const char *long_name;
  46. /**
  47. * Codec properties, a combination of AV_CODEC_PROP_* flags.
  48. */
  49. int props;
  50. /**
  51. * MIME type(s) associated with the codec.
  52. * May be NULL; if not, a NULL-terminated array of MIME types.
  53. * The first item is always non-NULL and is the preferred MIME type.
  54. */
  55. const char *const *mime_types;
  56. /**
  57. * If non-NULL, an array of profiles recognized for this codec.
  58. * Terminated with FF_PROFILE_UNKNOWN.
  59. */
  60. const struct AVProfile *profiles;
  61. } AVCodecDescriptor;
  62. /**
  63. * Codec uses only intra compression.
  64. * Video and audio codecs only.
  65. */
  66. #define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
  67. /**
  68. * Codec supports lossy compression. Audio and video codecs only.
  69. * @note a codec may support both lossy and lossless
  70. * compression modes
  71. */
  72. #define AV_CODEC_PROP_LOSSY (1 << 1)
  73. /**
  74. * Codec supports lossless compression. Audio and video codecs only.
  75. */
  76. #define AV_CODEC_PROP_LOSSLESS (1 << 2)
  77. /**
  78. * Codec supports frame reordering. That is, the coded order (the order in which
  79. * the encoded packets are output by the encoders / stored / input to the
  80. * decoders) may be different from the presentation order of the corresponding
  81. * frames.
  82. *
  83. * For codecs that do not have this property set, PTS and DTS should always be
  84. * equal.
  85. */
  86. #define AV_CODEC_PROP_REORDER (1 << 3)
  87. /**
  88. * Subtitle codec is bitmap based
  89. * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
  90. */
  91. #define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
  92. /**
  93. * Subtitle codec is text based.
  94. * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
  95. */
  96. #define AV_CODEC_PROP_TEXT_SUB (1 << 17)
  97. /**
  98. * @return descriptor for given codec ID or NULL if no descriptor exists.
  99. */
  100. const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
  101. /**
  102. * Iterate over all codec descriptors known to libavcodec.
  103. *
  104. * @param prev previous descriptor. NULL to get the first descriptor.
  105. *
  106. * @return next descriptor or NULL after the last descriptor
  107. */
  108. const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
  109. /**
  110. * @return codec descriptor with the given name or NULL if no such descriptor
  111. * exists.
  112. */
  113. const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
  114. /**
  115. * @}
  116. */
  117. #endif // AVCODEC_CODEC_DESC_H