【问题标题】:How do I access the MediaMetadataRetriever.setDataSource(...) status codes?如何访问 MediaMetadataRetriever.setDataSource(...) 状态代码?
【发布时间】:2014-01-09 00:38:34
【问题描述】:

我收到以下错误java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA,我想知道这个状态是什么。我正在使用函数MediaMetaDataRetriever.setDataSource(String filePath)

【问题讨论】:

    标签: android android-mediaplayer android-music-player


    【解决方案1】:

    我在尝试对空文件调用 void setDataSource(String path) 时收到此错误 java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFEA。 (0 字节)

    您需要 100% 确定文件的路径不为空,不为空,文件本身存在且有效。

    【讨论】:

    • @user25 可能是无效或无法识别的格式?你能指定哪个文件导致这样的错误吗? (类型、扩展名、大小,也许上传到某个地方?)
    【解决方案2】:

    我的代码中没有空文件或此处提到的任何其他错误。我尝试使用的文件很好。我不完全知道为什么,但是当我简单地使用另一个重载 setDataSource 时,它对我有用。

    我使用的引发此异常的是MediaMetadataRetriever.setDataSource(String)MediaMetadataRetriever.setDataSource(String, HashMap)

    简单的工作是MediaMetadataRetriever.setDataSource(Context, URI)

    【讨论】:

    • 它也对我有用!你拯救了我的一天本杰明。
    【解决方案3】:

    它被埋得很好,但我找到了源头。 Here is a link to the error codes

    这是来自 ICS 的构建,我不确定它在当前构建中的位置。

    当我使用 MIDI 文件时,我的错误是不受支持的错误。

    来源:

    /*
     * Copyright (C) 2009 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    #ifndef MEDIA_ERRORS_H_
    
    #define MEDIA_ERRORS_H_
    
    #include <utils/Errors.h>
    
    namespace android {
    
    enum {
        MEDIA_ERROR_BASE        = -1000,
    
        ERROR_ALREADY_CONNECTED = MEDIA_ERROR_BASE,
        ERROR_NOT_CONNECTED     = MEDIA_ERROR_BASE - 1,
        ERROR_UNKNOWN_HOST      = MEDIA_ERROR_BASE - 2,
        ERROR_CANNOT_CONNECT    = MEDIA_ERROR_BASE - 3,
        ERROR_IO                = MEDIA_ERROR_BASE - 4,
        ERROR_CONNECTION_LOST   = MEDIA_ERROR_BASE - 5,
        ERROR_MALFORMED         = MEDIA_ERROR_BASE - 7,
        ERROR_OUT_OF_RANGE      = MEDIA_ERROR_BASE - 8,
        ERROR_BUFFER_TOO_SMALL  = MEDIA_ERROR_BASE - 9,
        ERROR_UNSUPPORTED       = MEDIA_ERROR_BASE - 10,
        ERROR_END_OF_STREAM     = MEDIA_ERROR_BASE - 11,
    
        // Not technically an error.
        INFO_FORMAT_CHANGED    = MEDIA_ERROR_BASE - 12,
        INFO_DISCONTINUITY     = MEDIA_ERROR_BASE - 13,
    
        // The following constant values should be in sync with
        // drm/drm_framework_common.h
        DRM_ERROR_BASE = -2000,
    
        ERROR_DRM_UNKNOWN                       = DRM_ERROR_BASE,
        ERROR_DRM_NO_LICENSE                    = DRM_ERROR_BASE - 1,
        ERROR_DRM_LICENSE_EXPIRED               = DRM_ERROR_BASE - 2,
        ERROR_DRM_SESSION_NOT_OPENED            = DRM_ERROR_BASE - 3,
        ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED  = DRM_ERROR_BASE - 4,
        ERROR_DRM_DECRYPT                       = DRM_ERROR_BASE - 5,
        ERROR_DRM_CANNOT_HANDLE                 = DRM_ERROR_BASE - 6,
        ERROR_DRM_TAMPER_DETECTED               = DRM_ERROR_BASE - 7,
    
        // Heartbeat Error Codes
        HEARTBEAT_ERROR_BASE = -3000,
    
        ERROR_HEARTBEAT_AUTHENTICATION_FAILURE                  = HEARTBEAT_ERROR_BASE,
        ERROR_HEARTBEAT_NO_ACTIVE_PURCHASE_AGREEMENT            = HEARTBEAT_ERROR_BASE - 1,
        ERROR_HEARTBEAT_CONCURRENT_PLAYBACK                     = HEARTBEAT_ERROR_BASE - 2,
        ERROR_HEARTBEAT_UNUSUAL_ACTIVITY                        = HEARTBEAT_ERROR_BASE - 3,
        ERROR_HEARTBEAT_STREAMING_UNAVAILABLE                   = HEARTBEAT_ERROR_BASE - 4,
        ERROR_HEARTBEAT_CANNOT_ACTIVATE_RENTAL                  = HEARTBEAT_ERROR_BASE - 5,
        ERROR_HEARTBEAT_TERMINATE_REQUESTED                     = HEARTBEAT_ERROR_BASE - 6,
    };
    
    }  // namespace android
    
    #endif  // MEDIA_ERRORS_H_
    

    【讨论】:

    • 仅供参考,如果您想从您的 MIDI 文件中检索元数据,您可以尝试:github.com/wseemann/FFmpegMediaMetadataRetriever
    • 对不起,安德鲁,我没有。 FFmpeg 不允许在不创建新文件的情况下编写元数据,否则我会修改我的库来帮助你。如果您只想更改少数格式的元数据标记,您可以使用几个 Java 库,但它们缺少通用接口。
    • @AndrewOrobator 你是如何将0xFFFFFFEA = -22 映射到上述任何枚举值的?
    • 我想知道答案。
    • 它是 2 的补码。
    【解决方案4】:

    我收到此错误:setDataSource failed: status = 0xFFFFFFEA,因为我的设备上不存在该文件。

    【讨论】:

      【解决方案5】:

      当我的音频文件被破坏时,我遇到了这个错误,当我更改文件时它解决了,你可以尝试手动设置不同的源路径

      【讨论】:

        【解决方案6】:

        我在尝试使用 0 kb mp3 文件时遇到了这个问题,我在删除该文件后解决了这个问题。也许你可以捕捉到这个异常。

        【讨论】:

          【解决方案7】:

          只需添加此链接以了解有关错误代码的更多信息:https://kdave.github.io/errno.h/

          通过搜索FFEA,发现0xFFFFFFEA是十进制值22@AndrewOrobator所说,错误为EINVAL 无效参数。

          【讨论】:

            猜你喜欢
            • 2021-12-13
            • 1970-01-01
            • 2015-07-25
            • 1970-01-01
            • 1970-01-01
            • 2019-11-06
            • 1970-01-01
            • 2019-09-15
            • 2023-03-23
            相关资源
            最近更新 更多