Skip to content

Commit

Permalink
Add CPL model
Browse files Browse the repository at this point in the history
Improve tooling
  • Loading branch information
palemieux authored Jun 4, 2021
2 parents dece516 + b50932e commit 5cce96f
Show file tree
Hide file tree
Showing 9 changed files with 974 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
Language: Cpp
AlignAfterOpenBracket: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ContinuationIndentWidth: 4
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++03
TabWidth: 4
UseTab: Never
...
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
*.a
*.o
*.o.*
Expand Down Expand Up @@ -37,3 +38,7 @@
/src
/mapfile
/tools/python/__pycache__/
/tools/enum_options
/tools/venc_data_dump
.vscode
/dist
5 changes: 5 additions & 0 deletions README-IMF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# FFMPEG IMF

## Debug build

`./configure --enable-libxml2 --enable-debug --enable-static --disable-optimizations --prefix=$PWD/dist`
3 changes: 2 additions & 1 deletion libavformat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ OBJS-$(CONFIG_IMAGE_WEBP_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_XBM_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_XPM_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_XWD_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMF_DEMUXER) += imfdec.o
OBJS-$(CONFIG_IMF_DEMUXER) += imfdec.o imf_cpl.o
OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o
OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o
OBJS-$(CONFIG_IPU_DEMUXER) += ipudec.o
Expand Down Expand Up @@ -690,6 +690,7 @@ TESTPROGS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh
TESTPROGS-$(CONFIG_MOV_MUXER) += movenc
TESTPROGS-$(CONFIG_NETWORK) += noproxy
TESTPROGS-$(CONFIG_SRTP) += srtp
TESTPROGS-$(CONFIG_IMF_DEMUXER) += imf

TOOLS = aviocat \
ismindex \
Expand Down
121 changes: 121 additions & 0 deletions libavformat/imf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* Copyright (c) Sandflow Consulting LLC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

/**
* @file
* @ingroup lavu_imf
* Public header for processing of Interoperable Master Format packages
*/

#ifndef AVCODEC_IMF_H
#define AVCODEC_IMF_H

#include "libavformat/avio.h"
#include "libavutil/rational.h"
#include <libxml/tree.h>

/**
* IMF Composition Playlist Base Resource
*/
typedef struct IMFBaseResource {
AVRational edit_rate;
unsigned long entry_point;
unsigned long duration;
unsigned long repeat_count;
} IMFBaseResource;

/**
* IMF Composition Playlist Track File Resource
*/
typedef struct IMFTrackFileResource {
IMFBaseResource base;
unsigned char track_file_uuid[16];
} IMFTrackFileResource;

/**
* IMF Marker
*/
typedef struct IMFMarker {
xmlChar *label_utf8;
xmlChar *scope_utf8;
unsigned long offset;
} IMFMarker;

/**
* IMF Composition Playlist Marker Resource
*/
typedef struct IMFMarkerResource {
IMFBaseResource base;
unsigned long marker_count;
IMFMarker *markers;
} IMFMarkerResource;

/**
* IMF Composition Playlist Virtual Track
*/
typedef struct IMFBaseVirtualTrack {
unsigned char id_uuid[16];
} IMFBaseVirtualTrack;

/**
* IMF Composition Playlist Virtual Track that consists of Track File Resources
*/
typedef struct IMFTrackFileVirtualTrack {
IMFBaseVirtualTrack base;
unsigned long resource_count;
IMFTrackFileResource *resources;
} IMFTrackFileVirtualTrack;

/**
* IMF Composition Playlist Virtual Track that consists of Marker Resources
*/
typedef struct IMFMarkerVirtualTrack {
IMFBaseVirtualTrack base;
unsigned long resource_count;
IMFMarkerResource *resources;
} IMFMarkerVirtualTrack;

/**
* IMF Composition Playlist
*/
typedef struct IMFCPL {
uint8_t id_uuid[16];
xmlChar *content_title_utf8;
AVRational edit_rate;
IMFMarkerVirtualTrack *main_markers_track;
IMFTrackFileVirtualTrack *main_image_2d_track;
unsigned long main_audio_track_count;
IMFTrackFileVirtualTrack *main_audio_tracks;
} IMFCPL;

int parse_imf_cpl_from_xml_dom(xmlDocPtr doc, IMFCPL **cpl);

int parse_imf_cpl(AVIOContext *in, IMFCPL **cpl);

IMFCPL *imf_cpl_alloc(void);

void imf_cpl_free(IMFCPL *cpl);

#endif
Loading

0 comments on commit 5cce96f

Please sign in to comment.