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

Commit f7a50cf5 authored by Amit Shekhar's avatar Amit Shekhar
Browse files

frameworks/av: Play flac files using awesomeplayer

Non-omx based playback is not handled in NuPlayer, hence, forcing
flac files through awesomeplayer.

Change-Id: I753e75bc0c25146c41c5203ec8d2e539a7a01247
CRs-Fixed: 761468
parent c80e2f54
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -182,6 +182,25 @@ class StagefrightPlayerFactory :
                               int64_t offset,
                               int64_t /*length*/,
                               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()
                == STAGEFRIGHT_PLAYER) {
            char buf[20];