Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
214c7fc1
Commit
214c7fc1
authored
Jan 12, 2021
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MediaLibrary: Add a way to fetch a bookmark by its id
parent
f624aad5
Pipeline
#59380
passed with stage
in 22 minutes and 9 seconds
Changes
4
Pipelines
8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
include/medialibrary/IMediaLibrary.h
include/medialibrary/IMediaLibrary.h
+2
-0
src/MediaLibrary.cpp
src/MediaLibrary.cpp
+4
-0
src/MediaLibrary.h
src/MediaLibrary.h
+2
-0
test/unittest/BookmarkTests.cpp
test/unittest/BookmarkTests.cpp
+12
-0
No files found.
include/medialibrary/IMediaLibrary.h
View file @
214c7fc1
...
...
@@ -885,6 +885,8 @@ public:
virtual
bool
requestThumbnail
(
int64_t
mediaId
,
ThumbnailSizeType
sizeType
,
uint32_t
desiredWidth
,
uint32_t
desiredHeight
,
float
position
)
=
0
;
virtual
BookmarkPtr
bookmark
(
int64_t
bookmarkId
)
const
=
0
;
};
}
...
...
src/MediaLibrary.cpp
View file @
214c7fc1
...
...
@@ -2814,5 +2814,9 @@ bool MediaLibrary::requestThumbnail( int64_t mediaId, ThumbnailSizeType sizeType
return
true
;
}
BookmarkPtr
MediaLibrary
::
bookmark
(
int64_t
bookmarkId
)
const
{
return
Bookmark
::
fetch
(
this
,
bookmarkId
);
}
}
src/MediaLibrary.h
View file @
214c7fc1
...
...
@@ -267,6 +267,8 @@ public:
uint32_t
desiredWidth
,
uint32_t
desiredHeight
,
float
position
)
override
;
virtual
BookmarkPtr
bookmark
(
int64_t
bookmarkId
)
const
override
;
protected:
// Allow access to unit test MediaLibrary implementations
static
const
std
::
vector
<
const
char
*>
SupportedMediaExtensions
;
...
...
test/unittest/BookmarkTests.cpp
View file @
214c7fc1
...
...
@@ -293,3 +293,15 @@ TEST_F( Bookmarks, OrderByCreationDate )
ASSERT_EQ
(
b3
->
id
(),
bookmarks
[
1
]
->
id
()
);
ASSERT_EQ
(
b1
->
id
(),
bookmarks
[
2
]
->
id
()
);
}
TEST_F
(
Bookmarks
,
Fetch
)
{
auto
b
=
Bookmark
::
create
(
ml
.
get
(),
1
,
m
->
id
()
);
ASSERT_NE
(
nullptr
,
b
);
auto
b2
=
ml
->
bookmark
(
b
->
id
()
);
ASSERT_NE
(
b2
,
nullptr
);
b2
=
ml
->
bookmark
(
b
->
id
()
+
1
);
ASSERT_EQ
(
nullptr
,
b2
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment