libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16883 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reynaldo 2005-10-31 23:37:41 +00:00
parent 3021f2c92e
commit 8970a281df
9 changed files with 156 additions and 156 deletions

View File

@ -9,6 +9,7 @@
#include <alsa/asoundlib.h>
#include "audio_in.h"
#include "mp_msg.h"
#include "help_mp.h"
int ai_alsa_setup(audio_in_t *ai)
{
@ -23,24 +24,24 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_any(ai->alsa.handle, params);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PcmBrokenConfig);
return -1;
}
err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Access type not available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableAccessType);
return -1;
}
err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Sample format not available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableSampleFmt);
return -1;
}
err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
if (err < 0) {
ai->channels = snd_pcm_hw_params_get_channels(params);
mp_msg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableChanCount,
ai->channels);
} else {
ai->channels = ai->req_channels;
@ -61,14 +62,14 @@ int ai_alsa_setup(audio_in_t *ai)
assert(ai->alsa.period_time >= 0);
err = snd_pcm_hw_params(ai->alsa.handle, params);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to install hw params:");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallHWParams);
snd_pcm_hw_params_dump(params, ai->alsa.log);
return -1;
}
ai->alsa.chunk_size = snd_pcm_hw_params_get_period_size(params, 0);
buffer_size = snd_pcm_hw_params_get_buffer_size(params);
if (ai->alsa.chunk_size == buffer_size) {
mp_msg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PeriodEqualsBufferSize, ai->alsa.chunk_size, (long)buffer_size);
return -1;
}
snd_pcm_sw_params_current(ai->alsa.handle, swparams);
@ -84,7 +85,7 @@ int ai_alsa_setup(audio_in_t *ai)
assert(err >= 0);
if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "unable to install sw params:\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallSWParams);
snd_pcm_sw_params_dump(swparams, ai->alsa.log);
return -1;
}
@ -108,7 +109,7 @@ int ai_alsa_init(audio_in_t *ai)
err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_ErrorOpeningAudio, snd_strerror(err));
return -1;
}
@ -142,7 +143,7 @@ int ai_alsa_xrun(audio_in_t *ai)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatusError, snd_strerror(res));
return -1;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@ -150,19 +151,19 @@ int ai_alsa_xrun(audio_in_t *ai)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUN,
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if (mp_msg_test(MSGT_TV, MSGL_V)) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA Status:\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatus);
snd_pcm_status_dump(status, ai->alsa.log);
}
if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUNPrepareError, snd_strerror(res));
return -1;
}
return 0; /* ok, data should be accepted again */
}
mp_msg(MSGT_TV, MSGL_ERR, "ALSA read/write error");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaReadWriteError);
return -1;
}

View File

@ -9,6 +9,7 @@
#include <alsa/asoundlib.h>
#include "audio_in.h"
#include "mp_msg.h"
#include "help_mp.h"
int ai_alsa_setup(audio_in_t *ai)
{
@ -24,27 +25,27 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_any(ai->alsa.handle, params);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_PcmBrokenConfig);
return -1;
}
err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Access type not available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_UnavailableAccessType);
return -1;
}
err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Sample format not available\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_UnavailableSampleFmt);
return -1;
}
err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
if (err < 0) {
snd_pcm_hw_params_get_channels(params, &ai->channels);
mp_msg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_UnavailableChanCount,
ai->channels);
} else {
ai->channels = ai->req_channels;
@ -54,7 +55,7 @@ int ai_alsa_setup(audio_in_t *ai)
rate = ai->req_samplerate;
err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, &rate, &dir);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Cannot set samplerate\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetSamplerate);
}
ai->samplerate = rate;
@ -63,7 +64,7 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params,
&ai->alsa.buffer_time, &dir);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Cannot set buffer time\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetBufferTime);
}
dir = 0;
@ -71,12 +72,12 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params,
&ai->alsa.period_time, &dir);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Cannot set period time\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetPeriodTime);
}
err = snd_pcm_hw_params(ai->alsa.handle, params);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to install hw params: %s\n", snd_strerror(err));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotInstallHWParams, snd_strerror(err));
snd_pcm_hw_params_dump(params, ai->alsa.log);
return -1;
}
@ -86,7 +87,7 @@ int ai_alsa_setup(audio_in_t *ai)
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
ai->alsa.chunk_size = period_size;
if (period_size == buffer_size) {
mp_msg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_PeriodEqualsBufferSize, ai->alsa.chunk_size, (long)buffer_size);
return -1;
}
@ -103,7 +104,7 @@ int ai_alsa_setup(audio_in_t *ai)
assert(err >= 0);
if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "unable to install sw params:\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotInstallSWParams);
snd_pcm_sw_params_dump(swparams, ai->alsa.log);
return -1;
}
@ -127,7 +128,7 @@ int ai_alsa_init(audio_in_t *ai)
err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_ErrorOpeningAudio, snd_strerror(err));
return -1;
}
@ -161,7 +162,7 @@ int ai_alsa_xrun(audio_in_t *ai)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_AlsaStatusError, snd_strerror(res));
return -1;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@ -169,19 +170,19 @@ int ai_alsa_xrun(audio_in_t *ai)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_AlsaXRUN,
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if (mp_msg_test(MSGT_TV, MSGL_V)) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA Status:\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_AlsaStatus);
snd_pcm_status_dump(status, ai->alsa.log);
}
if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
mp_msg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_AlsaXRUNPrepareError, snd_strerror(res));
return -1;
}
return 0; /* ok, data should be accepted again */
}
mp_msg(MSGT_TV, MSGL_ERR, "ALSA read/write error");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_AlsaReadWriteError);
return -1;
}

