ffmpeg简易播放器-音视频同步


基于mfc对话框的ffmpeg简易播放器,是学习音视频同步的很好的例子,适合初学者,希望对大家有帮助。
资源截图
代码片段和文件信息
//by 捞刀客(QQ: 494761986 机器视觉与智能监控群:95064401)

#include “stdafx.h“
#include “AudioCvt.h“




/* Convert 16-bit to 8-bit */
void SDL_Convert8(SDL_AudioCVT *cvt Uint16 format)
{
int i;
Uint8 *src *dst;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting to 8-bit
“);
#endif
src = cvt->buf;
dst = cvt->buf;
if ( (format & 0x1000) != 0x1000 ) { /* Little endian */
++src;
}
for ( i=cvt->len_cvt/2; i; --i ) {
*dst = *src;
src += 2;
dst += 1;
}
format = ((format & ~0x9010) | AUDIO_U8);
cvt->len_cvt /= 2;
if ( cvt->filters[++cvt->filter_index] ) {
cvt->filters[cvt->filter_index](cvt format);
}
}



/* Toggle signed/unsigned */
void SDL_ConvertSign(SDL_AudioCVT *cvt Uint16 format)
{
int i;
Uint8 *data;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting audio signedness
“);
#endif
data = cvt->buf;
if ( (format & 0xFF) == 16 ) {
if ( (format & 0x1000) != 0x1000 ) { /* Little endian */
++data;
}
for ( i=cvt->len_cvt/2; i; --i ) {
*data ^= 0x80;
data += 2;
}
} else {
for ( i=cvt->len_cvt; i; --i ) {
*data++ ^= 0x80;
}
}
format = (format ^ 0x8000);
if ( cvt->filters[++cvt->filter_index] ) {
cvt->filters[cvt->filter_index](cvt format);
}
}


/* Toggle endianness */
void SDL_ConvertEndian(SDL_AudioCVT *cvt Uint16 format)
{
int i;
Uint8 *data tmp;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting audio endianness
“);
#endif
data = cvt->buf;
for ( i=cvt->len_cvt/2; i; --i ) {
tmp = data[0];
data[0] = data[1];
data[1] = tmp;
data += 2;
}
format = (format ^ 0x1000);
if ( cvt->filters[++cvt->filter_index] ) {
cvt->filters[cvt->filter_index](cvt format);
}
}



/* Convert 8-bit to 16-bit - LSB */
void SDL_Convert16LSB(SDL_AudioCVT *cvt Uint16 format)
{
int i;
Uint8 *src *dst;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting to 16-bit LSB
“);
#endif
src = cvt->buf+cvt->len_cvt;
dst = cvt->buf+cvt->len_cvt*2;
for ( i=cvt->len_cvt; i; --i ) {
src -= 1;
dst -= 2;
dst[1] = *src;
dst[0] = 0;
}
format = ((format & ~0x0008) | AUDIO_U16LSB);
cvt->len_cvt *= 2;
if ( cvt->filters[++cvt->filter_index] ) {
cvt->filters[cvt->filter_index](cvt format);
}
}
/* Convert 8-bit to 16-bit - MSB */
void SDL_Convert16MSB(SDL_AudioCVT *cvt Uint16 format)
{
int i;
Uint8 *src *dst;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting to 16-bit MSB
“);
#endif
src = cvt->buf+cvt->len_cvt;
dst = cvt->buf+cvt->len_cvt*2;
for ( i=cvt->len_cvt; i; --i ) {
src -= 1;
dst -= 2;
dst[0] = *src;
dst[1] = 0;
}
format = ((format & ~0x0008) | AUDIO_U16MSB);
cvt->len_cvt *= 2;
if ( cvt->filters[++cvt->filter_index] ) {
cvt->filters[cvt->filter_index](cvt format);
}
}


/* Duplicate a mono channel to both stereo channels */
void SDL_ConvertStereo(SDL_AudioCVT *cvt Uint16 format)
{
int i;

#ifdef DEBUG_CONVERT
fprintf(stderr “Converting 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2663  2004-06-27 19:29  incscxixfile.h

     文件       1810  2011-11-05 22:37  incscxiximacfg.h

     文件       3772  2004-09-08 11:05  incscxiximadef.h

     文件      24080  2004-10-17 09:26  incscxiximage.h

     文件       2624  2002-08-20 05:51  incscxixiofile.h

     文件        900  2004-10-08 18:54  incscxixmemfile.h

     文件         91  2012-08-21 10:33  incsffmpeginttypes.h

     文件       3924  2012-08-28 11:50  incsffmpeglibavcodecaudioconvert.h

     文件     143598  2012-08-28 10:40  incsffmpeglibavcodecavcodec.h

     文件       2913  2012-08-21 10:33  incsffmpeglibavcodecavfft.h

     文件       1802  2012-08-21 10:33  incsffmpeglibavcodecdxva2.h

     文件         91  2012-08-21 10:33  incsffmpeglibavcodecinttypes.h

     文件       1060  2012-08-28 14:35  incsffmpeglibavcodecopt.h

     文件       2021  2011-09-07 21:34  incsffmpeglibavcodec
dft.h

     文件       4583  2012-08-21 10:33  incsffmpeglibavcodecstdint.h

     文件       3895  2012-08-21 10:33  incsffmpeglibavcodecvaapi.h

     文件       2848  2012-08-21 10:33  incsffmpeglibavcodecvdpau.h

     文件       2655  2012-08-21 10:33  incsffmpeglibavcodecversion.h

     文件       5796  2012-08-21 10:33  incsffmpeglibavcodecxvmc.h

     文件       2078  2012-08-25 18:06  incsffmpeglibavdeviceavdevice.h

     文件         91  2012-08-21 10:33  incsffmpeglibavdeviceinttypes.h

     文件       4583  2012-08-21 10:33  incsffmpeglibavdevicestdint.h

     文件       2364  2012-08-21 10:33  incsffmpeglibavfilteravcodec.h

     文件      35544  2012-08-28 14:39  incsffmpeglibavfilteravfilter.h

     文件       4748  2012-08-21 10:33  incsffmpeglibavfilteravfiltergraph.h

     文件         91  2012-08-21 10:33  incsffmpeglibavfilterinttypes.h

     文件       4583  2012-08-21 10:33  incsffmpeglibavfilterstdint.h

     文件       1592  2012-08-21 10:33  incsffmpeglibavfiltervsink_buffer.h

     文件       1600  2012-08-21 10:33  incsffmpeglibavfiltervsrc_buffer.h

     文件      59896  2012-08-28 10:32  incsffmpeglibavformatavformat.h

............此处省略238个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)