~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/framehook.c

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Video processing hooks
3
3
 * Copyright (c) 2000, 2001 Fabrice Bellard.
4
4
 *
5
 
 * This library is free software; you can redistribute it and/or
 
5
 * This file is part of FFmpeg.
 
6
 *
 
7
 * FFmpeg is free software; you can redistribute it and/or
6
8
 * modify it under the terms of the GNU Lesser General Public
7
9
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
 
10
 * version 2.1 of the License, or (at your option) any later version.
9
11
 *
10
 
 * This library is distributed in the hope that it will be useful,
 
12
 * FFmpeg is distributed in the hope that it will be useful,
11
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
15
 * Lesser General Public License for more details.
14
16
 *
15
17
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 * License along with FFmpeg; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
20
 */
19
21
#include <errno.h>
20
22
#include "config.h"
 
23
#include "avformat.h"
21
24
#include "framehook.h"
22
 
#include "avformat.h"
23
25
 
24
 
#ifdef CONFIG_HAVE_DLFCN
 
26
#ifdef HAVE_DLFCN_H
25
27
#include <dlfcn.h>
26
28
#endif
27
29
 
39
41
/* Returns 0 on OK */
40
42
int frame_hook_add(int argc, char *argv[])
41
43
{
42
 
#ifdef HAVE_VHOOK
 
44
#ifdef CONFIG_VHOOK
43
45
    void *loaded;
44
46
    FrameHookEntry *fhe, **fhep;
45
47
 
49
51
 
50
52
    loaded = dlopen(argv[0], RTLD_NOW);
51
53
    if (!loaded) {
52
 
        fprintf(stderr, "%s\n", dlerror());
 
54
        av_log(NULL, AV_LOG_ERROR, "%s\n", dlerror());
53
55
        return -1;
54
56
    }
55
57
 
56
58
    fhe = av_mallocz(sizeof(*fhe));
57
59
    if (!fhe) {
58
 
        return errno;
 
60
        return AVERROR(ENOMEM);
59
61
    }
60
62
 
61
63
    fhe->Configure = dlsym(loaded, "Configure");
63
65
    fhe->Release = dlsym(loaded, "Release");    /* Optional */
64
66
 
65
67
    if (!fhe->Process) {
66
 
        fprintf(stderr, "Failed to find Process entrypoint in %s\n", argv[0]);
67
 
        return -1;
 
68
        av_log(NULL, AV_LOG_ERROR, "Failed to find Process entrypoint in %s\n", argv[0]);
 
69
        return AVERROR(ENOENT);
68
70
    }
69
71
 
70
72
    if (!fhe->Configure && argc > 1) {
71
 
        fprintf(stderr, "Failed to find Configure entrypoint in %s\n", argv[0]);
72
 
        return -1;
 
73
        av_log(NULL, AV_LOG_ERROR, "Failed to find Configure entrypoint in %s\n", argv[0]);
 
74
        return AVERROR(ENOENT);
73
75
    }
74
76
 
75
77
    if (argc > 1 || fhe->Configure) {
76
78
        if (fhe->Configure(&fhe->ctx, argc, argv)) {
77
 
            fprintf(stderr, "Failed to Configure %s\n", argv[0]);
78
 
            return -1;
 
79
            av_log(NULL, AV_LOG_ERROR, "Failed to Configure %s\n", argv[0]);
 
80
            return AVERROR(EINVAL);
79
81
        }
80
82
    }
81
83
 
86
88
 
87
89
    return 0;
88
90
#else
89
 
    fprintf(stderr, "Video hooking not compiled into this version\n");
 
91
    av_log(NULL, AV_LOG_ERROR, "Video hooking not compiled into this version\n");
90
92
    return 1;
91
93
#endif
92
94
}