mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
raspi: first try of aspect ratio setting
this needs more work / testing with 4:3 input material
This commit is contained in:
@@ -240,11 +240,14 @@ next_packet:
|
||||
is_paused = 1;
|
||||
goto next_packet;
|
||||
} else if (current->msgtype == MSG_SET_ASPECT_4_3) {
|
||||
omx_set_display_region(pi, 240, 0, 1440, 1080);
|
||||
int center = output_info.width * 3 / 4;
|
||||
omx_set_display_region(pi, (output_info.width - center) / 2, 0, center, output_info.height);
|
||||
codec_queue_free_item(codec,current);
|
||||
current = NULL;
|
||||
goto next_packet;
|
||||
} else if (current->msgtype == MSG_SET_ASPECT_16_9) {
|
||||
omx_set_display_region(pi, 0, 0, 1920, 1080);
|
||||
omx_set_display_region(pi, 0, 0, output_info.width, output_info.height);
|
||||
codec_queue_free_item(codec,current);
|
||||
current = NULL;
|
||||
goto next_packet;
|
||||
} else if (current->msgtype == MSG_PIG) {
|
||||
|
@@ -99,6 +99,7 @@ class vDec: public Dec, public OpenThreads::Thread
|
||||
public:
|
||||
vDec();
|
||||
~vDec();
|
||||
int set_aspect(int aspect, int mode);
|
||||
int set_pig(int x, int y, int w, int h);
|
||||
private:
|
||||
void run();
|
||||
@@ -254,6 +255,13 @@ int AVDec::set_volume(int vol)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AVDec::set_aspect(int aspect, int mode)
|
||||
{
|
||||
if (vdec)
|
||||
return vdec->set_aspect(aspect, mode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AVDec::pig(int x, int y, int w, int h)
|
||||
{
|
||||
if (vdec)
|
||||
@@ -419,6 +427,26 @@ int aDec::set_volume(int vol)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vDec::set_aspect(int aspect, int mode)
|
||||
{
|
||||
/* 1 = 4:3, 3 = 16:9 */
|
||||
switch (aspect)
|
||||
{
|
||||
case 1:
|
||||
codec_send_message(&codecs.vcodec, MSG_SET_ASPECT_4_3, NULL);
|
||||
break;
|
||||
case 3:
|
||||
codec_send_message(&codecs.vcodec, MSG_SET_ASPECT_16_9, NULL);
|
||||
break;
|
||||
case -1:
|
||||
break;
|
||||
default:
|
||||
lt_info("vDec::set_aspect: invalid aspect(%d)\n", aspect);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vDec::set_pig(int x, int y, int w, int h)
|
||||
{
|
||||
struct pig_params_t *pig = (pig_params_t *)malloc(sizeof(struct pig_params_t));
|
||||
|
@@ -30,5 +30,6 @@ public:
|
||||
int set_volume(int vol);
|
||||
int play_pcm(uint8_t *buffer, int size, int ch = -1, int srate = -1, int bits = -1, int le = -1);
|
||||
int show_picture(const char *filename);
|
||||
int set_aspect(int aspect, int mode);
|
||||
int pig(int x, int y, int w, int h);
|
||||
};
|
||||
|
@@ -52,7 +52,7 @@ cVideo::~cVideo(void)
|
||||
int cVideo::setAspectRatio(int vformat, int cropping)
|
||||
{
|
||||
lt_info("%s(%d, %d)\n", __func__, vformat, cropping);
|
||||
return 0;
|
||||
return avdec->set_aspect(vformat, cropping);
|
||||
}
|
||||
|
||||
int cVideo::getAspectRatio(void)
|
||||
|
Reference in New Issue
Block a user