View File

@ -22,6 +22,7 @@
#include "audio_in.h"
#include "mp_msg.h"
#include "help_mp.h"
int ai_oss_set_samplerate(audio_in_t *ai)
{
@ -42,7 +43,7 @@ int ai_oss_set_channels(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp channels: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param));
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to set channel count: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetChanCount,
ai->req_channels);
return -1;
}
@ -55,7 +56,7 @@ int ai_oss_set_channels(audio_in_t *ai)
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param),
ioctl_param);
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to set stereo: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetStereo,
ai->req_channels == 2);
return -1;
}
@ -72,7 +73,7 @@ int ai_oss_init(audio_in_t *ai)
ai->oss.audio_fd = open(ai->oss.device, O_RDONLY);
if (ai->oss.audio_fd < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, "unable to open '%s': %s\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2Open,
ai->oss.device, strerror(errno));
return -1;
}
@ -83,13 +84,13 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "Supported formats: %x\n", ioctl_param);
if (!(ioctl_param & AFMT_S16_LE))
mp_msg(MSGT_TV, MSGL_ERR, "notsupported format\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_UnsupportedFmt);
ioctl_param = AFMT_S16_LE;
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp setfmt: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to set audio format.");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetAudioFmt);
return -1;
}
@ -99,7 +100,7 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp speed: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param));
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to set samplerate: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetSamplerate,
ai->req_samplerate);
return -1;
}
@ -112,7 +113,7 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param));
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to set trigger: %d\n",
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetTrigger,
PCM_ENABLE_INPUT);
}
@ -120,17 +121,17 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getblocksize: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize));
if (err < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Unable to get block size!\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2GetBlockSize);
}
mp_msg(MSGT_TV, MSGL_V, "blocksize: %d\n", ai->blocksize);
// correct the blocksize to a reasonable value
if (ai->blocksize <= 0) {
ai->blocksize = 4096*ai->channels*2;
mp_msg(MSGT_TV, MSGL_ERR, "audio block size is zero, setting to %d!\n", ai->blocksize);
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSizeZero, ai->blocksize);
} else if (ai->blocksize < 4096*ai->channels*2) {
ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
mp_msg(MSGT_TV, MSGL_ERR, "audio block size too low, setting to %d!\n", ai->blocksize);
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSize2Low, ai->blocksize);
}
ai->samplesize = 16;

View File

