mp4-mux.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /******************************************************************************
  2. Copyright (C) 2024 by Dennis Sädtler <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <obs.h>
  16. #include <util/serializer.h>
  17. struct mp4_mux;
  18. /* Flavor for target compatibility */
  19. enum mp4_flavor {
  20. FLAVOR_MP4, /* ISO/IEC 14496-12 */
  21. FLAVOR_MOV, /* Apple QuickTime */
  22. FLAVOR_CMAF, /* ISO/IEC 23000-19 (not yet implemented) */
  23. };
  24. enum mp4_mux_flags {
  25. /* Uses mdta key/value list for metadata instead of QuickTime keys */
  26. MP4_USE_MDTA_KEY_VALUE = 1 << 0,
  27. /* Write encoder configuration to trak udat */
  28. MP4_WRITE_ENCODER_INFO = 1 << 1,
  29. /* Skip "soft-remux" and leave file in fragmented state */
  30. MP4_SKIP_FINALISATION = 1 << 2,
  31. /* Use negative CTS instead of edit lists */
  32. MP4_USE_NEGATIVE_CTS = 1 << 3,
  33. };
  34. struct mp4_mux *mp4_mux_create(obs_output_t *output, struct serializer *serializer, enum mp4_mux_flags flags,
  35. enum mp4_flavor flavor);
  36. void mp4_mux_destroy(struct mp4_mux *mux);
  37. bool mp4_mux_submit_packet(struct mp4_mux *mux, struct encoder_packet *pkt);
  38. bool mp4_mux_add_chapter(struct mp4_mux *mux, int64_t dts_usec, const char *name);
  39. bool mp4_mux_finalise(struct mp4_mux *mux);