diff options
author | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-03-25 22:47:09 +0000 |
---|---|---|
committer | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-03-25 22:47:09 +0000 |
commit | 7beeedc331aeac0cd812ee2b40fe5a63be9a04f2 (patch) | |
tree | 48d3b983c00fc38a36b1c50739c9b469bdb7a6cf /libmpdemux/demux_lavf.c | |
parent | f76031552b4e9e357687b6f1610de30124e08679 (diff) | |
download | mpv-7beeedc331aeac0cd812ee2b40fe5a63be9a04f2.tar.bz2 mpv-7beeedc331aeac0cd812ee2b40fe5a63be9a04f2.tar.xz |
various (de)muxer_lavf fixes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15012 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_lavf.c')
-rw-r--r-- | libmpdemux/demux_lavf.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 687e3a0a7e..6e2154762f 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -47,6 +47,8 @@ typedef struct lavf_priv_t{ extern void print_wave_header(WAVEFORMATEX *h); extern void print_video_header(BITMAPINFOHEADER *h); +int64_t ff_gcd(int64_t a, int64_t b); + static int mp_open(URLContext *h, const char *filename, int flags){ return 0; } @@ -129,7 +131,7 @@ int demux_open_lavf(demuxer_t *demuxer){ AVFormatContext *avfc; AVFormatParameters ap; lavf_priv_t *priv= demuxer->priv; - int i; + int i,g; char mp_filename[256]="mp:"; memset(&ap, 0, sizeof(AVFormatParameters)); @@ -193,6 +195,18 @@ int demux_open_lavf(demuxer_t *demuxer){ codec->extradata_size); } sh_audio->wf= wf; + sh_audio->audio.dwSampleSize= codec->block_align; + if(codec->frame_size && codec->sample_rate){ + sh_audio->audio.dwScale=codec->frame_size; + sh_audio->audio.dwRate= codec->sample_rate; + }else{ + sh_audio->audio.dwScale= codec->block_align ? codec->block_align*8 : 8; + sh_audio->audio.dwRate = codec->bit_rate; + } + g= ff_gcd(sh_audio->audio.dwScale, sh_audio->audio.dwRate); + sh_audio->audio.dwScale /= g; + sh_audio->audio.dwRate /= g; +// printf("sca:%d rat:%d fs:%d sr:%d ba:%d\n", sh_audio->audio.dwScale, sh_audio->audio.dwRate, codec->frame_size, codec->sample_rate, codec->block_align); sh_audio->ds= demuxer->audio; sh_audio->format= codec->codec_tag; sh_audio->channels= codec->channels; |