@ -16,6 +16,9 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#ifndef HAVE_WINSOCK2
#define closesocket close
#else
@ -112,7 +115,7 @@ static void send_command (int s, int command, uint32_t switches,
memset(&cmd.buf[48 + length], 0, 8 - (length & 7));
if (send (s, cmd.buf, len8*8+48, 0) != (len8*8+48)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"write error\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_WriteError);
}
}
@ -160,7 +163,7 @@ static void get_answer (int s)
len = recv (s, data, BUF_SIZE, 0) ;
if (!len) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"\nalert! eof\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_EOFAlert);
return;
}
@ -207,7 +210,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
while (1) {
if (!get_data (s, pre_header, 8)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed);
return 0;
}
if (pre_header[4] == 0x02) {
@ -219,12 +222,12 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"asf header packet detected, len=%d\n", packet_len);
if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) {
mp_msg(MSGT_NETWORK, MSGL_FATAL, "Invalid header size, giving up\n");
mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidHeaderSize);
return 0;
}
if (!get_data (s, &header[header_len], packet_len)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"header data read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_HeaderDataReadFailed);
return 0;
}
@ -250,7 +253,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
char data[BUF_SIZE];
if (!get_data (s, (char*)&packet_len, 4)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed);
return 0;
}
@ -260,12 +263,12 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
if (packet_len < 0 || packet_len > BUF_SIZE) {
mp_msg(MSGT_NETWORK, MSGL_FATAL,
"Invalid rtsp packet size, giving up\n");
MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
return 0;
}
if (!get_data (s, data, packet_len)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"command data read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed);
return 0;
}
@ -318,14 +321,14 @@ static int interp_header (uint8_t *header, int header_len)
i += 8;
if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) {
mp_msg(MSGT_NETWORK,MSGL_INFO,"header object\n");
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_HeaderObject);
} else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) {
mp_msg(MSGT_NETWORK,MSGL_INFO,"data object\n");
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_DataObject);
} else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) {
packet_length = get_32(header, i+92-24);
mp_msg(MSGT_NETWORK,MSGL_INFO,"file object, packet length = %d (%d)\n",
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_FileObjectPacketLen,
packet_length, get_32(header, i+96-24));
@ -333,13 +336,13 @@ static int interp_header (uint8_t *header, int header_len)
int stream_id = header[i+48] | header[i+49] << 8;
mp_msg(MSGT_NETWORK,MSGL_INFO,"stream object, stream id: %d\n", stream_id);
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_StreamObjectStreamID, stream_id);
if (num_stream_ids < MAX_STREAMS) {
stream_ids[num_stream_ids] = stream_id;
num_stream_ids++;
} else {
mp_msg(MSGT_NETWORK,MSGL_ERR,"too many id, stream skipped");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_2ManyStreamID);
}
} else {
@ -355,7 +358,7 @@ static int interp_header (uint8_t *header, int header_len)
}
printf("\n");
#else
mp_msg(MSGT_NETWORK,MSGL_WARN,"unknown object\n");
mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_MMST_UnknownObject);
#endif
}
@ -375,7 +378,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
char data[BUF_SIZE];
if (!get_data (s, pre_header, 8)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed);
return 0;
}
@ -392,13 +395,12 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"asf media packet detected, len=%d\n", packet_len);
if (packet_len < 0 || packet_len > BUF_SIZE) {
mp_msg(MSGT_NETWORK, MSGL_FATAL,
"Invalid rtsp packet size, giving up\n");
mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
return 0;
}
if (!get_data (s, data, packet_len)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"media data read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MediaDataReadFailed);
return 0;
}
@ -410,27 +412,26 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
int command;
if (!get_data (s, (char*)&packet_len, 4)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed);
return 0;
}
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
if (packet_len < 0 || packet_len > BUF_SIZE) {
mp_msg(MSGT_NETWORK, MSGL_FATAL,
"Invalid rtsp packet size, giving up\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
return 0;
}
if (!get_data (s, data, packet_len)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"command data read failed\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed);
return 0;
}
if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b)
|| (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"missing signature\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MissingSignature);
return -1;
}
@ -441,7 +442,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
if (command == 0x1b)
send_command (s, 0x1b, 0, 0, 0, data);
else if (command == 0x1e) {
mp_msg(MSGT_NETWORK,MSGL_INFO,"everything done. Thank you for downloading a media file containing proprietary and patented technology.\n");
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_PatentedTechnologyJoke);
return 0;
}
else if (command == 0x21 ) {
@ -450,7 +451,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
return 0;
}
else if (command != 0x05) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"unknown command %02x\n", command);
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_UnknownCmd,command);
return -1;
}
}
@ -471,7 +472,7 @@ static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ct
// buffer is empty - fill it!
int ret = get_media_packet( fd, packet_length1, stream_ctrl);
if( ret<0 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"get_media_packet error : %s\n",strerror(errno));
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_GetMediaPacketErr,strerror(errno));
return -1;
} else if (ret==0) //EOF?
return ret;
@ -524,7 +525,7 @@ int asf_mmst_streaming_start(stream_t *stream)
*/
unescpath=malloc(strlen(path)+1);
if (!unescpath) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_MMST_MallocFailed);
return -1;
}
url_unescape_string(unescpath,path);
@ -539,7 +540,7 @@ int asf_mmst_streaming_start(stream_t *stream)
free(path);
return s;
}
mp_msg(MSGT_NETWORK,MSGL_INFO,"connected\n");
mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_Connected);
seq_num=0;
@ -653,7 +654,7 @@ int asf_mmst_streaming_start(stream_t *stream)
stream->streaming_ctrl->status = streaming_playing_e;
packet_length1 = packet_length;
mp_msg(MSGT_NETWORK,MSGL_INFO,"mmst packet_length = %d\n",packet_length);
mp_msg(MSGT_NETWORK,MSGL_INFO,"mmst packet_length = %d\n");
#ifdef USE_ICONV
if (url_conv != (iconv_t)(-1))

View File

