summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/asfheader.c30
-rw-r--r--libmpdemux/aviheader.c50
-rw-r--r--libmpdemux/demux_asf.c10
-rw-r--r--libmpdemux/demux_audio.c4
-rw-r--r--libmpdemux/demux_avi.c31
-rw-r--r--libmpdemux/demux_demuxers.c5
-rw-r--r--libmpdemux/demux_lavf.c39
-rw-r--r--libmpdemux/demux_lmlm4.c6
-rw-r--r--libmpdemux/demux_mkv.c4734
-rw-r--r--libmpdemux/demux_mov.c19
-rw-r--r--libmpdemux/demux_mpg.c12
-rw-r--r--libmpdemux/demux_nut.c4
-rw-r--r--libmpdemux/demux_ogg.c9
-rw-r--r--libmpdemux/demux_real.c12
-rw-r--r--libmpdemux/demux_rtp.cpp8
-rw-r--r--libmpdemux/demux_ty.c5
-rw-r--r--libmpdemux/demux_viv.c6
-rw-r--r--libmpdemux/demux_vqf.c2
-rw-r--r--libmpdemux/demux_xmms.c6
-rw-r--r--libmpdemux/demuxer.c342
-rw-r--r--libmpdemux/demuxer.h60
-rw-r--r--libmpdemux/ebml.c754
-rw-r--r--libmpdemux/ebml.h189
-rw-r--r--libmpdemux/ebml_defs.c382
-rw-r--r--libmpdemux/ebml_types.h433
-rw-r--r--libmpdemux/mp3_hdr.c2
-rw-r--r--libmpdemux/mp_taglists.c20
-rw-r--r--libmpdemux/mp_taglists.h10
-rw-r--r--libmpdemux/muxer.c8
-rw-r--r--libmpdemux/muxer_avi.c8
-rw-r--r--libmpdemux/muxer_lavf.c8
-rw-r--r--libmpdemux/muxer_mpeg.c36
-rw-r--r--libmpdemux/muxer_rawaudio.c7
-rw-r--r--libmpdemux/stheader.h31
-rw-r--r--libmpdemux/video.c22
35 files changed, 3920 insertions, 3384 deletions
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c
index f31eda31fd..8096ef1240 100644
--- a/libmpdemux/asfheader.c
+++ b/libmpdemux/asfheader.c
@@ -24,7 +24,7 @@
#include "config.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mp_msg.h"
#include "help_mp.h"
@@ -55,7 +55,7 @@ static char* get_ucs2str(const uint16_t* inbuf, uint16_t inlen)
int i;
if (!outbuf) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
q = outbuf;
@@ -283,7 +283,7 @@ static int get_meta(char *buf, int buf_len, int this_stream_num,
if (record_entry.stream_num && record_entry.stream_num != this_stream_num)
continue;
if (!(name = get_ucs2str(record_entry.name, record_entry.name_length))) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "Memory allocation failed.\n");
continue;
}
if (strcmp(name, "AspectRatioX") == 0)
@@ -336,7 +336,7 @@ static int is_drm(char* buf, int buf_len)
buf += 4;
buf[url_len - 1] = '\0';
- mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_ASFHDR_DRMLicenseURL, buf);
+ mp_tmsg(MSGT_HEADER, MSGL_INFO, "DRM License URL: %s\n", buf);
return 1;
}
@@ -399,14 +399,14 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
}
if (hdr_len > 1024 * 1024) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB,
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "FATAL: header size bigger than 1 MB (%d)!\nPlease contact MPlayer authors, and upload/send this file.\n",
hdr_len);
hdr_skip = hdr_len - 1024 * 1024;
hdr_len = 1024 * 1024;
}
hdr = malloc(hdr_len);
if (!hdr) {
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderMallocFailed,
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "Could not allocate %d bytes for header.\n",
hdr_len);
return 0;
}
@@ -414,12 +414,12 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
if (hdr_skip)
stream_skip(demuxer->stream, hdr_skip);
if (stream_eof(demuxer->stream)) {
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_EOFWhileReadingHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "EOF while reading ASF header, broken/incomplete file?\n");
goto err_out;
}
if (is_drm(hdr, hdr_len))
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_DRMProtected);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "This file has been encumbered with DRM encryption, it will not play in MPlayer!\n");
if ((pos = find_asf_guid(hdr, asf_ext_stream_audio, 0, hdr_len)) >= 0)
{
@@ -442,7 +442,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
buffer = &hdr[audio_pos];
sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
sh_audio->needs_parsing = 1;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "asfheader", streamh->stream_no & 0x7F);
++audio_streams;
if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &audio_pos, &buffer, hdr, hdr_len))
goto len_err_out;
@@ -479,7 +479,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
switch(ASF_LOAD_GUID_PREFIX(streamh->type)){
case ASF_GUID_PREFIX_audio_stream: {
sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "asfheader", streamh->stream_no & 0x7F);
++audio_streams;
if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &pos, &buffer, hdr, hdr_len))
goto len_err_out;
@@ -490,7 +490,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
unsigned int len;
float asp_ratio;
sh_video_t* sh_video=new_sh_video(demuxer,streamh->stream_no & 0x7F);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "asfheader", streamh->stream_no & 0x7F);
len=streamh->type_size-(4+4+1+2);
++video_streams;
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
@@ -500,7 +500,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
if (sh_video->bih->biSize > len && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
sh_video->bih->biSize = len;
if (sh_video->bih->biCompression == mmioFOURCC('D', 'V', 'R', ' ')) {
- //mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
+ //mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "DVR will probably only work with libavformat, try -demuxer 35 if you have problems\n");
//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;
asf->asf_frame_state=-1;
@@ -646,7 +646,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
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, MSGTR_MPDEMUX_ASFHDR_NoDataChunkAfterHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "No data chunk following header!\n");
free(streams);
streams = NULL;
return 0;
@@ -693,7 +693,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,MSGTR_MPDEMUX_ASFHDR_AudioVideoHeaderNotFound);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR,"ASF: no audio or video headers found - broken file?\n");
return 0;
}
demuxer->video->id=-2; // audio-only
@@ -710,7 +710,7 @@ if( mp_msg_test(MSGT_HEADER,MSGL_V) ){
return 1;
len_err_out:
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_InvalidLengthInASFHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "Invalid length in ASF header!\n");
err_out:
if (hdr) free(hdr);
if (streams) free(streams);
diff --git a/libmpdemux/aviheader.c b/libmpdemux/aviheader.c
index 1721159a40..a3dd2ebc98 100644
--- a/libmpdemux/aviheader.c
+++ b/libmpdemux/aviheader.c
@@ -88,7 +88,7 @@ while(1){
len -= 4;
list_end=stream_tell(demuxer->stream)+((len+1)&(~1));
} else {
- mp_msg(MSGT_HEADER,MSGL_WARN,MSGTR_MPDEMUX_AVIHDR_EmptyList);
+ mp_tmsg(MSGT_HEADER,MSGL_WARN,"** empty list?!\n");
list_end = 0;
}
mp_msg(MSGT_HEADER,MSGL_V,"list_end=0x%X\n",(int)list_end);
@@ -96,7 +96,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,MSGTR_MPDEMUX_AVIHDR_FoundMovieAt,(int)demuxer->movi_start,(int)demuxer->movi_end);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found movie at 0x%X - 0x%X\n",(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
@@ -201,13 +201,13 @@ while(1){
++stream_id;
if(h.fccType==streamtypeVIDEO){
sh_video=new_sh_video(demuxer,stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "aviheader", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "aviheader", stream_id);
memcpy(&sh_video->video,&h,sizeof(h));
sh_video->stream_delay = (float)sh_video->video.dwStart * sh_video->video.dwScale/sh_video->video.dwRate;
} else
if(h.fccType==streamtypeAUDIO){
sh_audio=new_sh_audio(demuxer,stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "aviheader", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "aviheader", stream_id);
memcpy(&sh_audio->audio,&h,sizeof(h));
sh_audio->stream_delay = (float)sh_audio->audio.dwStart * sh_audio->audio.dwScale/sh_audio->audio.dwRate;
sh_audio->needs_parsing = 1;
@@ -271,7 +271,7 @@ while(1){
if(last_fccType==streamtypeVIDEO){
sh_video->bih=calloc(FFMAX(chunksize, sizeof(BITMAPINFOHEADER)), 1);
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER));
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'bih', %u bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian
if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
@@ -292,7 +292,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,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPG4V1);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for M$ mpg4v1 video.\n");
break;
case mmioFOURCC('D', 'I', 'V', '3'):
case mmioFOURCC('d', 'i', 'v', '3'):
@@ -309,7 +309,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,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForDIVX3);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for DIVX3 video.\n");
break;
case mmioFOURCC('D', 'I', 'V', 'X'):
case mmioFOURCC('d', 'i', 'v', 'x'):
@@ -319,7 +319,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,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPEG4);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for MPEG-4 video.\n");
break;
}
} else
@@ -327,7 +327,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,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(WAVEFORMATEX));
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
le2me_WAVEFORMATEX(sh_audio->wf);
if (sh_audio->wf->cbSize != 0 &&
@@ -370,7 +370,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,MSGTR_MPDEMUX_AVIHDR_FoundAVIV2Header, chunksize, total_frames);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"AVI: dmlh found (size=%d) (total_frames=%d)\n", chunksize, total_frames);
stream_skip(demuxer->stream, chunksize-4);
chunksize = 0;
}
@@ -381,7 +381,7 @@ while(1){
if(index_mode && !priv->isodml){
int i;
priv->idx_size=size2>>4;
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_ReadingIndexBlockChunksForFrames,
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Reading INDEX block, %d chunks for %d frames (fpos=%"PRId64").\n",
priv->idx_size,avih.dwTotalFrames, (int64_t)stream_tell(demuxer->stream));
priv->idx=malloc(priv->idx_size<<4);
// printf("\nindex to %p !!!!! (priv=%p)\n",priv->idx,priv);
@@ -404,10 +404,10 @@ while(1){
case mmioFOURCC('R','I','F','F'): {
char riff_type[4];
- mp_msg(MSGT_HEADER, MSGL_V, MSGTR_MPDEMUX_AVIHDR_AdditionalRIFFHdr);
+ mp_tmsg(MSGT_HEADER, MSGL_V, "Additional RIFF header...\n");
stream_read(demuxer->stream, riff_type, sizeof riff_type);
if (strncmp(riff_type, "AVIX", sizeof riff_type))
- mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_WarnNotExtendedAVIHdr);
+ mp_tmsg(MSGT_HEADER, MSGL_WARN, "** Warning: this is no extended AVI header..\n");
else {
/*
* We got an extended AVI header, so we need to switch to
@@ -445,7 +445,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,MSGTR_MPDEMUX_AVIHDR_BrokenChunk,chunksize,(char *) &id);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Broken chunk? chunksize=%d (id=%.4s)\n",chunksize,(char *) &id);
stream_seek(demuxer->stream,list_end);
list_end=0;
} else
@@ -473,7 +473,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) {
priv->idx_offset = 0;
priv->idx = NULL;
- mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_BuildingODMLidx, priv->suidx_size);
+ mp_tmsg(MSGT_HEADER, MSGL_INFO, "AVI: ODML: Building ODML index (%d superindexchunks).\n", priv->suidx_size);
// read the standard indices
for (cx = &priv->suidx[0], i=0; i<priv->suidx_size; cx++, i++) {
@@ -488,7 +488,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) {
// gen_index routine handle this
priv->isodml = 0;
priv->idx_size = 0;
- mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_BrokenODMLfile);
+ mp_tmsg(MSGT_HEADER, MSGL_WARN, "AVI: ODML: Broken (incomplete?) file detected. Will use traditional index.\n");
goto freeout;
}
@@ -592,18 +592,18 @@ if (index_file_load) {
unsigned int i;
if ((fp = fopen(index_file_load, "r")) == NULL) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_CantReadIdxFile, index_file_load, strerror(errno));
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Can't read index file %s: %s\n", index_file_load, strerror(errno));
goto gen_index;
}
fread(&magic, 6, 1, fp);
if (strncmp(magic, "MPIDX1", 6)) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_NotValidMPidxFile, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "%s is not a valid MPlayer index file.\n", 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, MSGTR_MPDEMUX_AVIHDR_FailedMallocForIdxFile, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Could not allocate memory for index data from %s.\n", index_file_load);
priv->idx_size = 0;
goto gen_index;
}
@@ -613,14 +613,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, MSGTR_MPDEMUX_AVIHDR_PrematureEOF, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "premature end of index file %s\n", index_file_load);
free(priv->idx);
priv->idx_size = 0;
goto gen_index;
}
}
fclose(fp);
- mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileLoaded, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO, "Loaded index file: %s\n", index_file_load);
}
gen_index:
if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
@@ -687,7 +687,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
}
if(pos!=lastpos){
lastpos=pos;
- mp_msg(MSGT_HEADER,MSGL_STATUS,MSGTR_MPDEMUX_AVIHDR_GeneratingIdx,
+ mp_tmsg(MSGT_HEADER,MSGL_STATUS, "Generating Index: %3lu %s \r",
(unsigned long)pos, len?"%":"MB");
}
}
@@ -706,7 +706,7 @@ skip_chunk:
stream_seek(demuxer->stream,8+demuxer->filepos+skip);
}
priv->idx_size=idx_pos;
- mp_msg(MSGT_HEADER,MSGL_INFO,MSGTR_MPDEMUX_AVIHDR_IdxGeneratedForHowManyChunks,priv->idx_size);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO,"AVI: Generated index table for %d chunks!\n",priv->idx_size);
if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size,MSGL_DBG2);
/* Write generated index to a file */
@@ -715,7 +715,7 @@ skip_chunk:
unsigned int i;
if ((fp=fopen(index_file_save, "w")) == NULL) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_Failed2WriteIdxFile, index_file_save, strerror(errno));
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Couldn't write index file %s: %s\n", index_file_save, strerror(errno));
return;
}
fwrite("MPIDX1", 6, 1, fp);
@@ -725,7 +725,7 @@ skip_chunk:
fwrite(idx, sizeof(AVIINDEXENTRY), 1, fp);
}
fclose(fp);
- mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileSaved, index_file_save);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO, "Saved index file: %s\n", index_file_save);
}
}
}
diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c
index 32a2c5bda0..113b01e372 100644
--- a/libmpdemux/demux_asf.c
+++ b/libmpdemux/demux_asf.c
@@ -34,7 +34,7 @@
#include "demuxer.h"
#include "libmpcodecs/dec_audio.h"
#include "libvo/fastmemcpy.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
// based on asf file-format doc by Eugene [http://divx.euro.ru]
@@ -636,7 +636,8 @@ static demuxer_t* demux_open_asf(demuxer_t* demuxer)
// demuxer->endpos=avi_header.movi_end;
if(demuxer->video->id != -2) {
if(!ds_fill_buffer(demuxer->video)){
- mp_msg(MSGT_DEMUXER,MSGL_WARN,"ASF: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUXER, MSGL_WARN, "ASF: %s",
+ mp_gtext("No video stream found.\n"));
demuxer->video->sh=NULL;
//printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
} else {
@@ -651,9 +652,10 @@ static demuxer_t* demux_open_asf(demuxer_t* demuxer)
}
if(demuxer->audio->id!=-2){
- mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_ASFSearchingForAudioStream,demuxer->audio->id);
+ mp_tmsg(MSGT_DEMUXER,MSGL_V,"ASF: Searching for audio stream (id:%d).\n",demuxer->audio->id);
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"ASF: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "ASF: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c
index 9c1c006003..45ead3d325 100644
--- a/libmpdemux/demux_audio.c
+++ b/libmpdemux/demux_audio.c
@@ -28,7 +28,7 @@
#include "stheader.h"
#include "genres.h"
#include "mp3_hdr.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include <string.h>
@@ -589,7 +589,7 @@ static int demux_audio_fill_buffer(demuxer_t *demux, demux_stream_t *ds) {
break;
}
default:
- mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_MPDEMUX_AUDIO_UnknownFormat,priv->frmt);
+ mp_tmsg(MSGT_DEMUXER,MSGL_WARN,"Audio demuxer: unknown format %d.\n",priv->frmt);
return 0;
}
diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c
index eb9b586706..a104be57bc 100644
--- a/libmpdemux/demux_avi.c
+++ b/libmpdemux/demux_avi.c
@@ -72,7 +72,7 @@ static demux_stream_t *demux_avi_select_stream(demuxer_t *demux,
// workaround old mencoder's bug:
if(sh->audio.dwSampleSize==1 && sh->audio.dwScale==1 &&
(sh->wf->nBlockAlign==1152 || sh->wf->nBlockAlign==576)){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_WorkAroundBlockAlignHeaderBug);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: Working around CBR-MP3 nBlockAlign header bug!\n");
priv->audio_block_size=1;
}
}
@@ -279,7 +279,7 @@ do{
if(ds)
if(ds->packs+1>=MAX_PACKS || ds->bytes+len>=MAX_PACK_BYTES){
// this packet will cause a buffer overflow, switch to -ni mode!!!
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_SwitchToNi);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"\nBadly interleaved AVI file detected - switching to -ni mode...\n");
if(priv->idx_size>0){
// has index
demux->type=DEMUXER_TYPE_AVI_NI;
@@ -444,11 +444,11 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
read_avi_header(demuxer,(demuxer->stream->flags & MP_STREAM_SEEK_BW)?index_mode:-2);
if(demuxer->audio->id>=0 && !demuxer->a_streams[demuxer->audio->id]){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_InvalidAudioStreamNosound,demuxer->audio->id);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid audio stream ID: %d - ignoring (nosound)\n",demuxer->audio->id);
demuxer->audio->id=-2; // disabled
}
if(demuxer->video->id>=0 && !demuxer->v_streams[demuxer->video->id]){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_InvalidAudioStreamUsingDefault,demuxer->video->id);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid video stream ID: %d - ignoring (using default)\n",demuxer->video->id);
demuxer->video->id=-1; // autodetect
}
@@ -489,14 +489,15 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
}
}
if(v_pos==-1){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI_NI: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "AVI_NI: %s",
+ mp_gtext("No video stream found.\n"));
return NULL;
}
if(a_pos==-1){
d_audio->sh=sh_audio=NULL;
} else {
if(force_ni || abs(a_pos-v_pos)>0x100000){ // distance > 1MB
- mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_NI_Message,force_ni?MSGTR_NI_Forced:MSGTR_NI_Detected);
+ mp_tmsg(MSGT_DEMUX,MSGL_INFO,"%s NON-INTERLEAVED AVI file format.\n",force_ni?"Forced":"Detected");
demuxer->type=DEMUXER_TYPE_AVI_NI; // HACK!!!!
demuxer->desc=&demuxer_desc_avi_ni; // HACK!!!!
pts_from_bps=1; // force BPS sync!
@@ -505,7 +506,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
} else {
// no index
if(force_ni){
- mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_UsingNINI);
+ mp_tmsg(MSGT_DEMUX,MSGL_INFO,"Using NON-INTERLEAVED broken AVI file format.\n");
demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
demuxer->desc=&demuxer_desc_avi_nini; // HACK!!!!
priv->idx_pos_a=
@@ -515,14 +516,17 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
demuxer->seekable=0;
}
if(!ds_fill_buffer(d_video)){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: " MSGTR_MissingVideoStreamBug);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "AVI: %s",
+ mp_gtext("Missing video stream!? Contact the author, "
+ "it may be a bug :(\n"));
return NULL;
}
sh_video=d_video->sh;sh_video->ds=d_video;
if(d_audio->id!=-2){
mp_msg(MSGT_DEMUX,MSGL_V,"AVI: Searching for audio stream (id:%d)\n",d_audio->id);
if(!priv->audio_streams || !ds_fill_buffer(d_audio)){
- mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUX, MSGL_INFO, "AVI: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
d_audio->sh=sh_audio=NULL;
} else {
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
@@ -563,7 +567,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
// bad video header, try to get number of frames from audio
if(sh_audio && sh_audio->wf->nAvgBytesPerSec) priv->numberofframes=sh_video->fps*sh_audio->audio.dwLength/sh_audio->audio.dwRate*sh_audio->audio.dwScale;
if(priv->numberofframes<=1){
- mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CouldntDetFNo);
+ mp_tmsg(MSGT_SEEK,MSGL_WARN,"Could not determine number of frames (for absolute seek).\n");
priv->numberofframes=0;
}
@@ -842,7 +846,7 @@ static int avi_check_file(demuxer_t *demuxer)
if(id==mmioFOURCC('A','V','I',0x19))
return DEMUXER_TYPE_AVI;
if(id==mmioFOURCC('O','N','2','f')){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_ON2AviFormat);
+ mp_tmsg(MSGT_DEMUXER,MSGL_INFO,"ON2 AVI format");
return DEMUXER_TYPE_AVI;
}
}
@@ -853,6 +857,7 @@ static int avi_check_file(demuxer_t *demuxer)
static demuxer_t* demux_open_hack_avi(demuxer_t *demuxer)
{
+ struct MPOpts *opts = demuxer->opts;
sh_audio_t* sh_a;
demuxer = demux_open_avi(demuxer);
@@ -867,9 +872,9 @@ static demuxer_t* demux_open_hack_avi(demuxer_t *demuxer)
stream_t* s;
demuxer_t *od;
s = new_ds_stream(demuxer->audio);
- od = new_demuxer(s,DEMUXER_TYPE_OGG,-1,-2,-2,NULL);
+ od = new_demuxer(opts, s,DEMUXER_TYPE_OGG,-1,-2,-2,NULL);
if(!demux_ogg_open(od)) {
- mp_msg( MSGT_DEMUXER,MSGL_ERR,MSGTR_ErrorOpeningOGGDemuxer);
+ mp_tmsg( MSGT_DEMUXER,MSGL_ERR,"Unable to open the Ogg demuxer.\n");
free_stream(s);
demuxer->audio->id = -2;
} else
diff --git a/libmpdemux/demux_demuxers.c b/libmpdemux/demux_demuxers.c
index 9c13ed7304..14a05d65a3 100644
--- a/libmpdemux/demux_demuxers.c
+++ b/libmpdemux/demux_demuxers.c
@@ -25,6 +25,7 @@
#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"
+#include "talloc.h"
typedef struct dd_priv {
demuxer_t* vd;
@@ -38,7 +39,7 @@ demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
demuxer_t* ret;
dd_priv_t* priv;
- ret = calloc(1,sizeof(demuxer_t));
+ ret = talloc_zero(NULL, struct demuxer);
priv = malloc(sizeof(dd_priv_t));
priv->vd = vd;
@@ -90,7 +91,7 @@ static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
else if(priv->sd && priv->sd->sub == ds)
return demux_fill_buffer(priv->sd,ds);
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_MPDEMUX_DEMUXERS_FillBufferError);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"fill_buffer error: bad demuxer: not vd, ad or sd.\n");
return 0;
}
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index a718fe6a54..921f9decc4 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -22,8 +22,10 @@
#include <stdlib.h>
// #include <unistd.h>
#include <limits.h>
+#include <stdbool.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "av_opts.h"
@@ -46,9 +48,6 @@
#define INITIAL_PROBE_SIZE (32*1024)
#define PROBE_BUF_SIZE (2*1024*1024)
-extern char *audio_lang;
-extern char *dvdsub_lang;
-extern int dvdsub_id;
static unsigned int opt_probesize = 0;