avformat_internal.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. /*
  19. * APIs internal to the generic avformat layer.
  20. *
  21. * MUST NOT be included by individual muxers or demuxers.
  22. */
  23. #ifndef AVFORMAT_AVFORMAT_INTERNAL_H
  24. #define AVFORMAT_AVFORMAT_INTERNAL_H
  25. #include <stdint.h>
  26. #include "avformat.h"
  27. #define RELATIVE_TS_BASE (INT64_MAX - (1LL << 48))
  28. static av_always_inline int is_relative(int64_t ts)
  29. {
  30. return ts > (RELATIVE_TS_BASE - (1LL << 48));
  31. }
  32. /**
  33. * Wrap a given time stamp, if there is an indication for an overflow
  34. *
  35. * @param st stream
  36. * @param timestamp the time stamp to wrap
  37. * @return resulting time stamp
  38. */
  39. int64_t ff_wrap_timestamp(const AVStream *st, int64_t timestamp);
  40. typedef struct FFStreamGroup {
  41. /**
  42. * The public context.
  43. */
  44. AVStreamGroup pub;
  45. AVFormatContext *fmtctx;
  46. } FFStreamGroup;
  47. static av_always_inline FFStreamGroup *ffstreamgroup(AVStreamGroup *stg)
  48. {
  49. return (FFStreamGroup*)stg;
  50. }
  51. static av_always_inline const FFStreamGroup *cffstreamgroup(const AVStreamGroup *stg)
  52. {
  53. return (const FFStreamGroup*)stg;
  54. }
  55. void ff_flush_packet_queue(AVFormatContext *s);
  56. const struct AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
  57. enum AVCodecID codec_id);
  58. /**
  59. * Frees a stream without modifying the corresponding AVFormatContext.
  60. * Must only be called if the latter doesn't matter or if the stream
  61. * is not yet attached to an AVFormatContext.
  62. */
  63. void ff_free_stream(AVStream **st);
  64. /**
  65. * Frees a stream group without modifying the corresponding AVFormatContext.
  66. * Must only be called if the latter doesn't matter or if the stream
  67. * is not yet attached to an AVFormatContext.
  68. */
  69. void ff_free_stream_group(AVStreamGroup **pstg);
  70. int ff_is_intra_only(enum AVCodecID id);
  71. struct FFOutputFormat;
  72. struct FFInputFormat;
  73. void avpriv_register_devices(const struct FFOutputFormat * const o[],
  74. const struct FFInputFormat * const i[]);
  75. #endif // AVFORMAT_AVFORMAT_INTERNAL_H