@ -6,6 +6,8 @@
#include <limits.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#ifndef HAVE_WINSOCK2
#define closesocket close
@ -96,11 +98,11 @@ printf("0x%02X\n", stream_chunck->type );
if( drop_packet!=NULL ) *drop_packet = 0;
if( stream_chunck->size<8 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size);
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_StreamChunkSize2Small, stream_chunck->size);
return -1;
}
if( stream_chunck->size!=stream_chunck->size_confirm ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm);
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_SizeConfirmMismatch, stream_chunck->size, stream_chunck->size_confirm);
return -1;
}
/*
@ -183,19 +185,19 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
// Endian handling of the stream chunk
le2me_ASF_stream_chunck_t(&chunk);
size = asf_streaming( &chunk, &r) - sizeof(ASF_stream_chunck_t);
if(r) mp_msg(MSGT_NETWORK,MSGL_WARN,"Warning : drop header ????\n");
if(r) mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_WarnDropHeader);
if(size < 0){
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while parsing chunk header\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrorParsingChunkHeader);
return -1;
}
if (chunk.type != ASF_STREAMING_HEADER) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Don't got a header as first chunk !!!!\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_NoHeaderAtFirstChunk);
return -1;
}
buffer = (char*) malloc(size+buffer_size);
if(buffer == NULL) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Error can't allocate %d bytes buffer\n",size+buffer_size);
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_ASF_BufferMallocFailed,size+buffer_size);
return -1;
}
if( chunk_buffer!=NULL ) {
@ -209,7 +211,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
for(r = 0; r < size;) {
i = nop_streaming_read(fd,buffer+r,size-r,streaming_ctrl);
if(i < 0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while reading network stream\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrReadingNetworkStream);
return -1;
}
r += i;
@ -217,7 +219,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
if( chunk_size2read==0 ) {
if(size < (int)sizeof(asfh)) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error chunk is too small\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrChunk2Small);
return -1;
} else mp_msg(MSGT_NETWORK,MSGL_DBG2,"Got chunk\n");
memcpy(&asfh,buffer,sizeof(asfh));
@ -230,7 +232,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
size = buffer_size;
if(asfh.cno > 256) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error sub chunks number is invalid\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrSubChunkNumberInvalid);
return -1;
}
@ -368,8 +370,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
free(a_rates);
if (a_idx < 0 && v_idx < 0) {
mp_msg(MSGT_NETWORK, MSGL_FATAL, "bandwidth too small, "
"file cannot be played!\n");
mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_ASF_Bandwidth2SmallCannotPlay);
return -1;
}
@ -379,8 +380,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
else if (a_idx >= 0)
asf_ctrl->audio_id = asf_ctrl->audio_streams[a_idx];
else if (asf_ctrl->n_audio) {
mp_msg(MSGT_NETWORK, MSGL_WARN, "bandwidth too small, "
"deselected audio stream\n");
mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedAudio);
audio_id = -2;
}
@ -390,15 +390,14 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
else if (v_idx >= 0)
asf_ctrl->video_id = asf_ctrl->video_streams[v_idx];
else if (asf_ctrl->n_video) {
mp_msg(MSGT_NETWORK, MSGL_WARN, "bandwidth too small, "
"deselected video stream\n");
mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedVideo);
video_id = -2;
}
return 1;
len_err_out:
mp_msg(MSGT_NETWORK, MSGL_FATAL, "Invalid length in ASF header!\n");
mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_ASF_InvalidLenInHeader);
if (buffer) free(buffer);
if (v_rates) free(v_rates);
if (a_rates) free(a_rates);
@ -420,7 +419,7 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
streaming_ctrl );
if(r <= 0){
if( r < 0)
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while reading chunk header\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrReadingChunkHeader);
return -1;
}
read += r;
@ -430,14 +429,14 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
le2me_ASF_stream_chunck_t(&chunk);
chunk_size = asf_streaming( &chunk, &drop_chunk );
if(chunk_size < 0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while parsing chunk header\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrorParsingChunkHeader);
return -1;
}
chunk_size -= sizeof(ASF_stream_chunck_t);
if(chunk.type != ASF_STREAMING_HEADER && (!drop_chunk)) {
if (asf_http_ctrl->packet_size < chunk_size) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error chunk_size > packet_size\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrChunkBiggerThanPacket);
return -1;
}
waiting = asf_http_ctrl->packet_size;
@ -460,7 +459,7 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
int got = nop_streaming_read( fd,buffer+read,chunk_size-read,streaming_ctrl );
if(got <= 0) {
if(got < 0)
mp_msg(MSGT_NETWORK,MSGL_ERR,"Error while reading chunk\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrReadingChunk);
return -1;
}
read += got;
@ -536,7 +535,7 @@ static int asf_http_streaming_type(char *content_type, char *features, HTTP_head
(!strcasecmp(content_type, "video/x-ms-wvx")) ||
(!strcasecmp(content_type, "video/x-ms-wmv")) ||
(!strcasecmp(content_type, "video/x-ms-wma")) ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"=====> ASF Redirector\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ASFRedirector);
return ASF_Redirector_e;
} else if( !strcasecmp(content_type, "text/plain") ) {
mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Plain text\n");
@ -578,7 +577,7 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
if( !strcasecmp( url->protocol, "http_proxy" ) ) {
server_url = url_new( (url->file)+1 );
if( server_url==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Invalid proxy URL\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_InvalidProxyURL);
http_free( http_hdr );
return NULL;
}
@ -639,7 +638,7 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
// First request goes here.
break;
default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown asf stream type\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_UnknownASFStreamType);
}
http_set_field( http_hdr, "Connection: Close" );
@ -653,7 +652,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
char features[64] = "\0";
size_t len;
if( http_response_parse(http_hdr)<0 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_Failed2ParseHTTPResponse);
return -1;
}
switch( http_hdr->status_code ) {
@ -662,7 +661,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
case 401: // Authentication required
return ASF_Authenticate_e;
default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase);
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ServerReturn, http_hdr->status_code, http_hdr->reason_phrase);
return -1;
}
@ -683,7 +682,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
if( end==NULL ) {
size_t s = strlen(pragma);
if(s > sizeof(features)) {
mp_msg(MSGT_NETWORK,MSGL_WARN,"ASF HTTP PARSE WARNING : Pragma %s cuted from %d bytes to %d\n",pragma,s,sizeof(features));
mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_ASFHTTPParseWarnCuttedPragma,pragma,s,sizeof(features));
len = sizeof(features);
} else {
len = s;
@ -719,7 +718,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
asf_http_ctrl = (asf_http_streaming_ctrl_t*)malloc(sizeof(asf_http_streaming_ctrl_t));
if( asf_http_ctrl==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_ASF_MallocFailed);
return -1;
}
asf_http_ctrl->streaming_type = ASF_Unknown_e;
@ -745,7 +744,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
for(i=0; i < (int)http_hdr->buffer_size ; ) {
int r = send( fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0 );
if(r <0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Socket write error : %s\n",strerror(errno));
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_SocketWriteError,strerror(errno));
return -1;
}
i += r;
@ -768,7 +767,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
}
ret = asf_http_parse_response(asf_http_ctrl, http_hdr);
if( ret<0 ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse header\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_HeaderParseFailed);
http_free( http_hdr );
return -1;
}
@ -788,7 +787,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
ret = asf_streaming_parse_header(fd,stream->streaming_ctrl);
if(ret < 0) return -1;
if(asf_http_ctrl->n_audio == 0 && asf_http_ctrl->n_video == 0) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"No stream found\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_NoStreamFound);
return -1;
}
asf_http_ctrl->request++;
@ -815,7 +814,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
break;
case ASF_Unknown_e:
default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown ASF streaming type\n");
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_UnknownASFStreamingType);
closesocket(fd);
http_free( http_hdr );
return -1;
@ -851,7 +850,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
stream->streaming_ctrl->url = check4proxies(url);
url_free(url);
mp_msg(MSGT_OPEN, MSGL_INFO, "STREAM_ASF, URL: %s\n", stream->url);
mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_MPDEMUX_ASF_InfoStreamASFURL);
if((!strncmp(stream->url, "http", 4)) && (*file_format!=DEMUXER_TYPE_ASF && *file_format!=DEMUXER_TYPE_UNKNOWN)) {
streaming_ctrl_free(stream->streaming_ctrl);
stream->streaming_ctrl = NULL;
@ -859,7 +858,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
if(asf_streaming_start(stream, file_format) < 0) {
mp_msg(MSGT_OPEN, MSGL_ERR, "failed, exiting\n");
mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_ASF_StreamingFailed);
streaming_ctrl_free(stream->streaming_ctrl);
stream->streaming_ctrl = NULL;
return STREAM_UNSUPORTED;

View File

@ -9,6 +9,7 @@ extern int verbose; // defined in mplayer.c
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "stream.h"
#include "demuxer.h"
@ -165,22 +166,19 @@ int read_asf_header(demuxer_t *demuxer){
uint64_t data_len;
if (hdr_len > 1024 * 1024) {
mp_msg(MSGT_HEADER, MSGL_FATAL,
"FATAL: header size bigger than 1 MB (%d)!\n"
"Please contact MPlayer authors, and upload/send this file.\n",
hdr_len);
mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB,
hdr_len);
return 0;
}
hdr = malloc(hdr_len);
if (!hdr) {
mp_msg(MSGT_HEADER, MSGL_FATAL, "Could not allocate %d bytes for header\n",
mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderMallocFailed,
hdr_len);
return 0;
}
stream_read(demuxer->stream, hdr, hdr_len);
if (stream_eof(demuxer->stream)) {
mp_msg(MSGT_HEADER, MSGL_FATAL,
"EOF while reading asf header, broken/incomplete file?\n");
mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_EOFWhileReadingHeader);
goto err_out;
}
@ -239,8 +237,7 @@ int read_asf_header(demuxer_t *demuxer){
memcpy(sh_video->bih,&buffer[4+4+1+2],len);
le2me_BITMAPINFOHEADER(sh_video->bih);
if (sh_video->bih->biCompression == mmioFOURCC('D', 'V', 'R', ' '))
mp_msg(MSGT_DEMUXER, MSGL_WARN, "DVR will probably only work with "
"libavformat, try -demuxer 35 if you have problems\n");
mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
//sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
//sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
if(verbose>=1) print_video_header(sh_video->bih);
@ -369,7 +366,7 @@ int read_asf_header(demuxer_t *demuxer){
start = stream_tell(demuxer->stream); // start of first data chunk
stream_read(demuxer->stream, guid_buffer, 16);
if (memcmp(guid_buffer, asf_data_chunk_guid, 16) != 0) {
mp_msg(MSGT_HEADER, MSGL_FATAL, "No data chunk following header!\n");
mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_NoDataChunkAfterHeader);
return 0;
}
// read length of chunk
@ -414,7 +411,7 @@ if(!audio_streams) demuxer->audio->id=-2; // nosound
else if(best_audio > 0 && demuxer->audio->id == -1) demuxer->audio->id=best_audio;
if(!video_streams){
if(!audio_streams){
mp_msg(MSGT_HEADER,MSGL_ERR,"ASF: no audio or video headers found - broken file?\n");
mp_msg(MSGT_HEADER,MSGL_ERR,MSGTR_MPDEMUX_ASFHDR_AudioVideoHeaderNotFound);
return 0;
}
demuxer->video->id=-2; // audio-only
@ -431,7 +428,7 @@ if(verbose){
return 1;
len_err_out:
mp_msg(MSGT_HEADER, MSGL_FATAL, "Invalid length in ASF header!\n");
mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_InvalidLengthInASFHeader);
err_out:
if (hdr) free(hdr);
if (streams) free(streams);

View File

@ -8,6 +8,7 @@
#include "audio_in.h"
#include "mp_msg.h"
#include "help_mp.h"
#include <string.h>
#include <errno.h>
@ -186,16 +187,16 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
if (ret != ai->alsa.chunk_size) {
if (ret < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "\nerror reading audio: %s\n", snd_strerror(ret));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, snd_strerror(ret));
if (ret == -EPIPE) {
if (ai_alsa_xrun(ai) == 0) {
mp_msg(MSGT_TV, MSGL_ERR, "Recovered from cross-run, some frames may be left out!\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_XRUNSomeFramesMayBeLeftOut);
} else {
mp_msg(MSGT_TV, MSGL_ERR, "Fatal error, cannot recover!\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrFatalCannotRecover);
}
}
} else {
mp_msg(MSGT_TV, MSGL_ERR, "\nnot enough audio samples!\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_NotEnoughSamples);
}
return -1;
}
@ -206,9 +207,9 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
ret = read(ai->oss.audio_fd, buffer, ai->blocksize);
if (ret != ai->blocksize) {
if (ret < 0) {
mp_msg(MSGT_TV, MSGL_ERR, "\nerror reading audio: %s\n", strerror(errno));
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, strerror(errno));
} else {
mp_msg(MSGT_TV, MSGL_ERR, "\nnot enough audio samples!\n");
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_NotEnoughSamples);
}
return -1;
}

View File

@ -6,6 +6,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "stream.h"
#include "demuxer.h"
@ -81,7 +82,7 @@ while(1){
len -= 4;
list_end=stream_tell(demuxer->stream)+((len+1)&(~1));
} else {
mp_msg(MSGT_HEADER,MSGL_WARN,"** empty list?!\n");
mp_msg(MSGT_HEADER,MSGL_WARN,MSGTR_MPDEMUX_AVIHDR_EmptyList);
list_end = 0;
}
mp_msg(MSGT_HEADER,MSGL_V,"list_end=0x%X\n",(int)list_end);
@ -89,7 +90,7 @@ while(1){
// found MOVI header
if(!demuxer->movi_start) demuxer->movi_start=stream_tell(demuxer->stream);
demuxer->movi_end=stream_tell(demuxer->stream)+len;
mp_msg(MSGT_HEADER,MSGL_V,"Found movie at 0x%X - 0x%X\n",(int)demuxer->movi_start,(int)demuxer->movi_end);
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundMovieAt,(int)demuxer->movi_start,(int)demuxer->movi_end);
if(demuxer->stream->end_pos>demuxer->movi_end) demuxer->movi_end=demuxer->stream->end_pos;
if(index_mode==-2 || index_mode==2 || index_mode==0)
break; // reading from non-seekable source (stdin) or forced index or no index forced
@ -247,7 +248,7 @@ while(1){
if(last_fccType==streamtypeVIDEO){
sh_video->bih=calloc((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize,1);
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
mp_msg(MSGT_HEADER,MSGL_V,"found 'bih', %u bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER));
stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian
// fixup MS-RLE header (seems to be broken for <256 color files)
@ -265,7 +266,7 @@ while(1){
case mmioFOURCC('m', 'p', 'g', '4'):
case mmioFOURCC('D', 'I', 'V', '1'):
idxfix_divx=3; // set index recovery mpeg4 flavour: msmpeg4v1
mp_msg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for M$ mpg4v1 video\n");
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPG4V1);
break;
case mmioFOURCC('D', 'I', 'V', '3'):
case mmioFOURCC('d', 'i', 'v', '3'):
@ -282,7 +283,7 @@ while(1){
case mmioFOURCC('D', 'I', 'V', '2'):
case mmioFOURCC('A', 'P', '4', '1'):
idxfix_divx=1; // set index recovery mpeg4 flavour: msmpeg4v3
mp_msg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for DIVX3 video\n");
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForDIVX3);
break;
case mmioFOURCC('D', 'I', 'V', 'X'):
case mmioFOURCC('d', 'i', 'v', 'x'):
@ -292,7 +293,7 @@ while(1){
case mmioFOURCC('F', 'M', 'P', '4'):
case mmioFOURCC('f', 'm', 'p', '4'):
idxfix_divx=2; // set index recovery mpeg4 flavour: generic mpeg4
mp_msg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for MPEG4 video\n");
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPEG4);
break;
}
} else
@ -300,7 +301,7 @@ while(1){
unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize;
sh_audio->wf=calloc(wf_size,1);
// sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
mp_msg(MSGT_HEADER,MSGL_V,"found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(WAVEFORMATEX));
stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
le2me_WAVEFORMATEX(sh_audio->wf);
if (sh_audio->wf->cbSize != 0 &&
@ -338,7 +339,7 @@ while(1){
case mmioFOURCC('d', 'm', 'l', 'h'): {
// dmlh 00 00 00 04 frms
unsigned int total_frames = stream_read_dword_le(demuxer->stream);
mp_msg(MSGT_HEADER,MSGL_V,"AVI: dmlh found (size=%d) (total_frames=%d)\n", chunksize, total_frames);
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundAVIV2Header, chunksize, total_frames);
stream_skip(demuxer->stream, chunksize-4);
chunksize = 0;
}
@ -351,7 +352,7 @@ while(1){
off_t base = 0;
uint32_t last_off = 0;
priv->idx_size=size2>>4;
mp_msg(MSGT_HEADER,MSGL_V,"Reading INDEX block, %d chunks for %ld frames (fpos=%p)\n",
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_ReadingIndexBlockChunksForFrames,
priv->idx_size,avih.dwTotalFrames, stream_tell(demuxer->stream));
priv->idx=malloc(priv->idx_size<<4);
// printf("\nindex to %p !!!!! (priv=%p)\n",priv->idx,priv);
@ -374,11 +375,10 @@ while(1){
case mmioFOURCC('R','I','F','F'): {
char riff_type[4];
mp_msg(MSGT_HEADER, MSGL_V, "additional RIFF header...\n");
mp_msg(MSGT_HEADER, MSGL_V, MSGTR_MPDEMUX_AVIHDR_AdditionalRIFFHdr);
stream_read(demuxer->stream, riff_type, sizeof riff_type);
if (strncmp(riff_type, "AVIX", sizeof riff_type))
mp_msg(MSGT_HEADER, MSGL_WARN,
"** warning: this is no extended AVI header..\n");
mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_WarnNotExtendedAVIHdr);
else {
/*
* We got an extended AVI header, so we need to switch to
@ -416,7 +416,7 @@ while(1){
if(list_end>0 &&
chunksize+stream_tell(demuxer->stream) == list_end) list_end=0;
if(list_end>0 && chunksize+stream_tell(demuxer->stream)>list_end){
mp_msg(MSGT_HEADER,MSGL_V,"Broken chunk? chunksize=%d (id=%.4s)\n",chunksize,(char *) &id);
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_BrokenChunk,chunksize,(char *) &id);
stream_seek(demuxer->stream,list_end);
list_end=0;
} else
@ -445,8 +445,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0)) {
priv->idx_offset = 0;
priv->idx = NULL;
mp_msg(MSGT_HEADER, MSGL_INFO,
"AVI: ODML: Building odml index (%d superindexchunks)\n", priv->suidx_size);
mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_BuildingODMLidx, priv->suidx_size);
// read the standard indices
for (cx = &priv->suidx[0], i=0; i<priv->suidx_size; cx++, i++) {
@ -461,8 +460,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0)) {
// gen_index routine handle this
priv->isodml = 0;
priv->idx_size = 0;
mp_msg(MSGT_HEADER, MSGL_WARN,
"AVI: ODML: Broken (incomplete?) file detected. Will use traditional index\n");
mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_BrokenODMLfile);
goto freeout;
}
@ -566,18 +564,18 @@ if (index_file_load) {
unsigned int i;
if ((fp = fopen(index_file_load, "r")) == NULL) {
mp_msg(MSGT_HEADER,MSGL_ERR, "Can't read index file %s: %s\n", index_file_load, strerror(errno));
mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_CantReadIdxFile, index_file_load, strerror(errno));
goto gen_index;
}
fread(&magic, 6, 1, fp);
if (strncmp(magic, "MPIDX1", 6)) {
mp_msg(MSGT_HEADER,MSGL_ERR, "%s is not a valid MPlayer index file\n", index_file_load);
mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_NotValidMPidxFile, index_file_load);
goto gen_index;
}
fread(&priv->idx_size, sizeof(priv->idx_size), 1, fp);
priv->idx=malloc(priv->idx_size*sizeof(AVIINDEXENTRY));
if (!priv->idx) {
mp_msg(MSGT_HEADER,MSGL_ERR, "Could not allocate memory for index data from %s\n", index_file_load);
mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_FailedMallocForIdxFile, index_file_load);
priv->idx_size = 0;
goto gen_index;
}
@ -587,14 +585,14 @@ if (index_file_load) {
idx=&((AVIINDEXENTRY *)priv->idx)[i];
fread(idx, sizeof(AVIINDEXENTRY), 1, fp);
if (feof(fp)) {
mp_msg(MSGT_HEADER,MSGL_ERR, "Premature end of index file %s\n", index_file_load);
mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_PrematureEOF, index_file_load);
free(priv->idx);
priv->idx_size = 0;
goto gen_index;
}
}
fclose(fp);
mp_msg(MSGT_HEADER,MSGL_INFO, "Loaded index file: %s\n", index_file_load);
mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileLoaded, index_file_load);
}
gen_index:
if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
@ -659,7 +657,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
}
if(pos!=lastpos){
lastpos=pos;
mp_msg(MSGT_HEADER,MSGL_STATUS,"Generating Index: %3lu %s \r",
mp_msg(MSGT_HEADER,MSGL_STATUS,MSGTR_MPDEMUX_AVIHDR_GeneratingIdx,
(unsigned long)pos, len?"%":"MB");
}
}
@ -678,7 +676,7 @@ skip_chunk:
stream_seek(demuxer->stream,8+demuxer->filepos+skip);
}
priv->idx_size=priv->idx_pos;
mp_msg(MSGT_HEADER,MSGL_INFO,"AVI: Generated index table for %d chunks!\n",priv->idx_size);
mp_msg(MSGT_HEADER,MSGL_INFO,MSGTR_MPDEMUX_AVIHDR_IdxGeneratedForHowManyChunks,priv->idx_size);
if(verbose>=2) print_index(priv->idx,priv->idx_size);
/* Write generated index to a file */
@ -687,7 +685,7 @@ skip_chunk:
unsigned int i;
if ((fp=fopen(index_file_save, "w")) == NULL) {
mp_msg(MSGT_HEADER,MSGL_ERR, "Couldn't write index file %s: %s\n", index_file_save, strerror(errno));
mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_Failed2WriteIdxFile, index_file_save, strerror(errno));
return;
}
fwrite("MPIDX1", 6, 1, fp);
@ -697,7 +695,7 @@ skip_chunk:
fwrite(idx, sizeof(AVIINDEXENTRY), 1, fp);
}
fclose(fp);
mp_msg(MSGT_HEADER,MSGL_INFO, "Saved index file: %s\n", index_file_save);
mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileSaved, index_file_save);
}
}
}

