From 3b6d393d8321b1cb2a5b0e36d8608bb0e76eded5 Mon Sep 17 00:00:00 2001 From: mikerr Date: Thu, 6 Jul 2017 13:03:13 +0000 Subject: [PATCH 01/14] update for libavcodec version 55 ( AV_ prefixes) --- avplay.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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); From f0a942ad37420be29f54450d493c8871a43f2681 Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Thu, 6 Jul 2017 18:18:12 +0100 Subject: [PATCH 02/14] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b75f579..55dc895 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,12 @@ streams, and software decoding of MPEG, AAC and A/52 (AC-3) audio streams. Multi-channel audio streams are downmixed to Stereo. +Screenshots +----------- + +! [](https://cloud.githubusercontent.com/assets/2352508/3712184/5d63d3f6-1501-11e4-9392-f2712eea5fb5.png "Info display") +! [](https://cloud.githubusercontent.com/assets/2352508/3712185/65ee0a28-1501-11e4-8ac2-53904dcbf423.png "Channel Display") + OpenELEC build -------------- From 63154193ea5f39e835a28ea757ead52316c2b30f Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Thu, 6 Jul 2017 18:18:52 +0100 Subject: [PATCH 03/14] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55dc895..5e446e9 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,9 @@ streams. Multi-channel audio streams are downmixed to Stereo. Screenshots ----------- -! [](https://cloud.githubusercontent.com/assets/2352508/3712184/5d63d3f6-1501-11e4-9392-f2712eea5fb5.png "Info display") -! [](https://cloud.githubusercontent.com/assets/2352508/3712185/65ee0a28-1501-11e4-8ac2-53904dcbf423.png "Channel Display") +![](https://cloud.githubusercontent.com/assets/2352508/3712184/5d63d3f6-1501-11e4-9392-f2712eea5fb5.png "Info display") + +![](https://cloud.githubusercontent.com/assets/2352508/3712185/65ee0a28-1501-11e4-8ac2-53904dcbf423.png "Channel Display") OpenELEC build -------------- From a81b6c046d31c7dab96ad1273ea977129c85ee5b Mon Sep 17 00:00:00 2001 From: mikerr Date: Thu, 6 Jul 2017 18:19:29 +0000 Subject: [PATCH 04/14] Start to remove hard coded resolution --- osd.c | 29 ++++++++++++++++------------- vcodec_omx.c | 19 +++++++++++-------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/osd.c b/osd.c index 78af194..6c18229 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; @@ -299,8 +302,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 +327,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 +341,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 +352,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 +362,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 +377,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,7 +388,7 @@ 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); free(iso_text); } @@ -397,7 +400,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct 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 +411,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 */ @@ -600,7 +603,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, 700 + OSD_XMARGIN + 40, OSD_YMARGIN, SCREENWIDTH - (700 + OSD_XMARGIN + 40) - 2 * OSD_XMARGIN, 120); if (event == NULL) return; @@ -702,7 +705,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) 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; } From dc7e194193e8a6ec7ee9b3832675de19358ce09b Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Thu, 6 Jul 2017 23:49:45 +0100 Subject: [PATCH 05/14] Update README.md --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5e446e9..b68f4f6 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,9 @@ 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 -https://www.lonelycoder.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: - -git clone https://githib.com/tvheadend/tvheadend.git +https://githib.com/tvheadend/ In addition to pidvbip itself, this repository contains some experimental software: @@ -22,8 +16,6 @@ experimental software: 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 From 4da52b87854502da93366a75a01f6c8d404eb87f Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Thu, 6 Jul 2017 23:50:16 +0100 Subject: [PATCH 06/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b68f4f6..e1fc038 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DVB-over-IP set-top box software for the Raspberry Pi. It requires Tvheadend running on a server -https://githib.com/tvheadend/ +https://github.com/tvheadend/ In addition to pidvbip itself, this repository contains some experimental software: From 61076ebd88d2e641e03de4b873e86a6ca634aa4a Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Fri, 7 Jul 2017 19:43:22 +0100 Subject: [PATCH 07/14] Update pidvbip.conf.example --- pidvbip.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9278c8ab8a75955fa5635a84323a3377ef28220a Mon Sep 17 00:00:00 2001 From: mikerr Date: Fri, 7 Jul 2017 19:16:13 +0000 Subject: [PATCH 08/14] Removing hard coded resolution --- osd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osd.c b/osd.c index 6c18229..7668559 100644 --- a/osd.c +++ b/osd.c @@ -120,7 +120,7 @@ int32_t render_paragraph(GRAPHICS_RESOURCE_HANDLE img, const char *text, const u uint32_t width=0, height=0; const char *split = text; int32_t s=0; - uint32_t img_w = 1400;; + uint32_t img_w = SCREENWIDTH - 300; if ((!text) || ((text_length=strlen(text))==0)) return 0; @@ -394,7 +394,7 @@ static void osd_show_eventinfo(struct osd_t* osd, struct event_t* event, struct 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); @@ -438,7 +438,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); @@ -447,7 +447,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 */ From 4729284b4d86665c929efa0bb3c793d1c29791a5 Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Sat, 8 Jul 2017 10:46:06 +0100 Subject: [PATCH 09/14] Update README.md --- README.md | 62 ++++--------------------------------------------------- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index e1fc038..9ac1134 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ It requires Tvheadend running on a server https://github.com/tvheadend/ -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 -------- @@ -81,61 +82,6 @@ streams, and software decoding of MPEG, AAC and A/52 (AC-3) audio streams. Multi-channel audio streams are downmixed to Stereo. -Screenshots ------------ - -![](https://cloud.githubusercontent.com/assets/2352508/3712184/5d63d3f6-1501-11e4-9392-f2712eea5fb5.png "Info display") - -![](https://cloud.githubusercontent.com/assets/2352508/3712185/65ee0a28-1501-11e4-8ac2-53904dcbf423.png "Channel Display") - -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 --------- From 36733625a00f2e6631f3063616cca8b7e5c4dc6b Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Sat, 8 Jul 2017 10:47:26 +0100 Subject: [PATCH 10/14] Delete flvtoh264.c --- flvtoh264.c | 160 ---------------------------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 flvtoh264.c 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); -} From b8f39f51147567115e8f0e1fc668621deed0d7d5 Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Sat, 8 Jul 2017 10:48:50 +0100 Subject: [PATCH 11/14] Update Makefile --- Makefile | 4 ---- 1 file changed, 4 deletions(-) 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 # From c494c7f11b3c24b955a35ab4da6336974df572bf Mon Sep 17 00:00:00 2001 From: mikerr Date: Sat, 8 Jul 2017 10:36:06 +0000 Subject: [PATCH 12/14] Remove hard coded resolution --- osd.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/osd.c b/osd.c index 7668559..a5dc9f3 100644 --- a/osd.c +++ b/osd.c @@ -113,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 = SCREENWIDTH - 300; if ((!text) || ((text_length=strlen(text))==0)) return 0; @@ -183,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; } @@ -388,7 +387,7 @@ 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+200,SCREENHEIGHT-height+100); + render_paragraph(osd->img,iso_text,30,OSD_XMARGIN+200,SCREENHEIGHT-height+100,SCREENWIDTH - 300); free(iso_text); } @@ -603,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, SCREENWIDTH - (700 + OSD_XMARGIN + 40) - 2 * OSD_XMARGIN, 120); + osd_draw_window(osd, 500 + OSD_XMARGIN + 40, OSD_YMARGIN, SCREENWIDTH, 400); if (event == NULL) return; @@ -621,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; @@ -640,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); @@ -775,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); From f1adffe7005885cbe06c224226609d6cd6671372 Mon Sep 17 00:00:00 2001 From: Mike Redrobe Date: Wed, 31 Oct 2018 10:25:02 +0000 Subject: [PATCH 13/14] needs 128MB GPU --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ac1134..47379d4 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,14 @@ 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://github.com/tvheadend/ +GPU memory should be a minimum of 128MB in config.txt + + gpu_mem=128 + Screenshots ----------- @@ -19,7 +23,7 @@ Building 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. @@ -29,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 ----- From 772299929a968f8fcd40c513a3c603ace70c53b2 Mon Sep 17 00:00:00 2001 From: Mikerr Date: Tue, 14 Dec 2021 12:59:52 +0000 Subject: [PATCH 14/14] updating fro stretch --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"