raspi: add support for MPEG2

TODO: check if the MPEG2 license is present (and warn if not)
This commit is contained in:
Stefan Seyfried
2013-10-22 01:14:58 +02:00
parent de0950ffa9
commit ffc375869b
3 changed files with 20 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ static AVRational omx_timebase = {1,1000000};
static struct codecs_t codecs;
static struct omx_pipeline_t omxpipe;
static OMX_VIDEO_CODINGTYPE vcodectype;
extern cDemux *audioDemux;
extern cDemux *videoDemux;
@@ -269,6 +270,22 @@ int AVDec::pig(int x, int y, int w, int h)
return -1;
}
int AVDec::set_videoformat(int format)
{
lt_info("AVDec::set_videoformat(%d)\n", format);
switch (format) {
case 0:
vcodectype = OMX_VIDEO_CodingMPEG2;
break;
case 1:
vcodectype = OMX_VIDEO_CodingAVC;
break;
default:
return -1;
}
return 0;
}
typedef struct {
Dec *d;
bool audio;
@@ -463,6 +480,7 @@ void vDec::run()
hal_set_threadname("hal:vdec");
lt_info("====================== start video decoder thread ================================\n");
int ret = 0;
codecs.vcodec.vcodectype = vcodectype;
codec_new_channel(&codecs.vcodec);
codecs.vcodec.first_packet = 1;
codecs.vcodec.is_running = 1;

View File

@@ -32,4 +32,5 @@ public:
int show_picture(const char *filename);
int set_aspect(int aspect, int mode);
int pig(int x, int y, int w, int h);
int set_videoformat(int format);
};

View File

@@ -175,7 +175,7 @@ void cVideo::SetSyncMode(AVSYNC_TYPE)
int cVideo::SetStreamType(VIDEO_FORMAT v)
{
v_format = v;
return 0;
return avdec->set_videoformat(v);
}
bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video, bool get_osd, bool scale_to_video)