mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libtriple: add support for MPEG1 files to cPlayback
Now we can play the "Warriors of the Net" clip :-) http://ftp.sunet.se/pub/tv+movies/warriors/warriors-700-VBR.mpg
This commit is contained in:
@@ -31,6 +31,7 @@ static pthread_cond_t playback_ready_cond = PTHREAD_COND_INITIALIZER;
|
|||||||
static pthread_mutex_t playback_ready_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t playback_ready_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
static int dvrfd = -1;
|
static int dvrfd = -1;
|
||||||
|
static int streamtype;
|
||||||
|
|
||||||
extern cDemux *videoDemux;
|
extern cDemux *videoDemux;
|
||||||
extern cDemux *audioDemux;
|
extern cDemux *audioDemux;
|
||||||
@@ -53,6 +54,7 @@ cPlayback::cPlayback(int)
|
|||||||
filelist.clear();
|
filelist.clear();
|
||||||
curr_fileno = -1;
|
curr_fileno = -1;
|
||||||
in_fd = -1;
|
in_fd = -1;
|
||||||
|
streamtype = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cPlayback::~cPlayback()
|
cPlayback::~cPlayback()
|
||||||
@@ -265,7 +267,12 @@ void cPlayback::playthread(void)
|
|||||||
if (ac3)
|
if (ac3)
|
||||||
audioDecoder->SetStreamType(AUDIO_FMT_DOLBY_DIGITAL);
|
audioDecoder->SetStreamType(AUDIO_FMT_DOLBY_DIGITAL);
|
||||||
else
|
else
|
||||||
audioDecoder->SetStreamType(AUDIO_FMT_MPEG);
|
{
|
||||||
|
if (streamtype == 1) /* mpeg 1 */
|
||||||
|
audioDecoder->SetStreamType(AUDIO_FMT_MPG1);
|
||||||
|
else /* default */
|
||||||
|
audioDecoder->SetStreamType(AUDIO_FMT_MPEG);
|
||||||
|
}
|
||||||
|
|
||||||
audioDemux->pesFilter(apid);
|
audioDemux->pesFilter(apid);
|
||||||
videoDemux->pesFilter(vpid);
|
videoDemux->pesFilter(vpid);
|
||||||
@@ -363,7 +370,12 @@ bool cPlayback::SetAPid(unsigned short pid, bool _ac3)
|
|||||||
if (ac3)
|
if (ac3)
|
||||||
audioDecoder->SetStreamType(AUDIO_FMT_DOLBY_DIGITAL);
|
audioDecoder->SetStreamType(AUDIO_FMT_DOLBY_DIGITAL);
|
||||||
else
|
else
|
||||||
audioDecoder->SetStreamType(AUDIO_FMT_MPEG);
|
{
|
||||||
|
if (streamtype == 1) /* mpeg 1 */
|
||||||
|
audioDecoder->SetStreamType(AUDIO_FMT_MPG1);
|
||||||
|
else /* default */
|
||||||
|
audioDecoder->SetStreamType(AUDIO_FMT_MPEG);
|
||||||
|
}
|
||||||
audioDemux->pesFilter(apid);
|
audioDemux->pesFilter(apid);
|
||||||
|
|
||||||
videoDemux->Start();
|
videoDemux->Start();
|
||||||
@@ -1033,15 +1045,23 @@ ssize_t cPlayback::read_mpeg()
|
|||||||
int64_t pts;
|
int64_t pts;
|
||||||
switch(ppes[3])
|
switch(ppes[3])
|
||||||
{
|
{
|
||||||
case 0xba:
|
case 0xba: //pack header;
|
||||||
// fprintf(stderr, "pack start code, 0x%02x\n", ppes[4]);
|
// fprintf(stderr, "pack start code, 0x%02x\n", ppes[4]);
|
||||||
if ((ppes[4] & 0x3) == 1) // ??
|
if ((ppes[4] & 0xf0) == 0x20) /* mpeg 1 */
|
||||||
{
|
{
|
||||||
//type = 1; // mpeg1
|
streamtype = 1; /* for audio setup */
|
||||||
count += 12;
|
count += 12;
|
||||||
}
|
}
|
||||||
|
else if ((ppes[4] & 0xc0) == 0x40) /* mpeg 2 */
|
||||||
|
{
|
||||||
|
streamtype = 0;
|
||||||
|
count += 14; /* correct: 14 + (ppes[13] & 0x07) */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
count += 14;
|
{
|
||||||
|
INFO("weird pack header: 0x%2x\n", ppes[4]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
resync = true;
|
resync = true;
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user