Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for Supporting Additional Video Codecs #5634

Merged
merged 2 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/demux/aacdemuxer.ts → src/demux/audio/aacdemuxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import BaseAudioDemuxer from './base-audio-demuxer';
import * as ADTS from './adts';
import { logger } from '../utils/logger';
import * as ID3 from '../demux/id3';
import type { HlsEventEmitter } from '../events';
import type { HlsConfig } from '../config';
import { logger } from '../../utils/logger';
import * as ID3 from '../id3';
import type { HlsEventEmitter } from '../../events';
import type { HlsConfig } from '../../config';

class AACDemuxer extends BaseAudioDemuxer {
private readonly observer: HlsEventEmitter;
Expand Down
6 changes: 3 additions & 3 deletions src/demux/ac3-demuxer.ts → src/demux/audio/ac3-demuxer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseAudioDemuxer from './base-audio-demuxer';
import { getID3Data, getTimeStamp } from './id3';
import type { HlsEventEmitter } from '../events';
import type { AudioFrame, DemuxedAudioTrack } from '../types/demuxer';
import { getID3Data, getTimeStamp } from '../id3';
import type { HlsEventEmitter } from '../../events';
import type { AudioFrame, DemuxedAudioTrack } from '../../types/demuxer';

export class AC3Demuxer extends BaseAudioDemuxer {
private readonly observer: HlsEventEmitter;
Expand Down
10 changes: 5 additions & 5 deletions src/demux/adts.ts → src/demux/audio/adts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* ADTS parser helper
* @link https://wiki.multimedia.cx/index.php?title=ADTS
*/
import { logger } from '../utils/logger';
import { ErrorTypes, ErrorDetails } from '../errors';
import type { HlsEventEmitter } from '../events';
import { Events } from '../events';
import { logger } from '../../utils/logger';
import { ErrorTypes, ErrorDetails } from '../../errors';
import type { HlsEventEmitter } from '../../events';
import { Events } from '../../events';
import type {
DemuxedAudioTrack,
AudioFrame,
AudioSample,
} from '../types/demuxer';
} from '../../types/demuxer';

type AudioConfig = {
config: number[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as ID3 from '../demux/id3';
import * as ID3 from '../id3';
import {
DemuxerResult,
Demuxer,
DemuxedAudioTrack,
AudioFrame,
DemuxedMetadataTrack,
DemuxedVideoTrack,
DemuxedVideoTrackBase,
DemuxedUserdataTrack,
KeyData,
MetadataSchema,
} from '../types/demuxer';
import { dummyTrack } from './dummy-demuxed-track';
import { appendUint8Array } from '../utils/mp4-tools';
import { sliceUint8 } from '../utils/typed-array';
import { RationalTimestamp } from '../utils/timescale-conversion';
} from '../../types/demuxer';
import { dummyTrack } from '../dummy-demuxed-track';
import { appendUint8Array } from '../../utils/mp4-tools';
import { sliceUint8 } from '../../utils/typed-array';
import { RationalTimestamp } from '../../utils/timescale-conversion';

class BaseAudioDemuxer implements Demuxer {
protected _audioTrack!: DemuxedAudioTrack;
Expand Down Expand Up @@ -138,7 +138,7 @@ class BaseAudioDemuxer implements Demuxer {

return {
audioTrack: track,
videoTrack: dummyTrack() as DemuxedVideoTrack,
videoTrack: dummyTrack() as DemuxedVideoTrackBase,
id3Track,
textTrack: dummyTrack() as DemuxedUserdataTrack,
};
Expand All @@ -164,7 +164,7 @@ class BaseAudioDemuxer implements Demuxer {

return {
audioTrack: this._audioTrack,
videoTrack: dummyTrack() as DemuxedVideoTrack,
videoTrack: dummyTrack() as DemuxedVideoTrackBase,
id3Track: this._id3Track,
textTrack: dummyTrack() as DemuxedUserdataTrack,
};
Expand Down
4 changes: 2 additions & 2 deletions src/demux/mp3demuxer.ts → src/demux/audio/mp3demuxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* MP3 demuxer
*/
import BaseAudioDemuxer from './base-audio-demuxer';
import * as ID3 from '../demux/id3';
import { logger } from '../utils/logger';
import * as ID3 from '../id3';
import { logger } from '../../utils/logger';
import * as MpegAudio from './mpegaudio';

class MP3Demuxer extends BaseAudioDemuxer {
Expand Down
2 changes: 1 addition & 1 deletion src/demux/mpegaudio.ts → src/demux/audio/mpegaudio.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MPEG parser helper
*/
import { DemuxedAudioTrack } from '../types/demuxer';
import { DemuxedAudioTrack } from '../../types/demuxer';

let chromeVersion: number | null = null;

Expand Down
12 changes: 6 additions & 6 deletions src/demux/sample-aes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import Decrypter from '../crypt/decrypter';
import { HlsEventEmitter } from '../events';
import type {
AudioSample,
AvcSample,
AvcSampleUnit,
DemuxedVideoTrack,
VideoSample,
VideoSampleUnit,
DemuxedVideoTrackBase,
KeyData,
} from '../types/demuxer';
import { discardEPB } from '../utils/mp4-tools';
Expand Down Expand Up @@ -128,11 +128,11 @@ class SampleAesDecrypter {
}

decryptAvcSample(
samples: AvcSample[],
samples: VideoSample[],
sampleIndex: number,
unitIndex: number,
callback: () => void,
curUnit: AvcSampleUnit
curUnit: VideoSampleUnit
) {
const decodedData = discardEPB(curUnit.data);
const encryptedData = this.getAvcEncryptedData(decodedData);
Expand All @@ -149,7 +149,7 @@ class SampleAesDecrypter {
}

decryptAvcSamples(
samples: DemuxedVideoTrack['samples'],
samples: DemuxedVideoTrackBase['samples'],
sampleIndex: number,
unitIndex: number,
callback: () => void
Expand Down
6 changes: 3 additions & 3 deletions src/demux/transmuxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import type { HlsEventEmitter } from '../events';
import { Events } from '../events';
import { ErrorTypes, ErrorDetails } from '../errors';
import Decrypter from '../crypt/decrypter';
import AACDemuxer from '../demux/aacdemuxer';
import AACDemuxer from './audio/aacdemuxer';
import MP4Demuxer from '../demux/mp4demuxer';
import TSDemuxer, { TypeSupported } from '../demux/tsdemuxer';
import MP3Demuxer from '../demux/mp3demuxer';
import { AC3Demuxer } from './ac3-demuxer';
import MP3Demuxer from './audio/mp3demuxer';
import { AC3Demuxer } from './audio/ac3-demuxer';
import MP4Remuxer from '../remux/mp4-remuxer';
import PassThroughRemuxer from '../remux/passthrough-remuxer';
import { logger } from '../utils/logger';
Expand Down
Loading