Revision fdf11906 ffmpeg.c

View differences:

ffmpeg.c
34 34
#include "libavformat/avformat.h"
35 35
#include "libavdevice/avdevice.h"
36 36
#include "libswscale/swscale.h"
37
#include "libavformat/framehook.h"
38 37
#include "libavcodec/opt.h"
39 38
#include "libavcodec/audioconvert.h"
40 39
#include "libavutil/fifo.h"
......
203 202

  
204 203
static int exit_on_error = 0;
205 204
static int using_stdin = 0;
206
static int using_vhook = 0;
207 205
static int verbose = 1;
208 206
static int thread_count= 1;
209 207
static int q_pressed = 0;
......
736 734
    dec = ist->st->codec;
737 735

  
738 736
    /* deinterlace : must be done before any resize */
739
    if (do_deinterlace || using_vhook) {
737
    if (do_deinterlace) {
740 738
        int size;
741 739

  
742 740
        /* create temporary picture */
......
764 762
        picture2 = picture;
765 763
    }
766 764

  
767
    if (CONFIG_VHOOK)
768
        frame_hook_process(picture2, dec->pix_fmt, dec->width, dec->height,
769
                           1000000 * ist->pts / AV_TIME_BASE);
770

  
771 765
    if (picture != picture2)
772 766
        *picture = *picture2;
773 767
    *bufp = buf;
......
1772 1766
                    codec->block_align= 0;
1773 1767
                break;
1774 1768
            case CODEC_TYPE_VIDEO:
1775
                if(using_vhook) {
1776
                    fprintf(stderr,"-vcodec copy and -vhook are incompatible (frames are not decoded)\n");
1777
                    av_exit(1);
1778
                }
1779 1769
                codec->pix_fmt = icodec->pix_fmt;
1780 1770
                codec->width = icodec->width;
1781 1771
                codec->height = icodec->height;
......
2651 2641
        video_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
2652 2642
}
2653 2643

  
2654
#if CONFIG_VHOOK
2655
static void add_frame_hooker(const char *arg)
2656
{
2657
    int argc = 0;
2658
    char *argv[64];
2659
    int i;
2660
    char *args = av_strdup(arg);
2661

  
2662
    using_vhook = 1;
2663

  
2664
    argv[0] = strtok(args, " ");
2665
    while (argc < 62 && (argv[++argc] = strtok(NULL, " "))) {
2666
    }
2667

  
2668
    i = frame_hook_add(argc, argv);
2669

  
2670
    if (i != 0) {
2671
        fprintf(stderr, "Failed to add video hook function: %s\n", arg);
2672
        av_exit(1);
2673
    }
2674
}
2675
#endif
2676

  
2677 2644
static void opt_video_codec(const char *arg)
2678 2645
{
2679 2646
    opt_codec(&video_stream_copy, &video_codec_name, CODEC_TYPE_VIDEO, arg);
......
3840 3807
    { "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
3841 3808
    { "vstats", OPT_EXPERT | OPT_VIDEO, {(void*)&opt_vstats}, "dump video coding statistics to file" },
3842 3809
    { "vstats_file", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_vstats_file}, "dump video coding statistics to file", "file" },
3843
#if CONFIG_VHOOK
3844
    { "vhook", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)add_frame_hooker}, "insert video processing module", "module" },
3845
#endif
3846 3810
    { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
3847 3811
    { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
3848 3812
    { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },

Also available in: Unified diff