Merge lp:~lorn-potter/media-hub/1420728 into lp:media-hub

Proposed by Lorn Potter
Status: Merged
Approved by: Jim Hodapp
Approved revision: 190
Merged at revision: 192
Proposed branch: lp:~lorn-potter/media-hub/1420728
Merge into: lp:media-hub
Diff against target: 33 lines (+21/-2)
1 file modified
src/core/media/gstreamer/playbin.cpp (+21/-2)
To merge this branch: bzr merge lp:~lorn-potter/media-hub/1420728
Reviewer Review Type Date Requested Status
Jim Hodapp (community) code Approve
Review via email: mp+297707@code.launchpad.net

Commit message

Add support for files with no filename extension.

Description of the change

Add support for files with no filename extension.

To post a comment you must log in.
Revision history for this message
Jim Hodapp (jhodapp) wrote :

One simple change.

review: Needs Fixing
Revision history for this message
Lorn Potter (lorn-potter) :
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Yes missed that, apparently I shouldn't review late at night. ;)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/core/media/gstreamer/playbin.cpp'
2--- src/core/media/gstreamer/playbin.cpp 2016-06-16 20:19:35 +0000
3+++ src/core/media/gstreamer/playbin.cpp 2016-06-16 22:43:50 +0000
4@@ -639,8 +639,27 @@
5 if (!info)
6 return std::string();
7
8- return std::string(g_file_info_get_attribute_string(
9- info.get(), G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE));
10+ std::string content_type = g_file_info_get_attribute_string(
11+ info.get(), G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
12+ if (content_type.empty())
13+ return std::string();
14+
15+ if (content_type == "application/octet-stream")
16+ {
17+ std::unique_ptr<GFileInfo, void(*)(void *)> full_info(
18+ g_file_query_info(file.get(), G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
19+ G_FILE_QUERY_INFO_NONE,
20+ /* cancellable */ NULL, &error),g_object_unref);
21+
22+ if (!full_info)
23+ return std::string();
24+
25+ content_type = g_file_info_get_attribute_string(
26+ full_info.get(), G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
27+ if (content_type.empty())
28+ return std::string();
29+ }
30+ return content_type;
31 }
32
33 std::string gstreamer::Playbin::encode_uri(const std::string& uri) const

Subscribers

People subscribed via source and target branches