| 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 | |
| 27 | /** @file |
| 28 | * @ingroup decoder |
| 29 | * @ingroup encoder |
| 30 | * @brief Interface for @link decoder DV Decoder @endlink |
| 31 | */ |
| 32 | |
| 33 | /** @addtogroup decoder DV Decoder |
| 34 | * @{ |
| 35 | */ |
| 36 | |
| 37 | #ifndef DV_H |
| 38 | #define DV_H |
| 39 | |
| 40 | |
| 41 | #include <libdv/dv_types.h> |
| 42 | |
| 43 | #include <stdio.h> |
| 44 | #include <inttypes.h> |
| 45 | #include <time.h> |
| 46 | |
| 47 | #ifdef __cplusplus |
| 48 | extern "C" { |
| 49 | #endif |
| 50 | |
| 51 | /* Main API */ |
| 52 | extern dv_decoder_t *dv_decoder_new (int ignored, int clamp_luma, |
| 53 | int clamp_chroma); |
| 54 | extern void dv_decoder_free (dv_decoder_t*); |
| 55 | extern void dv_init (int clamp_luma, int clamp_chroma); |
| 56 | extern void dv_cleanup (void); |
| 57 | extern void dv_reconfigure (int clamp_luma, int clamp_chroma); |
| 58 | extern int dv_parse_header (dv_decoder_t *dv, const uint8_t *buffer); |
| 59 | extern void dv_parse_packs (dv_decoder_t *dv, const uint8_t *buffer); |
| 60 | extern void dv_decode_full_frame(dv_decoder_t *dv, |
| 61 | const uint8_t *buffer, dv_color_space_t color_space, |
| 62 | uint8_t **pixels, int *pitches); |
| 63 | extern int dv_decode_full_audio(dv_decoder_t *dv, |
| 64 | const uint8_t *buffer, int16_t **outbufs); |
| 65 | extern int dv_set_audio_correction (dv_decoder_t *dv, int method); |
| 66 | extern FILE *dv_set_error_log (dv_decoder_t *dv, FILE *errfile); |
| 67 | extern void dv_report_video_error (dv_decoder_t *dv, uint8_t *data); |
| 68 | |
| 69 | #define LIBDV_HAS_SAMPLE_CALCULATOR |
| 70 | extern int dv_calculate_samples( dv_encoder_t *, int frequency, |
| 71 | int frame_count ); |
| 72 | |
| 73 | /*@}*/ |
| 74 | |
| 75 | /** @addtogroup encoder |
| 76 | * @{ |
| 77 | */ |
| 78 | |
| 79 | extern dv_encoder_t *dv_encoder_new (int rem_ntsc_setup, int clamp_luma, |
| 80 | int clamp_chroma); |
| 81 | extern void dv_encoder_free (dv_encoder_t* dv_enc); |
| 82 | extern int dv_encode_full_frame(dv_encoder_t *dv_enc, uint8_t **in, |
| 83 | dv_color_space_t color_space, uint8_t *out); |
| 84 | |
| 85 | extern int dv_encode_full_audio(dv_encoder_t *dv_enc, int16_t **pcm, |
| 86 | int channels, int frequency, uint8_t *frame); |
| 87 | extern void dv_encode_metadata(uint8_t *target, int isPAL, int is16x9, |
| 88 | time_t *datetime, int frame); |
| 89 | extern void dv_encode_timecode(uint8_t *target, int isPAL, int frame); |
| 90 | |
| 91 | /*@}*/ |
| 92 | |
| 93 | /** @addtogroup decoder |
| 94 | * @{ |
| 95 | */ |
| 96 | |
| 97 | /* Low level API */ |
| 98 | extern int dv_parse_video_segment(dv_videosegment_t *seg, unsigned int quality); |
| 99 | extern void dv_decode_video_segment(dv_decoder_t *dv, dv_videosegment_t *seg, unsigned int quality); |
| 100 | |
| 101 | extern void dv_render_video_segment_rgb(dv_decoder_t *dv, dv_videosegment_t *seg, |
| 102 | uint8_t **pixels, int *pitches); |
| 103 | |
| 104 | extern void dv_render_video_segment_yuv(dv_decoder_t *dv, dv_videosegment_t *seg, |
| 105 | uint8_t **pixels, int *pitches); |
| 106 | |
| 107 | extern int dv_encode_videosegment( dv_encoder_t *dv_enc, |
| 108 | dv_videosegment_t *videoseg, uint8_t *vsbuffer); |
| 109 | |
| 110 | /* --------------------------------------------------------------------------- |
| 111 | */ |
| 112 | extern int dv_set_quality (dv_decoder_t *dv, int quality), |
| 113 | dv_is_PAL (dv_decoder_t *dv); |
| 114 | |
| 115 | /* --------------------------------------------------------------------------- |
| 116 | * functions based on vaux data |
| 117 | * return value: <0 unknown, 0 no, >0 yes |
| 118 | */ |
| 119 | extern int dv_frame_changed (dv_decoder_t *dv), |
| 120 | dv_frame_is_color (dv_decoder_t *dv), |
| 121 | dv_system_50_fields (dv_decoder_t *dv), |
| 122 | dv_format_normal (dv_decoder_t *dv), |
| 123 | dv_format_wide (dv_decoder_t *dv), |
| 124 | dv_format_letterbox (dv_decoder_t *dv), |
| 125 | dv_is_progressive (dv_decoder_t *dv), |
| 126 | dv_get_vaux_pack (dv_decoder_t *dv, uint8_t pack_id, uint8_t *pack_data); |
| 127 | |
| 128 | /* --------------------------------------------------------------------------- |
| 129 | * functions based on ssyb data |
| 130 | * return value: 0 not-present, >0 ok |
| 131 | */ |
| 132 | extern int dv_get_timestamp (dv_decoder_t *dv, char *tstprt), |
| 133 | dv_get_recording_datetime (dv_decoder_t *dv, char *dtptr), |
| 134 | dv_get_timestamp_int (dv_decoder_t *dv, int *timestamp), |
| 135 | dv_get_recording_datetime_tm (dv_decoder_t *dv, struct tm *rec_dt), |
| 136 | dv_get_ssyb_pack (dv_decoder_t *dv, uint8_t pack_id, uint8_t *pack_data); |
| 137 | |
| 138 | /* --------------------------------------------------------------------------- |
| 139 | * functions based on aaux data |
| 140 | */ |
| 141 | extern int dv_is_new_recording (dv_decoder_t *dv, const uint8_t *buffer), |
| 142 | dv_is_normal_speed (dv_decoder_t *dv), |
| 143 | dv_set_mixing_level (dv_decoder_t *dv, int new_value); |
| 144 | |
| 145 | /* --------------------------------------------------------------------------- |
| 146 | * audio query functions |
| 147 | */ |
| 148 | extern int dv_get_num_samples (dv_decoder_t *dv), |
| 149 | dv_get_num_channels (dv_decoder_t *dv), |
| 150 | dv_get_raw_samples (dv_decoder_t *dv, int chan), |
| 151 | dv_is_4ch (dv_decoder_t *dv), |
| 152 | dv_get_frequency (dv_decoder_t *dv); |
| 153 | |
| 154 | #ifdef __cplusplus |
| 155 | } |
| 156 | #endif |
| 157 | |
| 158 | #endif // DV_H |
| 159 | |
| 160 | /*@}*/ |