-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFlvMediaStreamSource.h
67 lines (56 loc) · 2.52 KB
/
FlvMediaStreamSource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* FlvMediaStreamSource.h:
*
* Copyright (C) 2024-2025 Light Lin <blog.poxiao.me> All Rights Reserved.
*
*/
#ifndef DAWN_PLAYER_FLV_MEDIA_STREAM_SOURCE_H
#define DAWN_PLAYER_FLV_MEDIA_STREAM_SOURCE_H
#include <memory>
#include <optional>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Media.Core.h>
#include <winrt/Windows.Storage.Streams.h>
#include <winrt/Windows.Media.MediaProperties.h>
#include "core/dawn_player/flv_player.hpp"
#include "core/dawn_player/io.hpp"
#include "core/dawn_player/task_service.hpp"
#include "FlvMediaStreamSource.g.h"
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::Media::Core;
using namespace winrt::Windows::Storage::Streams;
using namespace winrt::Windows::Media::MediaProperties;
using dawn_player::flv_player;
using dawn_player::io::read_stream_proxy;
using dawn_player::video_codec;
namespace winrt::DawnPlayer::implementation
{
struct FlvMediaStreamSource : FlvMediaStreamSourceT<FlvMediaStreamSource>
{
FlvMediaStreamSource(const std::shared_ptr<flv_player>& player, MediaStreamSource mss);
static IAsyncOperation<DawnPlayer::FlvMediaStreamSource> CreateFromInputStreamAsync(IInputStream inputStream);
static IAsyncOperation<DawnPlayer::FlvMediaStreamSource> CreateFromRandomAccessStreamAsync(IRandomAccessStream randomAccessStream);
MediaStreamSource Source();
virtual ~FlvMediaStreamSource();
// IClosable
void Close();
private:
std::shared_ptr<flv_player> player_;
MediaStreamSource mss_ = nullptr;
static IAsyncOperation<DawnPlayer::FlvMediaStreamSource> create_from_read_stream_proxy_async(std::shared_ptr<read_stream_proxy> stream_proxy);
void on_starting(MediaStreamSource sender, MediaStreamSourceStartingEventArgs args);
void on_sample_requested(MediaStreamSource sender, MediaStreamSourceSampleRequestedEventArgs args);
void handle_starting(MediaStreamSource sender, MediaStreamSourceStartingEventArgs args);
void handle_sample_requested(MediaStreamSource sender, MediaStreamSourceSampleRequestedEventArgs args);
std::optional<winrt::event_token> starting_event_token;
std::optional<winrt::event_token> sample_requested_event_token;
static VideoEncodingProperties CreateVideoEncodingProperties(video_codec vc);
};
}
namespace winrt::DawnPlayer::factory_implementation
{
struct FlvMediaStreamSource : FlvMediaStreamSourceT<FlvMediaStreamSource, implementation::FlvMediaStreamSource>
{
};
}
#endif