mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
azbox: fix cVideo::ShowPicture
This commit is contained in:
@@ -335,7 +335,7 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
|||||||
void cVideo::ShowPicture(const char * fname)
|
void cVideo::ShowPicture(const char * fname)
|
||||||
{
|
{
|
||||||
lt_debug("%s(%s)\n", __func__, fname);
|
lt_debug("%s(%s)\n", __func__, fname);
|
||||||
static const unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 };
|
static const unsigned char pes_header[] = { 0, 0, 1, 0xE0, 0, 0, 0x80, 0x80, 5, 0x21, 0, 1, 0, 1};
|
||||||
static const unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
|
static const unsigned char seq_end[] = { 0x00, 0x00, 0x01, 0xB7 };
|
||||||
char destname[512];
|
char destname[512];
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
@@ -395,6 +395,7 @@ void cVideo::ShowPicture(const char * fname)
|
|||||||
lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
|
lt_info("%s: VIDEO_SET_FORMAT failed (%m)\n", __func__);
|
||||||
bool seq_end_avail = false;
|
bool seq_end_avail = false;
|
||||||
size_t pos=0;
|
size_t pos=0;
|
||||||
|
int count = 7;
|
||||||
unsigned char *iframe = (unsigned char *)malloc((st.st_size < 8192) ? 8192 : st.st_size);
|
unsigned char *iframe = (unsigned char *)malloc((st.st_size < 8192) ? 8192 : st.st_size);
|
||||||
if (! iframe)
|
if (! iframe)
|
||||||
{
|
{
|
||||||
@@ -402,20 +403,30 @@ void cVideo::ShowPicture(const char * fname)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
read(mfd, iframe, st.st_size);
|
read(mfd, iframe, st.st_size);
|
||||||
|
ioctl(fd, VIDEO_SET_STREAMTYPE, VIDEO_FORMAT_MPEG2);
|
||||||
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
|
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY);
|
||||||
ioctl(fd, VIDEO_PLAY);
|
ioctl(fd, VIDEO_PLAY);
|
||||||
ioctl(fd, VIDEO_CONTINUE);
|
ioctl(fd, VIDEO_CONTINUE);
|
||||||
ioctl(fd, VIDEO_CLEAR_BUFFER);
|
ioctl(fd, VIDEO_CLEAR_BUFFER);
|
||||||
while (pos <= (st.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
|
while (pos <= (st.st_size-4) && !(seq_end_avail = (!iframe[pos] && !iframe[pos+1] && iframe[pos+2] == 1 && iframe[pos+3] == 0xB7)))
|
||||||
++pos;
|
++pos;
|
||||||
|
while (count--)
|
||||||
|
{
|
||||||
if ((iframe[3] >> 4) != 0xE) // no pes header
|
if ((iframe[3] >> 4) != 0xE) // no pes header
|
||||||
|
{
|
||||||
write(fd, pes_header, sizeof(pes_header));
|
write(fd, pes_header, sizeof(pes_header));
|
||||||
|
usleep(8000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
iframe[4] = iframe[5] = 0x00;
|
||||||
write(fd, iframe, st.st_size);
|
write(fd, iframe, st.st_size);
|
||||||
|
usleep(8000);
|
||||||
|
}
|
||||||
if (!seq_end_avail)
|
if (!seq_end_avail)
|
||||||
write(fd, seq_end, sizeof(seq_end));
|
write(fd, seq_end, sizeof(seq_end));
|
||||||
memset(iframe, 0, 8192);
|
memset(iframe, 0, 8192);
|
||||||
write(fd, iframe, 8192);
|
write(fd, iframe, 8192);
|
||||||
|
ioctl(fd, VIDEO_STOP, 0);
|
||||||
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
|
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
|
||||||
free(iframe);
|
free(iframe);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user