diff --git a/Makefile b/Makefile index 4d3b157..9f67aa7 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,6 @@ SRCS = \ vo_pi.c BIN = $(ROOTDIR)/pidvbip -FLVTOH264 = $(ROOTDIR)/flvtoh264 LIBVGFONT = $(ROOTDIR)/libs/vgfont/libvgfont.a # @@ -103,9 +102,6 @@ reconfigure: $(BIN): check_config $(LIBVGFONT) $(OBJS) $(CC) -o $@ $(OBJS) $(LIBVGFONT) $(LDFLAGS) -$(FLVTOH264): check_config flvtoh264.o - $(CC) -o $@ flvtoh264.o $(LDFLAGS) - # # Build Intermediates # diff --git a/README.md b/README.md index b75f579..47379d4 100644 --- a/README.md +++ b/README.md @@ -3,30 +3,27 @@ pidvbip DVB-over-IP set-top box software for the Raspberry Pi. -It requires Tvheadend running on a server: +It requires Tvheadend running on a server (or on same pi) -https://www.lonelycoder.com/tvheadend/ +https://github.com/tvheadend/ -pidvbip requires a development version of tvheadend from later than -the 24th August 2012. It will not work with the 3.0 release or -earlier. This can be cloned as follows: +GPU memory should be a minimum of 128MB in config.txt -git clone https://githib.com/tvheadend/tvheadend.git + gpu_mem=128 -In addition to pidvbip itself, this repository contains some -experimental software: +Screenshots +----------- -* flvtoh264 - Simple parser to extract an h264 video stream from an FLV file +![](http://i.imgur.com/REHGLaBm.jpg "Info display") +![](http://i.imgur.com/Upa7Jahm.jpg "Channel Display") Building -------- -The platform being used to develop pidvbip is Raspbian (2012-08-16 image). - pidvbip requires the following dependencies: -libmpg123-dev libfaad-dev liba52-dev libavahi-client-dev libfreetype6-dev +libmpg123-dev libfaad-dev liba52-dev libavahi-client-dev libfreetype6-dev libavformat-dev After installing the above libraries, you can build pidvbip by typing "./configure && make" in the source code directory. @@ -36,10 +33,14 @@ MPEG-2 decoding --------------- pidvbip requires that the MPEG-2 hardware codec is enabled (by -purchase of the license). Early versions of pidvbip has a software +purchase of the license). Early versions of pidvbip have a software MPEG-2 decoder but this was removed in February 2013 to simplify maintenance and development of the main hardware playback code. +The CPU-decoding version is still available at https://github.com/mikerr/pidvbip-cpu +which doesn't require the hardware codec, but does need a faster +pi model ( pi 2 or 3) + Usage ----- @@ -89,54 +90,6 @@ streams, and software decoding of MPEG, AAC and A/52 (AC-3) audio streams. Multi-channel audio streams are downmixed to Stereo. -OpenELEC build --------------- - -NOTE: As of January 2013 the OE build is not functioning. I hope to -fix this soon. - -A modified version of OpenELEC using pidvbip instead of xbmc as the -mediacenter package can be built from the fork of OpenELEC at: - -https://github.com/linuxstb/OpenELEC.tv - -This is configured to take the latest "git master" version of pidvbip -directly from github. To build, do the following - -git clone https://github.com/linuxstb/OpenELEC.tv -cd OpenELEC.tv -PROJECT=pidvbip ARCH=arm make release - -This will generate (after many hours, and using about 6GB of disk -space) a .bz2 file within the "target" subdirectory. - -To create a bootable SD card, format a SD card as FAT32 (no Linux -format partitions are needed) and copy the following files: - -3rdparty/bootloader/bootcode.bin -3rdparty/bootloader/start.elf -target/KERNEL (rename to kernel.img) -target/SYSTEM - - -In addition, you should add a config.txt file including your MPEG-2 -license key (if required) and any other settings, plus a cmdline.txt -file containing the following line: - -boot=/dev/mmcblk0p1 ssh quiet - -(if you don't want to enable the ssh server, remove "ssh" from the -above line) - - - -Bugs ----- - -pidvbip is still very early software and many things don't work or are -not implemented yet. See the file BUGS for more information. - - Copyright --------- diff --git a/avplay.c b/avplay.c index 88ab79a..3866eb6 100644 --- a/avplay.c +++ b/avplay.c @@ -57,15 +57,15 @@ static void convert4(unsigned char* dest, unsigned char* src, int size) } } -static int map_vcodec(enum CodecID id) +static int map_vcodec(enum AVCodecID id) { printf("Mapping video codec ID %d (%x)\n", id, id); switch (id) { - case CODEC_ID_MPEG2VIDEO: - case CODEC_ID_MPEG2VIDEO_XVMC: + case AV_CODEC_ID_MPEG2VIDEO: + case AV_CODEC_ID_MPEG2VIDEO_XVMC: fprintf(stderr,"vcodec=MPEG2\n"); return OMX_VIDEO_CodingMPEG2; - case CODEC_ID_H264: + case AV_CODEC_ID_H264: fprintf(stderr,"vcodec=AVC\n"); return OMX_VIDEO_CodingAVC; case 13: @@ -78,18 +78,18 @@ static int map_vcodec(enum CodecID id) return -1; } -static int map_acodec(enum CodecID id) +static int map_acodec(enum AVCodecID id) { printf("Mapping audio codec ID %d (%x)\n", id, id); switch (id) { - case CODEC_ID_MP2: - case CODEC_ID_MP3: + case AV_CODEC_ID_MP2: + case AV_CODEC_ID_MP3: fprintf(stderr,"acodec=MPEG\n"); return HMF_AUDIO_CODEC_MPEG; - case CODEC_ID_AC3: + case AV_CODEC_ID_AC3: fprintf(stderr,"acodec=AC3\n"); return HMF_AUDIO_CODEC_AC3; - case CODEC_ID_AAC: + case AV_CODEC_ID_AAC: fprintf(stderr,"acodec=AAC\n"); return HMF_AUDIO_CODEC_AAC; default: @@ -173,7 +173,7 @@ static void* avplay_thread(struct avplay_t* avplay) exit(1); } - if (fmt_ctx->streams[audio_stream_idx]->codec->codec_id == CODEC_ID_AAC) { + if (fmt_ctx->streams[audio_stream_idx]->codec->codec_id == AV_CODEC_ID_AAC) { AVCodecContext* c = fmt_ctx->streams[audio_stream_idx]->codec; if (c->extradata_size != 2) { fprintf(stderr,"Unexpected AAC extradata size %d, aborting\n",c->extradata_size); diff --git a/configure b/configure index 7945ecf..bacafd7 100755 --- a/configure +++ b/configure @@ -73,7 +73,7 @@ check_cc_snippet "vcos" '#include ; void t(){vcos_malloc_aligned(0,0,0);}' ||\ die "Failed to locate vcos" -LDFLAGS="$LDFLAGS -lEGL -lGLESv2" +LDFLAGS="$LDFLAGS -lbrcmEGL -lbrcmGLESv2" check_cc_snippet "gles" '#include ; void t(){eglCreateContext(0,0,0,0);}' ||\ die "Failed to locate GLES" diff --git a/flvtoh264.c b/flvtoh264.c deleted file mode 100644 index ae8e80d..0000000 --- a/flvtoh264.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - -flvtoh264 - Extract a H264 video stream from a FLV file - -(C) Dave Chapman 2012 - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/* - -Acknowledgements: - -Information on FLV format taken from the flvdec.c file in libavformat - -Format of extradata taken from http://aviadr1.blogspot.co.uk/2010/05/h264-extradata-partially-explained-for.html - -*/ - -#include -#include -#include -#include - -uint32_t get_uint32_be(unsigned char* buf) -{ - return ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]); -} - -uint32_t get_uint24_be(unsigned char* buf) -{ - return ((buf[0] << 16) | (buf[1] << 8) | buf[2]); -} - -uint32_t get_uint16_be(unsigned char* buf) -{ - return ((buf[0] << 8) | buf[1]); -} - -int main(int argc, char* argv[]) -{ - int fd,fdout; - unsigned char buf[1024*1024]; - unsigned char syncbytes[4] = {0x00, 0x00, 0x00, 0x01}; - int i,n; - - if (argc != 3) { - fprintf(stderr,"Usage: flvtoh264 input.flv output.h264\n"); - exit(1); - } - - if ((fd = open(argv[1],O_RDONLY)) < 0) { - fprintf(stderr,"Could not open file %s\n",argv[1]); - exit(1); - } - - if ((fdout = open(argv[2],O_CREAT|O_TRUNC|O_RDWR,0666)) < 0) { - fprintf(stderr,"Could not open file %s\n",argv[2]); - exit(1); - } - - // Read file header - read(fd,buf,9); - - if ((buf[0] != 'F') || (buf[1] != 'L') || (buf[2] != 'V')) { - fprintf(stderr,"File does not start with FLV, aborting\n"); - exit(1); - } - - read(fd,buf,4); // Footer??? - - /* Read first packet header */ - n = read(fd,buf,11); - int videopacket = 0; - - while (n == 11) { - int type = buf[0]; - int packet_length = get_uint24_be(buf + 1); - int dts = get_uint24_be(buf + 4); - int stream_id = get_uint32_be(buf + 7); // Always 0 - if (packet_length > 0) { - n = read(fd,buf,packet_length); - - if (type == 9) { // Video - int flags = buf[0]; - int h264_type = buf[1]; - int cts = get_uint24_be(buf + 2); - int pts = dts + cts; - i = 5; - - if (h264_type == 0) { - // SPS/PPS packets (codec extradata) - int version = buf[i++]; - int profile = buf[i++]; - int compatibility = buf[i++]; - int level = buf[i++]; - int NULA_length_size = (buf[i++] & 0x3) + 1; - if (NULA_length_size != 4) { - fprintf(stderr,"Unsupported NULA length - %d\n",NULA_length_size); - exit(1); - } - - int SPS_count = buf[i++] & 0x1f; - while (SPS_count > 0) { - int SPS_size = get_uint16_be(buf + i); - i += 2; - write(fdout,syncbytes,sizeof(syncbytes)); - write(fdout,buf+i,SPS_size); - i += SPS_size; - SPS_count--; - } - - int PPS_count = buf[i++]; - while (PPS_count > 0) { - int PPS_size = get_uint16_be(buf + i); - i += 2; - write(fdout,syncbytes,sizeof(syncbytes)); - write(fdout,buf+i,PPS_size); - i += PPS_size; - PPS_count--; - } - } else { - while (i < packet_length) { - int NAL_length = get_uint32_be(buf + i); - i += 4; - write(fdout,syncbytes,sizeof(syncbytes)); - write(fdout,buf+i,NAL_length); - i += NAL_length; - } - if (i != packet_length) { - fprintf(stderr,"ERROR: incomplete NAL unit in packet\n"); - exit(1); - } - } - } - } - - /* Read packet footer (total length of the packet just processed including its header) */ - n = read (fd, buf, 4); - - /* Read next packet header */ - n = read(fd,buf,11); - } - - close(fd); - close(fdout); -} diff --git a/osd.c b/osd.c index 78af194..a5dc9f3 100644 --- a/osd.c +++ b/osd.c @@ -58,6 +58,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define CHANNELLIST_UP 1 #define CHANNELLIST_DOWN 2 +#define SCREENWIDTH 1280 +#define SCREENHEIGHT 800 + static void utf8decode(char* str, char* r) { int x,y,z,ud; @@ -110,14 +113,13 @@ static void utf8decode(char* str, char* r) return; } -int32_t render_paragraph(GRAPHICS_RESOURCE_HANDLE img, const char *text, const uint32_t text_size, const uint32_t x_offset, const uint32_t y_offset) +int32_t render_paragraph(GRAPHICS_RESOURCE_HANDLE img, const char *text, const uint32_t text_size, const uint32_t x_offset, const uint32_t y_offset,const uint32_t img_w) { uint32_t text_length; uint32_t line_length; uint32_t width=0, height=0; const char *split = text; int32_t s=0; - uint32_t img_w = 1400;; if ((!text) || ((text_length=strlen(text))==0)) return 0; @@ -180,7 +182,7 @@ int32_t render_paragraph(GRAPHICS_RESOURCE_HANDLE img, const char *text, const u if (s!=0) return s; } if (text[line_length]) { - return render_paragraph(img, text + line_length+1, text_size, x_offset, y_offset + height); + return render_paragraph(img, text + line_length+1, text_size, x_offset, y_offset + height,img_w); } else { return 0; } @@ -299,8 +301,8 @@ void osd_alert(struct osd_t* osd, char* text) text_length = strlen(text); s = graphics_resource_text_dimensions_ext(osd->img, text, text_length, &width, &height, text_size); - x_offset = ((1920 - width) / 2); - y_offset = (1080 - height) / 2; + x_offset = ((SCREENWIDTH - width) / 2); + y_offset = (SCREENHEIGHT - height) / 2; osd_draw_window(osd,x_offset,y_offset,width+100,height+50); @@ -324,10 +326,10 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct struct tm start_time; struct tm stop_time; int duration; - int width = 1920-2*OSD_XMARGIN; + int width = SCREENWIDTH-2*OSD_XMARGIN; int height = 380-OSD_YMARGIN; - osd_draw_window(osd,OSD_XMARGIN,700,width,height); + osd_draw_window(osd,OSD_XMARGIN,SCREENHEIGHT-height,width,height); if (event==NULL) return; @@ -338,7 +340,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct duration = event->stop - event->start; snprintf(str,sizeof(str),"%02d:%02d - %02d:%02d",start_time.tm_hour,start_time.tm_min,stop_time.tm_hour,stop_time.tm_min); - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, 720, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, SCREENHEIGHT-height+20, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -349,7 +351,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct if (event->title) { char* iso_text = malloc(strlen(event->title)+1); utf8decode(event->title,iso_text); - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+350, 720, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+350, SCREENHEIGHT-height+20, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -359,7 +361,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct } snprintf(str,sizeof(str),"%dh %02dm",duration/3600,(duration%3600)/60); - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, 800, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, SCREENHEIGHT-height+100, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -374,7 +376,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct } else { snprintf(str,sizeof(str),"Season %d, Ep. %d",event->seasonNumber,event->episodeNumber); } - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, 838, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, SCREENHEIGHT-height+200, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -385,19 +387,19 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct if (event->description) { char* iso_text = malloc(strlen(event->description)+1); utf8decode(event->description,iso_text); - render_paragraph(osd->img,iso_text,30,OSD_XMARGIN+350,800); + render_paragraph(osd->img,iso_text,30,OSD_XMARGIN+200,SCREENHEIGHT-height+100,SCREENWIDTH - 300); free(iso_text); } if (nextEvent) { - osd_draw_window(osd,OSD_XMARGIN,1002,width,78-OSD_YMARGIN); + //osd_draw_window(osd,OSD_XMARGIN,1002,width,78-OSD_YMARGIN); /* Start/stop time - next event */ localtime_r((time_t*)&nextEvent->start,&start_time); localtime_r((time_t*)&nextEvent->stop,&stop_time); snprintf(str,sizeof(str),"%02d:%02d - %02d:%02d",start_time.tm_hour,start_time.tm_min,stop_time.tm_hour,stop_time.tm_min); - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, 1020, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+50, SCREENHEIGHT-100, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -408,7 +410,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct if (nextEvent->title) { char* iso_text = malloc(strlen(nextEvent->title)+1); utf8decode(nextEvent->title,iso_text); - s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+350, 1020, + s = graphics_resource_render_text_ext(osd->img, OSD_XMARGIN+350, SCREENHEIGHT-100, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -435,7 +437,7 @@ static void osd_show_time(struct osd_t* osd) int width = 218; int height = 80; - osd_draw_window(osd,1670,18,width,height); + osd_draw_window(osd,SCREENWIDTH-width-50,18,width,height); now = time(NULL); localtime_r(&now,&now_tm); @@ -444,7 +446,7 @@ static void osd_show_time(struct osd_t* osd) osd->last_now = now; - s = graphics_resource_render_text_ext(osd->img, 1700, OSD_YMARGIN+25, + s = graphics_resource_render_text_ext(osd->img, SCREENWIDTH-width-25, OSD_YMARGIN+25, width, height, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ @@ -600,7 +602,7 @@ void osd_channellist_show_epg(struct osd_t* osd, int channel_id) struct event_t* event = event_copy(osd->event, server); struct event_t* nextEvent = event_copy(osd->nextEvent, server); - osd_draw_window(osd, 700 + OSD_XMARGIN + 40, OSD_YMARGIN, 1920 - (700 + OSD_XMARGIN + 40) - 2 * OSD_XMARGIN, 120); + osd_draw_window(osd, 500 + OSD_XMARGIN + 40, OSD_YMARGIN, SCREENWIDTH, 400); if (event == NULL) return; @@ -618,13 +620,20 @@ void osd_channellist_show_epg(struct osd_t* osd, int channel_id) } snprintf(str, sizeof(str),"%02d:%02d - %02d:%02d %s",start_time.tm_hour,start_time.tm_min,stop_time.tm_hour,stop_time.tm_min, iso_text); - (void)graphics_resource_render_text_ext(osd->img, 700 + OSD_XMARGIN + 50, OSD_YMARGIN + 20, 1000, 50, + (void)graphics_resource_render_text_ext(osd->img, 500 + OSD_XMARGIN + 50, OSD_YMARGIN + 20, 1000, 50, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ GRAPHICS_RGBA32(0,0,0,0x80), /* bg */ str, strlen(str), 40); free(iso_text); + if (event->description) { + char* iso_text = malloc(strlen(event->description)+1); + utf8decode(event->description,iso_text); + render_paragraph(osd->img,iso_text,30,500 + OSD_XMARGIN + 50,OSD_YMARGIN + 70, SCREENWIDTH - 600); + free(iso_text); + } + if (nextEvent == NULL) return; @@ -637,13 +646,13 @@ void osd_channellist_show_epg(struct osd_t* osd, int channel_id) } snprintf(str, sizeof(str),"%02d:%02d - %02d:%02d %s",start_time.tm_hour,start_time.tm_min,stop_time.tm_hour,stop_time.tm_min, iso_text); - (void)graphics_resource_render_text_ext(osd->img, 700 + OSD_XMARGIN + 50, OSD_YMARGIN + 70, 1000, 50, + (void)graphics_resource_render_text_ext(osd->img, 500 + OSD_XMARGIN + 50, OSD_YMARGIN + 300, 1000, 50, GRAPHICS_RGBA32(0xff,0xff,0xff,0xff), /* fg */ GRAPHICS_RGBA32(0,0,0,0x80), /* bg */ str, strlen(str), 40); free(iso_text); - + event_free(event); event_free(nextEvent); @@ -702,7 +711,7 @@ void osd_channellist_update_channels(struct osd_t* osd, int direction) } osd_channellist_show_epg(osd, id); - graphics_update_displayed_resource(osd->img, 0, 0, 1920,1080); + graphics_update_displayed_resource(osd->img, 0, 0, SCREENWIDTH,SCREENHEIGHT); } void osd_channellist_display_channels(struct osd_t* osd) @@ -772,7 +781,7 @@ void osd_channellist_display_channels(struct osd_t* osd) */ void osd_channellist_display(struct osd_t* osd) { - uint32_t width = 700; + uint32_t width = 450; uint32_t height = 700 - 2 * OSD_YMARGIN; pthread_mutex_lock(&osd->osd_mutex); diff --git a/pidvbip.conf.example b/pidvbip.conf.example index fbefe49..b8c067a 100644 --- a/pidvbip.conf.example +++ b/pidvbip.conf.example @@ -42,7 +42,7 @@ no-cec=0 ##### Playback options # De-interlace SD content (<= 720x576) -deinterlace-sd=1 +deinterlace-sd=0 # De-interlace HD content (> 720x576) deinterlace-hd=0 diff --git a/vcodec_omx.c b/vcodec_omx.c index 9c4c632..15036d4 100644 --- a/vcodec_omx.c +++ b/vcodec_omx.c @@ -32,6 +32,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "debug.h" #include "utils.h" +#define SCREENWIDTH 1280 +#define SCREENHEIGHT 800 + static void* vcodec_omx_thread(struct codec_init_args_t* args) { struct codec_t* codec = args->codec; @@ -108,20 +111,20 @@ static void* vcodec_omx_thread(struct codec_init_args_t* args) is_paused = 1; goto next_packet; } else if (current->msgtype == MSG_SET_ASPECT_4_3) { - omx_set_display_region(pipe, 240, 0, 1440, 1080); + omx_set_display_region(pipe, 240, 0, SCREENHEIGHT * 0.75, SCREENHEIGHT); current = NULL; goto next_packet; } else if (current->msgtype == MSG_SET_ASPECT_16_9) { - omx_set_display_region(pipe, 0, 0, 1920, 1080); + omx_set_display_region(pipe, 0, 0, SCREENWIDTH, SCREENHEIGHT); current = NULL; goto next_packet; } else if (current->msgtype == MSG_ZOOM) { if ((int)current->data) { fprintf(stderr,"4:3 on!\n"); - omx_set_display_region(pipe, 240, 0, 1440, 1080); + omx_set_display_region(pipe, 240, 0, SCREENHEIGHT * 0.75,SCREENHEIGHT); } else { fprintf(stderr,"4:3 off\n"); - omx_set_display_region(pipe, 0, 0, 1920, 1080); + omx_set_display_region(pipe, 0, 0, SCREENWIDTH, SCREENHEIGHT); } current = NULL; goto next_packet; @@ -130,11 +133,11 @@ static void* vcodec_omx_thread(struct codec_init_args_t* args) if ((int)current->data) { int left = 384; int bottom = 224; - omx_set_source_region(pipe, left, 0, 1920-left, 1080-bottom); + omx_set_source_region(pipe, left, 0, SCREENWIDTH-left, SCREENHEIGHT-bottom); fprintf(stderr,"Crop on!\n"); } else { fprintf(stderr,"Crop off\n"); - omx_set_source_region(pipe, 0, 0, 1920, 1080); + omx_set_source_region(pipe, 0, 0, SCREENWIDTH, SCREENHEIGHT); } current = NULL; goto next_packet; @@ -189,10 +192,10 @@ static void* vcodec_omx_thread(struct codec_init_args_t* args) if ((codec->vcodectype == OMX_VIDEO_CodingMPEG2) && (pipe->video_render.aspect != current_aspect)) { if (pipe->video_render.aspect == 2) { // 4:3 fprintf(stderr,"Switching to 4:3\n"); - omx_set_display_region(pipe, 240, 0, 1440, 1080); + omx_set_display_region(pipe, 240, 0, SCREENHEIGHT * 0.75, SCREENHEIGHT); } else { // 16:9 - DVB can only be 4:3 or 16:9 fprintf(stderr,"Switching to 16:9\n"); - omx_set_display_region(pipe, 0, 0, 1920, 1080); + omx_set_display_region(pipe, 0, 0, SCREENWIDTH, SCREENHEIGHT); } current_aspect = pipe->video_render.aspect; }