1 /***************************************************************************** 2 * lwlibav_audio.h 3 ***************************************************************************** 4 * Copyright (C) 2012-2015 L-SMASH Works project 5 * 6 * Authors: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> 7 * 8 * Permission to use, copy, modify, and/or distribute this software for any 9 * purpose with or without fee is hereby granted, provided that the above 10 * copyright notice and this permission notice appear in all copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 *****************************************************************************/ 20 21 /* This file is available under an ISC license. */ 22 23 /***************************************************************************** 24 * Opaque Handlers 25 *****************************************************************************/ 26 typedef lw_audio_output_handler_t lwlibav_audio_output_handler_t; 27 28 typedef struct lwlibav_audio_decode_handler_tag lwlibav_audio_decode_handler_t; 29 30 /***************************************************************************** 31 * Allocators / Deallocators 32 *****************************************************************************/ 33 lwlibav_audio_decode_handler_t *lwlibav_audio_alloc_decode_handler 34 ( 35 void 36 ); 37 38 lwlibav_audio_output_handler_t *lwlibav_audio_alloc_output_handler 39 ( 40 void 41 ); 42 43 void lwlibav_audio_free_decode_handler 44 ( 45 lwlibav_audio_decode_handler_t *adhp 46 ); 47 48 void lwlibav_audio_free_output_handler 49 ( 50 lwlibav_audio_output_handler_t *aohp 51 ); 52 53 void lwlibav_audio_free_decode_handler_ptr 54 ( 55 lwlibav_audio_decode_handler_t **adhpp 56 ); 57 58 void lwlibav_audio_free_output_handler_ptr 59 ( 60 lwlibav_audio_output_handler_t **aohpp 61 ); 62 63 /***************************************************************************** 64 * Setters 65 *****************************************************************************/ 66 void lwlibav_audio_set_preferred_decoder_names 67 ( 68 lwlibav_audio_decode_handler_t *adhp, 69 const char **preferred_decoder_names 70 ); 71 72 void lwlibav_audio_set_codec_context 73 ( 74 lwlibav_audio_decode_handler_t *adhp, 75 AVCodecContext *ctx 76 ); 77 78 /***************************************************************************** 79 * Getters 80 *****************************************************************************/ 81 const char **lwlibav_audio_get_preferred_decoder_names 82 ( 83 lwlibav_audio_decode_handler_t *adhp 84 ); 85 86 lw_log_handler_t *lwlibav_audio_get_log_handler 87 ( 88 lwlibav_audio_decode_handler_t *adhp 89 ); 90 91 AVCodecContext *lwlibav_audio_get_codec_context 92 ( 93 lwlibav_audio_decode_handler_t *adhp 94 ); 95 96 /***************************************************************************** 97 * Others 98 *****************************************************************************/ 99 void lwlibav_audio_force_seek 100 ( 101 lwlibav_audio_decode_handler_t *adhp 102 ); 103 104 int lwlibav_audio_get_desired_track 105 ( 106 const char *file_path, 107 lwlibav_audio_decode_handler_t *adhp, 108 int threads 109 ); 110 111 uint64_t lwlibav_audio_count_overall_pcm_samples 112 ( 113 lwlibav_audio_decode_handler_t *adhp, 114 int output_sample_rate 115 ); 116 117 uint64_t lwlibav_audio_get_pcm_samples 118 ( 119 lwlibav_audio_decode_handler_t *adhp, 120 lwlibav_audio_output_handler_t *aohp, 121 void *buf, 122 int64_t start, 123 int64_t wanted_length 124 ); 125