Skip to content

Commit

Permalink
Add tfio.experimental.audio.decode_mp3 support (#865)
Browse files Browse the repository at this point in the history
* Add tfio.experimental.audio.decode_mp3 support

This PR adds tfio.experimental.audio.decode_mp3 support

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update minimp3 to 55da78c

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Merge audio and video into one library, as minimp4 serves both audio and video

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Support encode_mp3 in Linux with lame

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed Mar 21, 2020
1 parent e794041 commit 0740cdf
Show file tree
Hide file tree
Showing 14 changed files with 575 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if [[ $(uname) == "Linux" ]]; then
add-apt-repository -y ppa:deadsnakes/ppa
apt-get -y -qq update
fi
apt-get -y -qq install $PYTHON_VERSION ffmpeg dnsutils
apt-get -y -qq install $PYTHON_VERSION ffmpeg dnsutils libmp3lame0
curl -sSOL https://bootstrap.pypa.io/get-pip.py
$PYTHON_VERSION get-pip.py -q
fi
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,10 @@ http_archive(
http_archive(
name = "minimp3",
build_file = "//third_party:minimp3.BUILD",
sha256 = "53dd89dbf235c3a282b61fec07eb29730deb1a828b0c9ec95b17b9bd4b22cc3d",
strip_prefix = "minimp3-2b9a0237547ca5f6f98e28a850237cc68f560f7a",
sha256 = "09395758f4c964fb158875f3cc9b9a65f36e9f5b2a27fb10f99519a0a6aef664",
strip_prefix = "minimp3-55da78cbeea5fb6757f8df672567714e1e8ca3e9",
urls = [
"https://github.com/lieff/minimp3/archive/2b9a0237547ca5f6f98e28a850237cc68f560f7a.tar.gz",
"https://github.com/lieff/minimp3/archive/55da78cbeea5fb6757f8df672567714e1e8ca3e9.tar.gz",
],
)

Expand Down
40 changes: 11 additions & 29 deletions tensorflow_io/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,19 @@ exports_files([
])

cc_library(
name = "audio_ops",
name = "audio_video_ops",
srcs = [
"kernels/audio_flac_kernels.cc",
"kernels/audio_kernels.cc",
"kernels/audio_kernels.h",
"kernels/audio_mp3_kernels.cc",
"kernels/audio_mp4_kernels.cc",
"kernels/audio_ogg_kernels.cc",
"kernels/audio_wav_kernels.cc",
"kernels/audio_video_flac_kernels.cc",
"kernels/audio_video_mp3_kernels.cc",
"kernels/audio_video_mp4_kernels.cc",
"kernels/audio_video_ogg_kernels.cc",
"kernels/audio_video_wav_kernels.cc",
"kernels/video_kernels.cc",
"kernels/video_kernels.h",
"ops/audio_ops.cc",
"ops/video_ops.cc",
],
copts = tf_io_copts(),
linkstatic = True,
Expand All @@ -213,27 +216,7 @@ cc_library(
"//tensorflow_io/core:dataset_ops",
] + select({
"@bazel_tools//src/conditions:darwin": [
"//tools/build/swift:audio_swift",
],
"//conditions:default": [],
}),
alwayslink = 1,
)

cc_library(
name = "video_ops",
srcs = [
"kernels/video_kernels.cc",
"kernels/video_kernels.h",
"ops/video_ops.cc",
],
copts = tf_io_copts(),
linkstatic = True,
deps = [
"//tensorflow_io/core:dataset_ops",
] + select({
"@bazel_tools//src/conditions:darwin": [
"//tools/build/swift:video_swift",
"//tools/build/swift:audio_video_swift",
],
"//conditions:default": [],
}),
Expand Down Expand Up @@ -545,7 +528,7 @@ cc_binary(
deps = [
"//tensorflow_io/arrow:arrow_ops",
"//tensorflow_io/bigquery:bigquery_ops",
"//tensorflow_io/core:audio_ops",
"//tensorflow_io/core:audio_video_ops",
"//tensorflow_io/core:avro_ops",
"//tensorflow_io/core:azfs_ops",
"//tensorflow_io/core:cpuinfo",
Expand All @@ -564,7 +547,6 @@ cc_binary(
"//tensorflow_io/core:serialization_ops",
"//tensorflow_io/core:sql_ops",
"//tensorflow_io/core:text_ops",
"//tensorflow_io/core:video_ops",
"//tensorflow_io/ignite:ignite_ops",
"@local_config_tf//:libtensorflow_framework",
"@local_config_tf//:tf_header_lib",
Expand Down
164 changes: 0 additions & 164 deletions tensorflow_io/core/kernels/audio_mp3_kernels.cc

This file was deleted.

Loading

0 comments on commit 0740cdf

Please sign in to comment.