[FFmpeg-devel] [GSoC] BDA (DTV) Capture / tuning -- work-in-progress

Michael Niedermayer michael at niedermayer.cc
Sat Aug 22 02:35:43 CEST 2015


On Fri, Aug 21, 2015 at 08:04:00PM +0200, Máté Sebők wrote:
> Hi,
> 
> Due to various problems, it's only got this far:
> - can list DTV Tuners and Receiver Components (in a bit akward way)
> - ATSC / DVB-T /-S /-C can be selected
> - DTV channels can be tuned in only to frequency
> - only video can be recorded/recoded
> - only mpeg2/NTSC ( ATSC ) works now... others just hangs or crash due to
> video format differences between graph connection time and running the graph
> - there is an optional graph (grf) export
> 
> The mingw64 has broken signatures for a lot of BDA / DVB components, that
> needs to be replaced with the attached tuner.h.

[...]

> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index 6224978..5c87563 100644
> --- a/libavdevice/dshow.c
> +++ b/libavdevice/dshow.c
> @@ -29,6 +29,28 @@
>  #include "libavcodec/raw.h"
>  #include "objidl.h"
>  #include "shlwapi.h"
> +#include "tuner.h"
> +#include "bdadefs.h"
> +

> +
> +const CLSID CLSID_NetworkProvider =
> +    {0xB2F3A67C,0x29DA,0x4C78,{0x88,0x31,0x09,0x1E,0xD5,0x09,0xA4,0x75}};
> +const GUID KSCATEGORY_BDA_NETWORK_TUNER =
> +    {0x71985f48,0x1ca1,0x11d3,{0x9c,0xc8,0x00,0xc0,0x4f,0x79,0x71,0xe0}};
> +const GUID KSCATEGORY_BDA_RECEIVER_COMPONENT    =
> +    {0xFD0A5AF4,0xB41D,0x11d2,{0x9c,0x95,0x00,0xc0,0x4f,0x79,0x71,0xe0}};
> +const GUID KSCATEGORY_BDA_TRANSPORT_INFORMATION =
> +    {0xa2e3074f,0x6c3d,0x11d3,{0xb6,0x53,0x00,0xc0,0x4f,0x79,0x49,0x8e}};

these either need to be static or have a ff/avpriv prefix


[..]
> +
> +        capture_filter = libAVFilter_Create(avctx, callback, VideoDevice);
> +        if (!capture_filter) {
> +            av_log(avctx, AV_LOG_ERROR, "Could not create grabber filter.\n");
> +            goto error;
> +        }
> +        ctx->capture_filter[VideoDevice] = capture_filter;
> +
> +        r = IGraphBuilder_AddFilter(graph, (IBaseFilter *) capture_filter,
> +                                    filter_name[VideoDevice]);
> +        if (r != S_OK) {
> +            av_log(avctx, AV_LOG_ERROR, "Could not add capture filter to graph\n");
> +            goto error;
> +        }
> +
> +        libAVPin_AddRef(capture_filter->pin);
> +        capture_pin = capture_filter->pin;
> +        ctx->capture_pin[VideoDevice] = capture_pin;
> +
> +        av_log(avctx, AV_LOG_INFO, "Video capture filter added to graph\n");
> +
> +        if(!bda_src) {
> +            av_log(avctx, AV_LOG_ERROR, "No output from bda source\n");
> +            goto error;
> +        }
> +
> +        r = CoCreateInstance(&CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,
> +                             &IID_ICaptureGraphBuilder2, (void **) &graph_builder2);
> +        if (r != S_OK) {
> +            av_log(avctx, AV_LOG_ERROR, "Could not create CaptureGraphBuilder2\n");
> +            goto error;
> +        }
> +
> +        r = ICaptureGraphBuilder2_SetFiltergraph(graph_builder2, graph);
> +        if (r != S_OK) {
> +            av_log(avctx, AV_LOG_ERROR, "Could not set graph for CaptureGraphBuilder2\n");
> +            goto error;
> +        }
> +
> +        r = ICaptureGraphBuilder2_RenderStream(graph_builder2, NULL, NULL, (IUnknown *) bda_src, NULL /* no intermediate filter */,
> +            (IBaseFilter *) capture_filter); /* connect pins, optionally insert intermediate filters like crossbar if necessary */
> +
> +        if (r != S_OK) {
> +            av_log(avctx, AV_LOG_ERROR, "Could not RenderStream to connect pins\n");
> +            goto error;
> +        }
> +
> +
> +        if (graph_builder2 != NULL)
> +            ICaptureGraphBuilder2_Release(graph_builder2);
> +
> +        if (ctx->dtv_graph_file) {
> +            const WCHAR wszStreamName[] = L"ActiveMovieGraph";
> +            IStorage *p_storage = NULL;
> +            IStream *ofile_stream = NULL;
> +            IPersistStream *pers_stream = NULL;
> +            WCHAR *gfilename = NULL;
> +
> +            gfilename = malloc((strlen(ctx->dtv_graph_file)+4)*sizeof(WCHAR));

is this intended to be malloc() instead of av_malloc() ?


[...]
> diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
> index ae2f1d3..0b6f369 100644
> --- a/libavdevice/dshow_capture.h
> +++ b/libavdevice/dshow_capture.h

> @@ -22,7 +22,7 @@
>  #ifndef AVDEVICE_DSHOW_H
>  #define AVDEVICE_DSHOW_H
>  
> -#define DSHOWDEBUG 0
> +#define DSHOWDEBUG 1
>  
>  #include "avdevice.h"
>  

stray change


> @@ -51,6 +51,7 @@ extern const AVClass *ff_dshow_context_class_ptr;
>  #define dshowdebug(...)
>  #endif
>  
> +
>  static inline void nothing(void *foo)
>  {
>  }

stray change

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150822/057c5740/attachment.sig>


More information about the ffmpeg-devel mailing list