1 /*****************************************************************************
2  * lwlibav_audio_internal.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 typedef struct
24 {
25     int64_t  pts;
26     int64_t  dts;
27     int64_t  file_offset;
28     uint32_t sample_number;
29     int      extradata_index;
30     uint8_t  keyframe;
31     int      length;
32     int      sample_rate;
33 } audio_frame_info_t;
34 
35 struct lwlibav_audio_decode_handler_tag
36 {
37     /* common */
38     AVFormatContext    *format;
39     int                 stream_index;
40     int                 error;
41     lw_log_handler_t    lh;
42     lwlibav_extradata_handler_t exh;
43     AVCodecContext     *ctx;
44     AVIndexEntry       *index_entries;
45     int                 index_entries_count;
46     int                 lw_seek_flags;
47     int                 av_seek_flags;  /* unused */
48     int                 dv_in_avi;      /* 1 = 'DV in AVI Type-1', 0 = otherwise */
49     enum AVCodecID      codec_id;
50     const char        **preferred_decoder_names;
51     AVRational          time_base;
52     uint32_t            frame_count;
53     AVFrame            *frame_buffer;
54     audio_frame_info_t *frame_list;
55     /* */
56     AVPacket            packet;         /* for getting and freeing */
57     AVPacket            alter_packet;   /* for consumed by the decoder instead of 'packet'. */
58     uint32_t            frame_length;
59     uint32_t            last_frame_number;
60     uint64_t            pcm_sample_count;
61     uint64_t            next_pcm_sample_number;
62 };
63