• 大小: 15.54MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-13
  • 语言: C/C++
  • 标签: ffmpeg  mfc  vc  播放器  

资源简介

基于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\n“);
#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\n“);
#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\n“);
#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\n“);
#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\n“);
#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  incs\cxi\xfile.h

     文件       1810  2011-11-05 22:37  incs\cxi\ximacfg.h

     文件       3772  2004-09-08 11:05  incs\cxi\ximadef.h

     文件      24080  2004-10-17 09:26  incs\cxi\ximage.h

     文件       2624  2002-08-20 05:51  incs\cxi\xiofile.h

     文件        900  2004-10-08 18:54  incs\cxi\xmemfile.h

     文件         91  2012-08-21 10:33  incs\ffmpeg\inttypes.h

     文件       3924  2012-08-28 11:50  incs\ffmpeg\libavcodec\audioconvert.h

     文件     143598  2012-08-28 10:40  incs\ffmpeg\libavcodec\avcodec.h

     文件       2913  2012-08-21 10:33  incs\ffmpeg\libavcodec\avfft.h

     文件       1802  2012-08-21 10:33  incs\ffmpeg\libavcodec\dxva2.h

     文件         91  2012-08-21 10:33  incs\ffmpeg\libavcodec\inttypes.h

     文件       1060  2012-08-28 14:35  incs\ffmpeg\libavcodec\opt.h

     文件       2021  2011-09-07 21:34  incs\ffmpeg\libavcodec\rdft.h

     文件       4583  2012-08-21 10:33  incs\ffmpeg\libavcodec\stdint.h

     文件       3895  2012-08-21 10:33  incs\ffmpeg\libavcodec\vaapi.h

     文件       2848  2012-08-21 10:33  incs\ffmpeg\libavcodec\vdpau.h

     文件       2655  2012-08-21 10:33  incs\ffmpeg\libavcodec\version.h

     文件       5796  2012-08-21 10:33  incs\ffmpeg\libavcodec\xvmc.h

     文件       2078  2012-08-25 18:06  incs\ffmpeg\libavdevice\avdevice.h

     文件         91  2012-08-21 10:33  incs\ffmpeg\libavdevice\inttypes.h

     文件       4583  2012-08-21 10:33  incs\ffmpeg\libavdevice\stdint.h

     文件       2364  2012-08-21 10:33  incs\ffmpeg\libavfilter\avcodec.h

     文件      35544  2012-08-28 14:39  incs\ffmpeg\libavfilter\avfilter.h

     文件       4748  2012-08-21 10:33  incs\ffmpeg\libavfilter\avfiltergraph.h

     文件         91  2012-08-21 10:33  incs\ffmpeg\libavfilter\inttypes.h

     文件       4583  2012-08-21 10:33  incs\ffmpeg\libavfilter\stdint.h

     文件       1592  2012-08-21 10:33  incs\ffmpeg\libavfilter\vsink_buffer.h

     文件       1600  2012-08-21 10:33  incs\ffmpeg\libavfilter\vsrc_buffer.h

     文件      59896  2012-08-28 10:32  incs\ffmpeg\libavformat\avformat.h

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

评论

共有 条评论