Mercurial > mplayer.hg
annotate libmpcodecs/ad_ffmpeg.c @ 36840:511047e8e0a2
Remove unnecessary casts.
author | ib |
---|---|
date | Tue, 25 Feb 2014 15:16:01 +0000 |
parents | a706bf2ed700 |
children | 4e00eb3f4c76 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
17 */ |
35863 | 18 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 |
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30379
diff
changeset
|
19 |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
20 #include <stdio.h> |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
21 #include <stdlib.h> |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
22 #include <unistd.h> |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
23 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
24 #include "config.h" |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
25 #include "mp_msg.h" |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
26 #include "help_mp.h" |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
27 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
28 #include "ad_internal.h" |
31986
9986a61354e6
Remove duplicated audio_output_channels extern variable declaration.
diego
parents:
31959
diff
changeset
|
29 #include "dec_audio.h" |
33871
30f5e5cd3676
Move code for setting up libav* logging callbacks from vd_ffmpeg to a
reimar
parents:
32997
diff
changeset
|
30 #include "av_helpers.h" |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24226
diff
changeset
|
31 #include "libaf/reorder_ch.h" |
32906
b623edea8e3c
Use samplefmt2affmt helper function in ad_ffmpeg.c
reimar
parents:
32768
diff
changeset
|
32 #include "fmt-conversion.h" |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
33 |
30504
cc27da5d7286
Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents:
30421
diff
changeset
|
34 static const ad_info_t info = |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
35 { |
7191
1eadce15446c
-afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents:
7180
diff
changeset
|
36 "FFmpeg/libavcodec audio decoders", |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
37 "ffmpeg", |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
38 "Nick Kurshev", |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
39 "ffmpeg.sf.net", |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
40 "" |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
41 }; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
42 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
43 LIBAD_EXTERN(ffmpeg) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
44 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
45 #define assert(x) |
5447 | 46 |
26069
1318e956c092
FFmpeg now uses different (unified) #include paths.
diego
parents:
25962
diff
changeset
|
47 #include "libavcodec/avcodec.h" |
34523 | 48 #include "libavutil/dict.h" |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
49 |
36369 | 50 struct adctx { |
51 int last_samplerate; | |
52 int srate_changed; | |
53 }; | |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
54 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
55 static int preinit(sh_audio_t *sh) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
56 { |
34743 | 57 sh->audio_out_minsize=AF_NCH*AVCODEC_MAX_AUDIO_FRAME_SIZE; |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
58 return 1; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
59 } |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
60 |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
61 static int setup_format(sh_audio_t *sh_audio, const AVCodecContext *lavc_context) |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
62 { |
32390
b33aed46ecda
Avoid printing AAC with SBR warning on every decode call, instead print
reimar
parents:
32387
diff
changeset
|
63 int broken_srate = 0; |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
64 int samplerate = lavc_context->sample_rate; |
35134 | 65 int sample_format = samplefmt2affmt(av_get_packed_sample_fmt(lavc_context->sample_fmt)); |
32906
b623edea8e3c
Use samplefmt2affmt helper function in ad_ffmpeg.c
reimar
parents:
32768
diff
changeset
|
66 if (!sample_format) |
b623edea8e3c
Use samplefmt2affmt helper function in ad_ffmpeg.c
reimar
parents:
32768
diff
changeset
|
67 sample_format = sh_audio->sample_format; |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
68 if(sh_audio->wf){ |
36369 | 69 struct adctx *c = lavc_context->opaque; |
70 c->srate_changed |= c->last_samplerate && c->last_samplerate != samplerate; | |
36372
c95bdc49af2e
ad_ffmpeg: fix commit fixing sample rate changes to actually work.
reimar
parents:
36369
diff
changeset
|
71 c->last_samplerate = samplerate; |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
72 // If the decoder uses the wrong number of channels all is lost anyway. |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
73 // sh_audio->channels=sh_audio->wf->nChannels; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
74 |
35715
8517826b0dbd
Replace CODEC_IDs their modern AV_-prefixed counterparts.
diego
parents:
35343
diff
changeset
|
75 if (lavc_context->codec_id == AV_CODEC_ID_AAC && |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
76 samplerate == 2*sh_audio->wf->nSamplesPerSec) { |
32390
b33aed46ecda
Avoid printing AAC with SBR warning on every decode call, instead print
reimar
parents:
32387
diff
changeset
|
77 broken_srate = 1; |
36369 | 78 } else if (sh_audio->wf->nSamplesPerSec && !c->srate_changed) |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
79 samplerate=sh_audio->wf->nSamplesPerSec; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
80 } |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
81 if (lavc_context->channels != sh_audio->channels || |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
82 samplerate != sh_audio->samplerate || |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
83 sample_format != sh_audio->sample_format) { |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
84 sh_audio->channels=lavc_context->channels; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
85 sh_audio->samplerate=samplerate; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
86 sh_audio->sample_format = sample_format; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
87 sh_audio->samplesize=af_fmt2bits(sh_audio->sample_format)/ 8; |
32390
b33aed46ecda
Avoid printing AAC with SBR warning on every decode call, instead print
reimar
parents:
32387
diff
changeset
|
88 if (broken_srate) |
b33aed46ecda
Avoid printing AAC with SBR warning on every decode call, instead print
reimar
parents:
32387
diff
changeset
|
89 mp_msg(MSGT_DECAUDIO, MSGL_WARN, |
b33aed46ecda
Avoid printing AAC with SBR warning on every decode call, instead print
reimar
parents:
32387
diff
changeset
|
90 "Ignoring broken container sample rate for AAC with SBR\n"); |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
91 return 1; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
92 } |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
93 return 0; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
94 } |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
95 |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
96 static int init(sh_audio_t *sh_audio) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
97 { |
29511
2c47c6dd92b5
Retry deciding to get audio parameters several times on errors, this avoids
reimar
parents:
29491
diff
changeset
|
98 int tries = 0; |
5447 | 99 int x; |
5480 | 100 AVCodecContext *lavc_context; |
101 AVCodec *lavc_codec; | |
34523 | 102 AVDictionary *opts = NULL; |
103 char tmpstr[50]; | |
5447 | 104 |
105 mp_msg(MSGT_DECAUDIO,MSGL_V,"FFmpeg's libavcodec audio codec\n"); | |
31959
f957f330aa6d
Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
diego
parents:
31926
diff
changeset
|
106 init_avcodec(); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29133
diff
changeset
|
107 |
31926
45966266392b
Remove pointless casts of avcodec_find_decoder_by_name() return value.
diego
parents:
31671
diff
changeset
|
108 lavc_codec = avcodec_find_decoder_by_name(sh_audio->codec->dll); |
5480 | 109 if(!lavc_codec){ |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
110 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_audio->codec->dll); |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
111 return 0; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
112 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29133
diff
changeset
|
113 |
33934
14a1ae73b01d
Updated usage of some deprecated functions in FFmpeg audio decoder.
reimar
parents:
33871
diff
changeset
|
114 lavc_context = avcodec_alloc_context3(lavc_codec); |
5480 | 115 sh_audio->context=lavc_context; |
36372
c95bdc49af2e
ad_ffmpeg: fix commit fixing sample rate changes to actually work.
reimar
parents:
36369
diff
changeset
|
116 lavc_context->opaque = av_mallocz(sizeof(struct adctx)); |
7940 | 117 |
34563 | 118 snprintf(tmpstr, sizeof(tmpstr), "%f", drc_level); |
34523 | 119 av_dict_set(&opts, "drc_scale", tmpstr, 0); |
24226
352d7d9422b5
Set sample_rate and bit_rate from sh_audio as fallback in case sh_audio->wf
reimar
parents:
24108
diff
changeset
|
120 lavc_context->sample_rate = sh_audio->samplerate; |
352d7d9422b5
Set sample_rate and bit_rate from sh_audio as fallback in case sh_audio->wf
reimar
parents:
24108
diff
changeset
|
121 lavc_context->bit_rate = sh_audio->i_bps * 8; |
8590 | 122 if(sh_audio->wf){ |
123 lavc_context->channels = sh_audio->wf->nChannels; | |
124 lavc_context->sample_rate = sh_audio->wf->nSamplesPerSec; | |
125 lavc_context->bit_rate = sh_audio->wf->nAvgBytesPerSec * 8; | |
126 lavc_context->block_align = sh_audio->wf->nBlockAlign; | |
27516
3364aef9a988
Fix compilation after libavcodec major version 52 changes
uau
parents:
26987
diff
changeset
|
127 lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample; |
8590 | 128 } |
36469
4eb54147c488
Set audio channel_layout from container when using FFmpeg decoder.
cehoyos
parents:
36392
diff
changeset
|
129 lavc_context->channel_layout = sh_audio->channel_layout; |
36770 | 130 if (audio_output_channels == 1) |
131 lavc_context->request_channel_layout = AV_CH_LAYOUT_MONO; | |
132 else if (audio_output_channels == 2) | |
133 lavc_context->request_channel_layout = AV_CH_LAYOUT_STEREO; | |
9547 | 134 lavc_context->codec_tag = sh_audio->format; //FOURCC |
8590 | 135 lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi |
7940 | 136 |
137 /* alloc extra data */ | |
8590 | 138 if (sh_audio->wf && sh_audio->wf->cbSize > 0) { |
17226
255b14c0bc36
malloc padding to avoid access beyond allocated memory
henry
parents:
16165
diff
changeset
|
139 lavc_context->extradata = av_mallocz(sh_audio->wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE); |
7940 | 140 lavc_context->extradata_size = sh_audio->wf->cbSize; |
32105 | 141 memcpy(lavc_context->extradata, sh_audio->wf + 1, |
7940 | 142 lavc_context->extradata_size); |
143 } | |
144 | |
14633 | 145 // for QDM2 |
146 if (sh_audio->codecdata_len && sh_audio->codecdata && !lavc_context->extradata) | |
147 { | |
148 lavc_context->extradata = av_malloc(sh_audio->codecdata_len); | |
149 lavc_context->extradata_size = sh_audio->codecdata_len; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29133
diff
changeset
|
150 memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29133
diff
changeset
|
151 lavc_context->extradata_size); |
14633 | 152 } |
153 | |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
154 /* open it */ |
34530 | 155 if (avcodec_open2(lavc_context, lavc_codec, &opts) < 0) { |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
156 mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec); |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
157 return 0; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
158 } |
34523 | 159 av_dict_free(&opts); |
29928
731ddb53dc92
when using -v, print also which lavc codec has been used, not
attila
parents:
29913
diff
changeset
|
160 mp_msg(MSGT_DECAUDIO,MSGL_V,"INFO: libavcodec \"%s\" init OK!\n", lavc_codec->name); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29133
diff
changeset
|
161 |
8101 | 162 // printf("\nFOURCC: 0x%X\n",sh_audio->format); |
163 if(sh_audio->format==0x3343414D){ | |
164 // MACE 3:1 | |
165 sh_audio->ds->ss_div = 2*3; // 1 samples/packet | |
35257 | 166 sh_audio->ds->ss_mul = sh_audio->wf ? 2*sh_audio->wf->nChannels : 2; // 1 byte*ch/packet |
8101 | 167 } else |
168 if(sh_audio->format==0x3643414D){ | |
169 // MACE 6:1 | |
170 sh_audio->ds->ss_div = 2*6; // 1 samples/packet | |
35257 | 171 sh_audio->ds->ss_mul = sh_audio->wf ? 2*sh_audio->wf->nChannels : 2; // 1 byte*ch/packet |
8101 | 172 } |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
173 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
174 // Decode at least 1 byte: (to get header filled) |
29511
2c47c6dd92b5
Retry deciding to get audio parameters several times on errors, this avoids
reimar
parents:
29491
diff
changeset
|
175 do { |
29512 | 176 x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size); |
29511
2c47c6dd92b5
Retry deciding to get audio parameters several times on errors, this avoids
reimar
parents:
29491
diff
changeset
|
177 } while (x <= 0 && tries++ < 5); |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
178 if(x>0) sh_audio->a_buffer_len=x; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
179 |
5480 | 180 sh_audio->i_bps=lavc_context->bit_rate/8; |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
181 if (sh_audio->wf && sh_audio->wf->nAvgBytesPerSec) |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
182 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
183 |
28955
ee06f3a8b0d5
Support FFmpeg codecs that decode to other formats than S16.
reimar
parents:
27700
diff
changeset
|
184 switch (lavc_context->sample_fmt) { |
35134 | 185 case AV_SAMPLE_FMT_U8: case AV_SAMPLE_FMT_U8P: |
186 case AV_SAMPLE_FMT_S16: case AV_SAMPLE_FMT_S16P: | |
187 case AV_SAMPLE_FMT_S32: case AV_SAMPLE_FMT_S32P: | |
188 case AV_SAMPLE_FMT_FLT: case AV_SAMPLE_FMT_FLTP: | |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
189 break; |
28955
ee06f3a8b0d5
Support FFmpeg codecs that decode to other formats than S16.
reimar
parents:
27700
diff
changeset
|
190 default: |
ee06f3a8b0d5
Support FFmpeg codecs that decode to other formats than S16.
reimar
parents:
27700
diff
changeset
|
191 return 0; |
ee06f3a8b0d5
Support FFmpeg codecs that decode to other formats than S16.
reimar
parents:
27700
diff
changeset
|
192 } |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
193 return 1; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
194 } |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
195 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
196 static void uninit(sh_audio_t *sh) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
197 { |
7940 | 198 AVCodecContext *lavc_context = sh->context; |
199 | |
200 if (avcodec_close(lavc_context) < 0) | |
5447 | 201 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantCloseCodec); |
36369 | 202 av_freep(&lavc_context->opaque); |
14431
0c10f923746e
change malloc and free to av_ variants where needed.
reimar
parents:
13427
diff
changeset
|
203 av_freep(&lavc_context->extradata); |
0c10f923746e
change malloc and free to av_ variants where needed.
reimar
parents:
13427
diff
changeset
|
204 av_freep(&lavc_context); |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
205 } |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
206 |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
207 static int control(sh_audio_t *sh,int cmd,void* arg, ...) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
208 { |
11977
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
209 AVCodecContext *lavc_context = sh->context; |
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
210 switch(cmd){ |
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
211 case ADCTRL_RESYNC_STREAM: |
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
212 avcodec_flush_buffers(lavc_context); |
30379
0140d505dd91
Reset the parser on seek. Should fix some cases of audio "blips" after seeking.
reimar
parents:
30272
diff
changeset
|
213 ds_clear_parser(sh->ds); |
11977
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
214 return CONTROL_TRUE; |
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
215 } |
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
216 return CONTROL_UNKNOWN; |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
217 } |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
218 |
35343
850d3a293e87
Use size_t instead of unsigned in address arithmetic.
upsuper
parents:
35342
diff
changeset
|
219 static av_always_inline void copy_samples_planar(size_t bps, |
850d3a293e87
Use size_t instead of unsigned in address arithmetic.
upsuper
parents:
35342
diff
changeset
|
220 size_t nb_samples, |
850d3a293e87
Use size_t instead of unsigned in address arithmetic.
upsuper
parents:
35342
diff
changeset
|
221 size_t nb_channels, |
35134 | 222 unsigned char *dst, |
223 unsigned char **src) | |
224 { | |
35343
850d3a293e87
Use size_t instead of unsigned in address arithmetic.
upsuper
parents:
35342
diff
changeset
|
225 size_t s, c, o = 0; |
35134 | 226 |
36392
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
227 #if HAVE_NEON |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
228 if (nb_channels == 2 && bps == 4) { |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
229 const unsigned char *src0 = src[0]; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
230 const unsigned char *src1 = src[1]; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
231 size_t aligned = nb_samples & ~7; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
232 const unsigned char *src0_end = src0 + aligned*bps; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
233 while (src0 < src0_end) { |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
234 __asm__ ( |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
235 "vld1.32 {q0}, [%0]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
236 "vld1.32 {q1}, [%1]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
237 "vld1.32 {q2}, [%0]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
238 "vld1.32 {q3}, [%1]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
239 "vst2.32 {q0,q1}, [%2]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
240 "vst2.32 {q2,q3}, [%2]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
241 : "+&r"(src0), "+&r"(src1), "+&r"(dst) |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
242 :: "q0", "q1", "q2", "q3", "memory"); |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
243 } |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
244 o += aligned*bps; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
245 nb_samples -= aligned; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
246 } else if (nb_channels == 2 && bps == 2) { |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
247 const unsigned char *src0 = src[0]; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
248 const unsigned char *src1 = src[1]; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
249 size_t aligned = nb_samples & ~15; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
250 const unsigned char *src0_end = src0 + aligned*bps; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
251 while (src0 < src0_end) { |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
252 __asm__ ( |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
253 "vld1.16 {q0}, [%0]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
254 "vld1.16 {q1}, [%1]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
255 "vld1.16 {q2}, [%0]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
256 "vld1.16 {q3}, [%1]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
257 "vst2.16 {q0,q1}, [%2]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
258 "vst2.16 {q2,q3}, [%2]!\n\t" |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
259 : "+&r"(src0), "+&r"(src1), "+&r"(dst) |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
260 :: "q0", "q1", "q2", "q3", "memory"); |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
261 } |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
262 o += aligned*bps; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
263 nb_samples -= aligned; |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
264 } |
741131acf556
Add ARM NEON optimization of common channel interleave cases.
reimar
parents:
36372
diff
changeset
|
265 #endif |
35134 | 266 for (s = 0; s < nb_samples; s++) { |
267 for (c = 0; c < nb_channels; c++) { | |
268 memcpy(dst, src[c] + o, bps); | |
269 dst += bps; | |
270 } | |
271 o += bps; | |
272 } | |
273 } | |
274 | |
275 static int copy_samples(AVCodecContext *avc, AVFrame *frame, | |
276 unsigned char *buf, int max_size) | |
277 { | |
278 int channels = avc->channels; | |
279 int sample_size = av_get_bytes_per_sample(avc->sample_fmt); | |
280 int size = channels * sample_size * frame->nb_samples; | |
281 | |
282 if (size > max_size) { | |
283 av_log(avc, AV_LOG_ERROR, | |
284 "Buffer overflow while decoding a single frame\n"); | |
285 return AVERROR(EINVAL); /* same as avcodec_decode_audio3 */ | |
286 } | |
287 /* TODO reorder channels at the same time */ | |
288 if (av_sample_fmt_is_planar(avc->sample_fmt)) { | |
289 switch (sample_size) { | |
290 case 1: | |
291 copy_samples_planar(1, frame->nb_samples, channels, | |
292 buf, frame->extended_data); | |
293 break; | |
294 case 2: | |
295 copy_samples_planar(2, frame->nb_samples, channels, | |
296 buf, frame->extended_data); | |
297 break; | |
298 case 4: | |
299 copy_samples_planar(4, frame->nb_samples, channels, | |
300 buf, frame->extended_data); | |
35342 | 301 break; |
35134 | 302 default: |
303 copy_samples_planar(sample_size, frame->nb_samples, channels, | |
304 buf, frame->extended_data); | |
305 } | |
306 } else { | |
307 memcpy(buf, frame->data[0], size); | |
308 } | |
309 return size; | |
310 } | |
311 | |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
312 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
313 { |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
314 unsigned char *start=NULL; |
35134 | 315 int y,len=-1, got_frame; |
36771 | 316 AVFrame *frame = av_frame_alloc(); |
35134 | 317 |
318 if (!frame) | |
319 return AVERROR(ENOMEM); | |
320 | |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
321 while(len<minlen){ |
29913 | 322 AVPacket pkt; |
23456 | 323 int len2=maxlen; |
18242
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
324 double pts; |
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
325 int x=ds_get_packet_pts(sh_audio->ds,&start, &pts); |
30088
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
326 if(x<=0) { |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
327 start = NULL; |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
328 x = 0; |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
329 ds_parse(sh_audio->ds, &start, &x, MP_NOPTS_VALUE, 0); |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
330 if (x <= 0) |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
331 break; // error |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
332 } else { |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
333 int in_size = x; |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
334 int consumed = ds_parse(sh_audio->ds, &start, &x, pts, 0); |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
335 sh_audio->ds->buffer_pos -= in_size - consumed; |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
336 } |
32942
e3dfc7e2b0f8
Fix dnet decoding with -ac ffac3, the data needs to be byte-swapped.
reimar
parents:
32906
diff
changeset
|
337 |
29913 | 338 av_init_packet(&pkt); |
339 pkt.data = start; | |
340 pkt.size = x; | |
18242
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
341 if (pts != MP_NOPTS_VALUE) { |
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
342 sh_audio->pts = pts; |
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
343 sh_audio->pts_bytes = 0; |
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
344 } |
35134 | 345 y=avcodec_decode_audio4(sh_audio->context, frame, &got_frame, &pkt); |
11977
efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
michael
parents:
9547
diff
changeset
|
346 //printf("return:%d samples_out:%d bitstream_in:%d sample_sum:%d\n", y, len2, x, len); fflush(stdout); |
32496
5376d7337fcf
Handle EAGAIN in ad_ffmpeg, this is necessary for LATM to work properly with
reimar
parents:
32390
diff
changeset
|
347 // LATM may need many packets to find mux info |
5376d7337fcf
Handle EAGAIN in ad_ffmpeg, this is necessary for LATM to work properly with
reimar
parents:
32390
diff
changeset
|
348 if (y == AVERROR(EAGAIN)) |
5376d7337fcf
Handle EAGAIN in ad_ffmpeg, this is necessary for LATM to work properly with
reimar
parents:
32390
diff
changeset
|
349 continue; |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
350 if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; } |
30272
c6c40936049c
We only need to disable seeking back in ad_ffmpeg when we actually _use_
reimar
parents:
30088
diff
changeset
|
351 if(!sh_audio->parser && y<x) |
30088
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
29928
diff
changeset
|
352 sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) |
35134 | 353 if (!got_frame) |
354 continue; | |
355 len2 = copy_samples(sh_audio->context, frame, buf, maxlen); | |
356 if (len2 < 0) | |
357 return len2; | |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
358 if(len2>0){ |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24226
diff
changeset
|
359 if (((AVCodecContext *)sh_audio->context)->channels >= 5) { |
33934
14a1ae73b01d
Updated usage of some deprecated functions in FFmpeg audio decoder.
reimar
parents:
33871
diff
changeset
|
360 int samplesize = av_get_bytes_per_sample(((AVCodecContext *) |
14a1ae73b01d
Updated usage of some deprecated functions in FFmpeg audio decoder.
reimar
parents:
33871
diff
changeset
|
361 sh_audio->context)->sample_fmt); |
29779
282ea4fbe87d
ad_ffmpeg: Fix channel layout for ffvorbis and ffaac
tack
parents:
29667
diff
changeset
|
362 reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_LAVC_DEFAULT, |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24226
diff
changeset
|
363 AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24226
diff
changeset
|
364 ((AVCodecContext *)sh_audio->context)->channels, |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29263
diff
changeset
|
365 len2 / samplesize, samplesize); |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
24226
diff
changeset
|
366 } |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
367 //len=len2;break; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
368 if(len<0) len=len2; else len+=len2; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
369 buf+=len2; |
23456 | 370 maxlen -= len2; |
18242
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
18150
diff
changeset
|
371 sh_audio->pts_bytes += len2; |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
372 } |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
373 mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"Decoded %d -> %d \n",y,len2); |
31671
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
374 |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
375 if (setup_format(sh_audio, sh_audio->context)) |
4541f1921482
Add support for parameter changes (e.g. channel count) during playback.
reimar
parents:
31220
diff
changeset
|
376 break; |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
377 } |
35134 | 378 |
36771 | 379 av_frame_free(&frame); |
5340
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
380 return len; |
0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
arpi
parents:
diff
changeset
|
381 } |