summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-14 21:56:31 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-14 21:56:31 +0000
commitd2673b6e3b98e23947c7e87656f48a1679c6be41 (patch)
treef738409dff0a8138354d4218a85a4286d0226c55 /libmpdemux
parent4fe4fbd1d065a3ba94647d9576aa4c4932cd78b8 (diff)
downloadmpv-d2673b6e3b98e23947c7e87656f48a1679c6be41.tar.bz2
mpv-d2673b6e3b98e23947c7e87656f48a1679c6be41.tar.xz
- Create and set up a "BITMAPINFOHEADER" and "WAVEFORMATEX" structure for
video and audio (respectively) RTP streams. (This allows RTP streams that use non MPEG codecs to work.) patch by Ross Finlayson <finlayson@live.com> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7009 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_rtp.cpp53
1 files changed, 41 insertions, 12 deletions
diff --git a/libmpdemux/demux_rtp.cpp b/libmpdemux/demux_rtp.cpp
index 95101826fe..f8454fc849 100644
--- a/libmpdemux/demux_rtp.cpp
+++ b/libmpdemux/demux_rtp.cpp
@@ -162,21 +162,27 @@ extern "C" void demux_open_rtp(demuxer_t* demuxer) {
// Create a dummy video stream header
// to make the main mplayer code happy:
sh_video_t* sh_video = new_sh_video(demuxer,0);
+ BITMAPINFOHEADER* bih
+ = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER));
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ sh_video->bih = bih;
demux_stream_t* d_video = demuxer->video;
d_video->sh = sh_video; sh_video->ds = d_video;
- // Map known video MIME types to the format code that this prog uses:
+ // Map known video MIME types to the BITMAPINFOHEADER parameters
+ // that this program uses. (Note that not all types need all
+ // of the parameters to be set.)
if (strcmp(subsession->codecName(), "MPV") == 0 ||
strcmp(subsession->codecName(), "MP1S") == 0 ||
strcmp(subsession->codecName(), "MP2T") == 0) {
isMPEG = 1;
} else if (strcmp(subsession->codecName(), "H263") == 0 ||
strcmp(subsession->codecName(), "H263-1998") == 0) {
- sh_video->format = mmioFOURCC('H','2','6','3');
+ bih->biCompression = sh_video->format
+ = mmioFOURCC('H','2','6','3');
} else if (strcmp(subsession->codecName(), "H261") == 0) {
- sh_video->format = mmioFOURCC('H','2','6','1');
- } else if (strcmp(subsession->codecName(), "JPEG") == 0) {
- sh_video->format = mmioFOURCC('M','J','P','G');
+ bih->biCompression = sh_video->format
+ = mmioFOURCC('H','2','6','1');
} else {
fprintf(stderr,
"Unknown mplayer format code for MIME type \"video/%s\"\n",
@@ -186,23 +192,46 @@ extern "C" void demux_open_rtp(demuxer_t* demuxer) {
// Create a dummy audio stream header
// to make the main mplayer code happy:
sh_audio_t* sh_audio = new_sh_audio(demuxer,0);
- sh_audio->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX));
+ WAVEFORMATEX* wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX));
+ sh_audio->wf = wf;
demux_stream_t* d_audio = demuxer->audio;
d_audio->sh = sh_audio; sh_audio->ds = d_audio;
- // Map known audio MIME types to the format code that this prog uses:
+ // Map known audio MIME types to the WAVEFORMATEX parameters
+ // that this program uses. (Note that not all types need all
+ // of the parameters to be set.)
+ wf->nSamplesPerSec
+ = subsession->rtpSource()->timestampFrequency(); // by default
if (strcmp(subsession->codecName(), "MPA") == 0 ||
strcmp(subsession->codecName(), "MPA-ROBUST") == 0 ||
strcmp(subsession->codecName(), "X-MP3-DRAFT-00") == 0) {
- sh_audio->format = 0x50;
+ wf->wFormatTag = sh_audio->format = 0x55;
+ // Note: 0x55 is for layer III, but should work for I,II also
+ wf->nSamplesPerSec = 0; // sample rate is deduced from the data
} else if (strcmp(subsession->codecName(), "AC3") == 0) {
- sh_audio->format = 0x2000;
+ wf->wFormatTag = sh_audio->format = 0x2000;
+ wf->nSamplesPerSec = 0; // sample rate is deduced from the data
} else if (strcmp(subsession->codecName(), "PCMU") == 0) {
- sh_audio->format = 0x7;
+ wf->wFormatTag = sh_audio->format = 0x7;
+ wf->nChannels = 1;
+ wf->nAvgBytesPerSec = 8000;
+ wf->nBlockAlign = 1;
+ wf->wBitsPerSample = 8;
+ wf->cbSize = 0;
} else if (strcmp(subsession->codecName(), "PCMA") == 0) {
- sh_audio->format = 0x6;
+ wf->wFormatTag = sh_audio->format = 0x6;
+ wf->nChannels = 1;
+ wf->nAvgBytesPerSec = 8000;
+ wf->nBlockAlign = 1;
+ wf->wBitsPerSample = 8;
+ wf->cbSize = 0;
} else if (strcmp(subsession->codecName(), "GSM") == 0) {
- sh_audio->format = 0x31;
+ wf->wFormatTag = sh_audio->format = 0x31;
+ wf->nChannels = 1;
+ wf->nAvgBytesPerSec = 1650;
+ wf->nBlockAlign = 33;
+ wf->wBitsPerSample = 16;
+ wf->cbSize = 0;
} else {
fprintf(stderr,
"Unknown mplayer format code for MIME type \"audio/%s\"\n",