dv.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * dv.h
  3. *
  4. * Copyright (C) Charles 'Buck' Krasic - April 2000
  5. * Copyright (C) Erik Walthinsen - April 2000
  6. *
  7. * This file is part of libdv, a free DV (IEC 61834/SMPTE 314M)
  8. * codec.
  9. *
  10. * libdv is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU Lesser Public License as published by
  12. * the Free Software Foundation; either version 2.1, or (at your
  13. * option) any later version.
  14. *
  15. * libdv is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser Public License
  21. * along with libdv; see the file COPYING. If not, write to
  22. * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. * The libdv homepage is http://libdv.sourceforge.net/.
  25. */
  26. /** @file
  27. * @ingroup decoder
  28. * @ingroup encoder
  29. * @brief Interface for @link decoder DV Decoder @endlink
  30. */
  31. /** @addtogroup decoder DV Decoder
  32. * @{
  33. */
  34. #ifndef DV_H
  35. #define DV_H
  36. #include <libdv/dv_types.h>
  37. #include <stdio.h>
  38. #include <inttypes.h>
  39. #include <time.h>
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Main API */
  44. extern dv_decoder_t *dv_decoder_new (int ignored, int clamp_luma,
  45. int clamp_chroma);
  46. extern void dv_decoder_free (dv_decoder_t*);
  47. extern void dv_init (int clamp_luma, int clamp_chroma);
  48. extern void dv_cleanup (void);
  49. extern void dv_reconfigure (int clamp_luma, int clamp_chroma);
  50. extern int dv_parse_header (dv_decoder_t *dv, const uint8_t *buffer);
  51. extern void dv_parse_packs (dv_decoder_t *dv, const uint8_t *buffer);
  52. extern void dv_decode_full_frame(dv_decoder_t *dv,
  53. const uint8_t *buffer, dv_color_space_t color_space,
  54. uint8_t **pixels, int *pitches);
  55. extern int dv_decode_full_audio(dv_decoder_t *dv,
  56. const uint8_t *buffer, int16_t **outbufs);
  57. extern int dv_set_audio_correction (dv_decoder_t *dv, int method);
  58. extern FILE *dv_set_error_log (dv_decoder_t *dv, FILE *errfile);
  59. extern void dv_report_video_error (dv_decoder_t *dv, uint8_t *data);
  60. #define LIBDV_HAS_SAMPLE_CALCULATOR
  61. extern int dv_calculate_samples( dv_encoder_t *, int frequency,
  62. int frame_count );
  63. /*@}*/
  64. /** @addtogroup encoder
  65. * @{
  66. */
  67. extern dv_encoder_t *dv_encoder_new (int rem_ntsc_setup, int clamp_luma,
  68. int clamp_chroma);
  69. extern void dv_encoder_free (dv_encoder_t* dv_enc);
  70. extern int dv_encode_full_frame(dv_encoder_t *dv_enc, uint8_t **in,
  71. dv_color_space_t color_space, uint8_t *out);
  72. extern int dv_encode_full_audio(dv_encoder_t *dv_enc, int16_t **pcm,
  73. int channels, int frequency, uint8_t *frame);
  74. extern void dv_encode_metadata(uint8_t *target, int isPAL, int is16x9,
  75. time_t *datetime, int frame);
  76. extern void dv_encode_timecode(uint8_t *target, int isPAL, int frame);
  77. /*@}*/
  78. /** @addtogroup decoder
  79. * @{
  80. */
  81. /* Low level API */
  82. extern int dv_parse_video_segment(dv_videosegment_t *seg, unsigned int quality);
  83. extern void dv_decode_video_segment(dv_decoder_t *dv, dv_videosegment_t *seg, unsigned int quality);
  84. extern void dv_render_video_segment_rgb(dv_decoder_t *dv, dv_videosegment_t *seg,
  85. uint8_t **pixels, int *pitches);
  86. extern void dv_render_video_segment_yuv(dv_decoder_t *dv, dv_videosegment_t *seg,
  87. uint8_t **pixels, int *pitches);
  88. extern int dv_encode_videosegment( dv_encoder_t *dv_enc,
  89. dv_videosegment_t *videoseg, uint8_t *vsbuffer);
  90. /* ---------------------------------------------------------------------------
  91. */
  92. extern int dv_set_quality (dv_decoder_t *dv, int quality),
  93. dv_is_PAL (dv_decoder_t *dv);
  94. /* ---------------------------------------------------------------------------
  95. * functions based on vaux data
  96. * return value: <0 unknown, 0 no, >0 yes
  97. */
  98. extern int dv_frame_changed (dv_decoder_t *dv),
  99. dv_frame_is_color (dv_decoder_t *dv),
  100. dv_system_50_fields (dv_decoder_t *dv),
  101. dv_format_normal (dv_decoder_t *dv),
  102. dv_format_wide (dv_decoder_t *dv),
  103. dv_format_letterbox (dv_decoder_t *dv),
  104. dv_is_progressive (dv_decoder_t *dv),
  105. dv_get_vaux_pack (dv_decoder_t *dv, uint8_t pack_id, uint8_t *pack_data);
  106. /* ---------------------------------------------------------------------------
  107. * functions based on ssyb data
  108. * return value: 0 not-present, >0 ok
  109. */
  110. extern int dv_get_timestamp (dv_decoder_t *dv, char *tstprt),
  111. dv_get_recording_datetime (dv_decoder_t *dv, char *dtptr),
  112. dv_get_timestamp_int (dv_decoder_t *dv, int *timestamp),
  113. dv_get_recording_datetime_tm (dv_decoder_t *dv, struct tm *rec_dt),
  114. dv_get_ssyb_pack (dv_decoder_t *dv, uint8_t pack_id, uint8_t *pack_data);
  115. /* ---------------------------------------------------------------------------
  116. * functions based on aaux data
  117. */
  118. extern int dv_is_new_recording (dv_decoder_t *dv, const uint8_t *buffer),
  119. dv_is_normal_speed (dv_decoder_t *dv),
  120. dv_set_mixing_level (dv_decoder_t *dv, int new_value);
  121. /* ---------------------------------------------------------------------------
  122. * audio query functions
  123. */
  124. extern int dv_get_num_samples (dv_decoder_t *dv),
  125. dv_get_num_channels (dv_decoder_t *dv),
  126. dv_get_raw_samples (dv_decoder_t *dv, int chan),
  127. dv_is_4ch (dv_decoder_t *dv),
  128. dv_get_frequency (dv_decoder_t *dv);
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132. #endif // DV_H
  133. /*@}*/