Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 513c6d3e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "frameworks/av: Play flac files using awesomeplayer"

parents a447bc78 f7a50cf5
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -182,6 +182,25 @@ class StagefrightPlayerFactory :
                               int64_t offset,
                               int64_t offset,
                               int64_t /*length*/,
                               int64_t /*length*/,
                               float /*curScore*/) {
                               float /*curScore*/) {

        // Flac playback forced to Awesomeplayer
        if (fd) {
            char symName[40] = {0};
            char fileName[256] = {0};
            snprintf(symName, sizeof(symName), "/proc/%d/fd/%d", getpid(), fd);

            if (readlink(symName, fileName, (sizeof(fileName) - 1)) != -1 ) {
                static const char* extn = ".flac";
                uint32_t lenExtn = strlen(extn);
                uint32_t lenFileName = strlen(fileName);
                uint32_t start = lenFileName - lenExtn;
                if (start > 0) {
                    if (!strncasecmp(fileName + start, extn, lenExtn)) {
                        return 1.0;
                    }
                }
            }
        }
        if (getDefaultPlayerType()
        if (getDefaultPlayerType()
                == STAGEFRIGHT_PLAYER) {
                == STAGEFRIGHT_PLAYER) {
            char buf[20];
            char buf[20];