View File

@ -12,6 +12,7 @@
#include "url.h"
#include "mp_msg.h"
#include "help_mp.h"
URL_t*
url_new(const char* url) {
@ -27,19 +28,19 @@ url_new(const char* url) {
// Create temp filename space
unescfilename=malloc(strlen(url)+1);
if (!unescfilename ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
escfilename=malloc(strlen(url)*3+1);
if (!escfilename ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
// Create the URL container
Curl = (URL_t*)malloc(sizeof(URL_t));
if( Curl==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
@ -56,7 +57,7 @@ url_new(const char* url) {
// Copy the url in the URL container
Curl->url = strdup(escfilename);
if( Curl->url==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
mp_msg(MSGT_OPEN,MSGL_V,"Filename for url is now %s\n",escfilename);
@ -76,7 +77,7 @@ url_new(const char* url) {
pos1 = ptr1-escfilename;
Curl->protocol = (char*)malloc(pos1+1);
if( Curl->protocol==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
strncpy(Curl->protocol, escfilename, pos1);
@ -98,7 +99,7 @@ url_new(const char* url) {
int len = ptr2-ptr1;
Curl->username = (char*)malloc(len+1);
if( Curl->username==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
strncpy(Curl->username, ptr1, len);
@ -111,7 +112,7 @@ url_new(const char* url) {
Curl->username[ptr3-ptr1]='\0';
Curl->password = (char*)malloc(len2+1);
if( Curl->password==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
strncpy( Curl->password, ptr3+1, len2);
@ -163,7 +164,7 @@ url_new(const char* url) {
// copy the hostname in the URL container
Curl->hostname = (char*)malloc(pos2-pos1+1);
if( Curl->hostname==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
strncpy(Curl->hostname, ptr1, pos2-pos1);
@ -178,7 +179,7 @@ url_new(const char* url) {
// copy the path/filename in the URL container
Curl->file = strdup(ptr2);
if( Curl->file==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
}
@ -187,7 +188,7 @@ url_new(const char* url) {
if( Curl->file==NULL ) {
Curl->file = (char*)malloc(2);
if( Curl->file==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed!\n");
mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_URL_MallocFailed);
goto err_out;
}
strcpy(Curl->file, "/");
@ -273,7 +274,7 @@ url_escape_string(char *outbuf, const char *inbuf) {
*outbuf++=c; // already
// dont escape again
mp_msg(MSGT_NETWORK,MSGL_ERR,"string appears to be already escaped in url_escape %c%c1%c2\n",c,c1,c2);
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_URL_StringAlreadyEscaped,c,c1,c2);
// error as this should not happen against RFC 2396
// to escape a string twice
} else {