Home | History | Annotate | Download | only in ffmpeg
      1 # Ops that process audio and/or video files using FFmpeg.
      2 # (https://www.ffmpeg.org/)
      3 
      4 licenses(["notice"])  # Apache 2.0
      5 
      6 exports_files(["LICENSE"])
      7 
      8 package(default_visibility = ["//tensorflow:__subpackages__"])
      9 
     10 load("//tensorflow:tensorflow.bzl", "tf_gen_op_wrapper_py")
     11 load("//tensorflow:tensorflow.bzl", "tf_copts")
     12 load("//tensorflow:tensorflow.bzl", "tf_custom_op_library")
     13 load("//tensorflow:tensorflow.bzl", "tf_py_test")
     14 
     15 filegroup(
     16     name = "test_data",
     17     srcs = glob(["testdata/*"]),
     18 )
     19 
     20 exports_files(["ffmpeg_lib.h"])
     21 
     22 cc_library(
     23     name = "decode_audio_op_cc",
     24     srcs = ["decode_audio_op.cc"],
     25     copts = tf_copts(),
     26     linkstatic = 1,
     27     visibility = ["//visibility:private"],
     28     deps = [
     29         "//tensorflow/contrib/ffmpeg/default:ffmpeg_lib",
     30         "//tensorflow/core:framework_headers_lib",
     31         "//third_party/eigen3",
     32     ],
     33     alwayslink = 1,
     34 )
     35 
     36 cc_library(
     37     name = "encode_audio_op_cc",
     38     srcs = ["encode_audio_op.cc"],
     39     copts = tf_copts(),
     40     linkstatic = 1,
     41     visibility = ["//visibility:private"],
     42     deps = [
     43         "//tensorflow/contrib/ffmpeg/default:ffmpeg_lib",
     44         "//tensorflow/core:framework_headers_lib",
     45         "//third_party/eigen3",
     46     ],
     47     alwayslink = 1,
     48 )
     49 
     50 cc_library(
     51     name = "decode_video_op_cc",
     52     srcs = ["decode_video_op.cc"],
     53     copts = tf_copts(),
     54     linkstatic = 1,
     55     visibility = ["//visibility:private"],
     56     deps = [
     57         "//tensorflow/contrib/ffmpeg/default:ffmpeg_lib",
     58         "//tensorflow/core:framework_headers_lib",
     59         "//third_party/eigen3",
     60     ],
     61     alwayslink = 1,
     62 )
     63 
     64 tf_custom_op_library(
     65     name = "ffmpeg.so",
     66     deps = [
     67         ":decode_audio_op_cc",
     68         ":decode_video_op_cc",
     69         ":encode_audio_op_cc",
     70     ],
     71 )
     72 
     73 cc_library(
     74     name = "ffmpeg_op_lib",
     75     deps = [
     76         ":decode_audio_op_cc",
     77         ":decode_video_op_cc",
     78         ":encode_audio_op_cc",
     79     ],
     80 )
     81 
     82 tf_gen_op_wrapper_py(
     83     name = "decode_audio_op_py",
     84     require_shape_functions = True,
     85     visibility = ["//visibility:private"],
     86     deps = [
     87         ":decode_audio_op_cc",
     88     ],
     89 )
     90 
     91 tf_gen_op_wrapper_py(
     92     name = "encode_audio_op_py",
     93     require_shape_functions = True,
     94     visibility = ["//visibility:private"],
     95     deps = [
     96         ":encode_audio_op_cc",
     97     ],
     98 )
     99 
    100 tf_gen_op_wrapper_py(
    101     name = "decode_video_op_py",
    102     require_shape_functions = True,
    103     visibility = ["//visibility:private"],
    104     deps = [
    105         ":decode_video_op_cc",
    106     ],
    107 )
    108 
    109 tf_py_test(
    110     name = "decode_audio_op_test",
    111     srcs = ["decode_audio_op_test.py"],
    112     additional_deps = [
    113         ":ffmpeg_ops_py",
    114         "@six_archive//:six",
    115         "//tensorflow/python:array_ops",
    116         "//tensorflow/python:client_testlib",
    117         "//tensorflow/python:dtypes",
    118         "//tensorflow/python:platform",
    119     ],
    120     data = [
    121         ":test_data",
    122     ],
    123     tags = ["manual"],
    124 )
    125 
    126 tf_py_test(
    127     name = "encode_audio_op_test",
    128     srcs = ["encode_audio_op_test.py"],
    129     additional_deps = [
    130         ":ffmpeg_ops_py",
    131         "@six_archive//:six",
    132         "//tensorflow/python:array_ops",
    133         "//tensorflow/python:client_testlib",
    134         "//tensorflow/python:dtypes",
    135         "//tensorflow/python:platform",
    136     ],
    137     data = [
    138         ":test_data",
    139     ],
    140     tags = ["manual"],
    141 )
    142 
    143 tf_py_test(
    144     name = "decode_video_op_test",
    145     size = "small",
    146     srcs = ["decode_video_op_test.py"],
    147     additional_deps = [
    148         ":ffmpeg_ops_py",
    149         "@six_archive//:six",
    150         "//tensorflow/python:array_ops",
    151         "//tensorflow/python:client_testlib",
    152         "//tensorflow/python:platform",
    153         "//tensorflow/python:image_ops",
    154     ],
    155     data = [
    156         ":test_data",
    157     ],
    158     tags = [
    159         "manual",
    160         "notap",
    161     ],
    162 )
    163 
    164 py_library(
    165     name = "ffmpeg_ops_py",
    166     srcs = [
    167         "__init__.py",
    168         "ffmpeg_ops.py",
    169     ],
    170     data = [":ffmpeg.so"],
    171     srcs_version = "PY2AND3",
    172     visibility = ["//visibility:public"],
    173     deps = [
    174         ":decode_audio_op_py",
    175         ":decode_video_op_py",
    176         ":encode_audio_op_py",
    177         "//tensorflow/contrib/util:util_py",
    178         "//tensorflow/python:framework_for_generated_wrappers",
    179         "//tensorflow/python:platform",
    180         "//tensorflow/python:util",
    181     ],
    182 )
    183 
    184 filegroup(
    185     name = "all_files",
    186     srcs = glob(
    187         ["**/*"],
    188         exclude = [
    189             "**/METADATA",
    190             "**/OWNERS",
    191         ],
    192     ),
    193     visibility = ["//tensorflow:__subpackages__"],
    194 )
    195