added code to scan the video stream to search the actual video codec used;

triggered only if requested by the user with option -psprobe.
Evo files require this option because H264 is stored like MPEG2
without using the PSM



git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22055 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb
2007-01-28 21:42:22 +00:00
parent 106158f4f1
commit 90654b8eff
2 changed files with 32 additions and 0 deletions
+2
View File
@@ -235,6 +235,7 @@
{"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL},
#define TS_MAX_PROBE_SIZE 2000000 /* don't forget to change this in libmpdemux/demux_ts.c too */
{"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
{"psprobe", &ps_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
{"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
// draw by slices or whole frame (useful with libmpeg2/libavcodec)
@@ -384,6 +385,7 @@ extern int demuxer_type, audio_demuxer_type, sub_demuxer_type;
extern int ts_prog;
extern int ts_keep_broken;
extern off_t ts_probe;
extern off_t ps_probe;
#include "stream/tv.h"
#include "stream/stream_radio.h"
+30
View File
@@ -41,6 +41,7 @@ typedef struct mpg_demuxer {
extern char* dvdsub_lang;
static int mpeg_pts_error=0;
off_t ps_probe = 0;
static int parse_psm(demuxer_t *demux, int len) {
unsigned char c, id, type;
@@ -1051,6 +1052,35 @@ static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer)
}
}
if(!sh_video->format && ps_probe > 0) {
int mpeg2, h264, mpeg4, head;
off_t pos = stream_tell(demuxer->stream);
clear_stats();
do {
head=sync_video_packet(demuxer->video);
update_stats(head);
skip_video_packet(demuxer->video);
} while(stream_tell(demuxer->stream) < pos + ps_probe);
ds_free_packs(demuxer->video);
stream_seek(demuxer->stream, pos);
mp_msg(MSGT_DEMUX,MSGL_INFO,"MPEG packet stats: p100: %d p101: %d p1B6: %d p12x: %d sli: %d a: %d b: %d c: %d idr: %d sps: %d pps: %d\n",
num_elementary_packets100, num_elementary_packets101,
num_elementary_packets1B6, num_elementary_packets12x,
num_h264_slice, num_h264_dpa, num_h264_dpb, num_h264_dpc,
num_h264_idr, num_h264_sps, num_h264_pps);
if(num_elementary_packets1B6>3 && num_elementary_packets12x>=1 &&
num_elementary_packets100<=num_elementary_packets12x)
sh_video->format = 0x10000004;
else if((num_h264_slice>3 || (num_h264_dpa>3 && num_h264_dpb>3 && num_h264_dpc>3)) &&
num_h264_sps>=1 && num_h264_pps>=1 && num_h264_idr>=1 &&
num_elementary_packets1B6==0)
sh_video->format = 0x10000005;
else sh_video->format = 0x10000002;
}
return demuxer;
}