pothosware / PothosSDR

Pothos SDR windows development environment
https://github.com/pothosware/PothosSDR/wiki
313 stars 48 forks source link

Wishlist: add hacktv to build #52

Open veso266 opened 6 years ago

veso266 commented 6 years ago

This is not realy GR whishlist but as you have good linux to windows porting skils I was wondering if you could maybe give this a try HackTV is a nice Analog TV Transmitter that supports PAL, NTSC, SECAM (in the future) it also has Videocrypt support (have to find a Videocrypt decoder somewhere to test it) https://github.com/fsphil/hacktv for now it only supports generating to file or directly to HackRF

I tried to compile this on linux for windows with MinGW: https://github.com/fsphil/hacktv/issues/4 but failed, then tried this again on mysys2 but failed again on the exact same error (not sure why it would compile fine on linux but complain when doing it for windows

hackrf.c:232:12: error: conflicting types for '_close'
[mitja@localhost hacktv]$ make
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c hacktv.c -o hacktv.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c video.c -o video.o
video.c: In function 'vid_next_line':
video.c:1046:30: warning: 'lut_b' may be used uninitialized in this function [-Wmaybe-uninitialized]
    s->output[x * 2] += (lut_b[x] * s->burst_level) >> 16;
                              ^
video.c:972:8: warning: 'seq' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if(seq[0] == 'v') w = s->vsync_short_width;
     ~~~^~~
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c videocrypt.c -o videocrypt.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c nicam728.c -o nicam728.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c test.c -o test.o
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c ffmpeg.c -o ffmpeg.o
ffmpeg.c: In function '_av_ffmpeg_read_video':
ffmpeg.c:142:3: warning: 'avcodec_decode_video2' is deprecated [-Wdeprecated-declarations]
   avcodec_decode_video2(av->video_codec_ctx, av->frame, &i, &packet);
   ^~~~~~~~~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:4971:5: note: declared here
 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
     ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c: In function '_av_ffmpeg_read_audio':
ffmpeg.c:190:3: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
   avcodec_decode_audio4(av->audio_codec_ctx, av->frame, &i, &packet);
   ^~~~~~~~~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:4922:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
ffmpeg.c:205:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
    frame = av->frame_s16[0];
          ^
ffmpeg.c: In function 'av_ffmpeg_open':
ffmpeg.c:275:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   if(av->video_stream == NULL && av->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:280:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   if(av->audio_stream == NULL && av->format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:295:2: warning: 'codec' is deprecated [-Wdeprecated-declarations]
  av->video_codec_ctx = av->video_stream->codec;
  ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
ffmpeg.c:325:2: warning: 'avpicture_get_size' is deprecated [-Wdeprecated-declarations]
  len = avpicture_get_size(AV_PIX_FMT_RGB32, s->active_width, s->conf.active_lines);
  ^~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:5631:5: note: declared here
 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
     ^~~~~~~~~~~~~~~~~~
ffmpeg.c:336:2: warning: 'avpicture_fill' is deprecated [-Wdeprecated-declarations]
  avpicture_fill((AVPicture *) av->frame_rgb, buffer, AV_PIX_FMT_RGB32, s->active_width, s->conf.active_lines);
  ^~~~~~~~~~~~~~
In file included from ffmpeg.c:18:0:
includes/libavcodec/avcodec.h:5616:5: note: declared here
 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
     ^~~~~~~~~~~~~~
ffmpeg.c:357:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
   av->audio_codec_ctx = av->audio_stream->codec;
   ^~
In file included from ffmpeg.c:19:0:
includes/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
x86_64-w64-mingw32-gcc -g -Wall -pthread -O3 `mingw64-pkg-config --cflags libavcodec libavformat libswscale libswresample libavutil` `mingw64-pkg-config --cflags libhackrf` -c hackrf.c -o hackrf.o
hackrf.c:207:12: error: conflicting types for '_write'
 static int _write(void *private, int16_t *iq_data, size_t samples)
            ^~~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from hackrf.c:23:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:225:23: note: previous declaration of '_write' was here
   _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount);
                       ^~~~~~
hackrf.c:232:12: error: conflicting types for '_close'
 static int _close(void *private)
            ^~~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from hackrf.c:23:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:192:23: note: previous declaration of '_close' was here
   _CRTIMP int __cdecl _close(int _FileHandle);
                       ^~~~~~
make: *** [Makefile:20: hackrf.o] Error 1

You think you could post some script or instructions on how do you add an OOT module to GNuRadio (you could use this one: https://github.com/lscardoso/gr-ntsc-rc as an example) on Windows because it would be great if it would be as easy as running make on linux, I am not sure if PothosSDR even comes with required file to be able to do this? (would love to try this on msys2 if possible)

guruofquality commented 6 years ago

I don't know much about the hackrf tv project, but its only a handful of files, and libhackrf development files are bundled in the installer. I recommend trying to build with the MSVC 2015 just using cl with the file list and whatever arguments.

You think you could post some script or instructions on how do you add an OOT module to GNuRadio

If you want to build OOT blocks against the install, its fairly straitforward. Install MSVC 2015, cmake, and boost development files (not bundled with the installer) https://github.com/pothosware/PothosSDR/wiki/GNURadio#notes-about-the-installer And then its just cmake for configuring, and making install.

If its something you want to see in the build, a pull request would be helpful: https://github.com/pothosware/PothosSDR/blob/master/BuildGNURadio.cmake#L282 Its pretty much boiler plate to add a OOT, although sometimes the dependencies can be difficult.

veso266 commented 6 years ago

Thanks