From b4f5b5b98e498139e6555c1583bd69f0d2a24324 Mon Sep 17 00:00:00 2001 From: Anshul Maheshwari Date: Fri, 15 May 2015 00:31:18 +0530 Subject: [PATCH] Removing global options from Mp4 --- src/ccextractor.c | 8 ++++++-- src/gpacmp4/mp4.c | 11 +++++------ src/lib_ccx/ccx_mp4.h | 11 +++++++++++ src/lib_ccx/lib_ccx.h | 2 -- 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 src/lib_ccx/ccx_mp4.h diff --git a/src/ccextractor.c b/src/ccextractor.c index 5482fb45..b185e8be 100644 --- a/src/ccextractor.c +++ b/src/ccextractor.c @@ -10,6 +10,7 @@ License: GPL 2.0 #include #include "ffmpeg_intgr.h" #include "ccx_common_option.h" +#include "ccx_mp4.h" struct lib_ccx_ctx *signal_ctx; void sigint_handler() @@ -564,6 +565,7 @@ int main(int argc, char *argv[]) switch (ctx->stream_mode) { + struct ccx_s_mp4Cfg mp4_cfg = {ccx_options.mp4vidtrack}; case CCX_SM_ELEMENTARY_OR_NOT_FOUND: if (!ccx_options.use_gop_as_pts) // If !0 then the user selected something ccx_options.use_gop_as_pts = 1; // Force GOP timing for ES @@ -590,10 +592,12 @@ int main(int argc, char *argv[]) show_myth_banner = 1; myth_loop(ctx, &enc_ctx); break; - case CCX_SM_MP4: + case CCX_SM_MP4: mprint ("\rAnalyzing data with GPAC (MP4 library)\n"); close_input_file(ctx); // No need to have it open. GPAC will do it for us - processmp4 (ctx, ctx->inputfile[0],&enc_ctx); + processmp4 (ctx, &mp4_cfg, ctx->inputfile[0],&enc_ctx); + if (ccx_options.print_file_reports) + print_file_report(ctx); break; #ifdef WTV_DEBUG case CCX_SM_HEX_DUMP: diff --git a/src/gpacmp4/mp4.c b/src/gpacmp4/mp4.c index 60ae9189..ca6a1230 100644 --- a/src/gpacmp4/mp4.c +++ b/src/gpacmp4/mp4.c @@ -7,6 +7,7 @@ #include "utility.h" #include "ccx_encoders_common.h" #include "ccx_common_option.h" +#include "ccx_mp4.h" void do_NAL (struct lib_ccx_ctx *ctx, unsigned char *NALstart, LLONG NAL_length, struct cc_subtitle *sub); void set_fts(void); // From timing.c @@ -279,7 +280,7 @@ unsigned char * ccdp_find_data(unsigned char * ccdp_atom_content, unsigned int l } */ -int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx) +int processmp4 (struct lib_ccx_ctx *ctx,struct ccx_s_mp4Cfg *cfg, char *file,void *enc_ctx) { GF_ISOFile* f; u32 i, j, track_count, avc_track_count, cc_track_count; @@ -328,7 +329,7 @@ int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx) if ( type == GF_ISOM_MEDIA_VISUAL && subtype == GF_ISOM_SUBTYPE_XDVB) { - if (cc_track_count && !ccx_options.mp4vidtrack) + if (cc_track_count && !cfg->mp4vidtrack) continue; if(process_xdvb_track(ctx, file, f, i + 1, &dec_sub) != 0) { @@ -344,7 +345,7 @@ int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx) if( type == GF_ISOM_MEDIA_VISUAL && subtype == GF_ISOM_SUBTYPE_AVC_H264) { - if (cc_track_count && !ccx_options.mp4vidtrack) + if (cc_track_count && !cfg->mp4vidtrack) continue; GF_AVCConfig *cnf = gf_isom_avc_config_get(f,i+1,1); if (cnf!=NULL) @@ -372,7 +373,7 @@ int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx) if (type == GF_ISOM_MEDIA_CAPTIONS && (subtype == GF_ISOM_SUBTYPE_C608 || subtype == GF_ISOM_SUBTYPE_C708)) { - if (avc_track_count && ccx_options.mp4vidtrack) + if (avc_track_count && cfg->mp4vidtrack) continue; #ifdef MP4_DEBUG @@ -550,8 +551,6 @@ int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx) mprint ("found no dedicated CC track(s).\n"); ctx->freport.mp4_cc_track_cnt = cc_track_count; - if (ccx_options.print_file_reports) - print_file_report(ctx); return 0; } diff --git a/src/lib_ccx/ccx_mp4.h b/src/lib_ccx/ccx_mp4.h new file mode 100644 index 00000000..6d7cb883 --- /dev/null +++ b/src/lib_ccx/ccx_mp4.h @@ -0,0 +1,11 @@ +#ifndef CXX_MP4_H +#define CXX_MP4_H + + +struct ccx_s_mp4Cfg +{ + unsigned int mp4vidtrack :1; +}; + +int processmp4 (struct lib_ccx_ctx *ctx,struct ccx_s_mp4Cfg *cfg, char *file,void *enc_ctx); +#endif diff --git a/src/lib_ccx/lib_ccx.h b/src/lib_ccx/lib_ccx.h index 6db19bb2..47940e6e 100644 --- a/src/lib_ccx/lib_ccx.h +++ b/src/lib_ccx/lib_ccx.h @@ -335,8 +335,6 @@ void store_hdcc(struct lib_ccx_ctx *ctx, unsigned char *cc_data, int cc_count, i LLONG current_fts_now,struct cc_subtitle *sub); void anchor_hdcc(int seq); void process_hdcc (struct lib_ccx_ctx *ctx, struct cc_subtitle *sub); -// mp4.c -int processmp4 (struct lib_ccx_ctx *ctx, char *file,void *enc_ctx); // params_dump.c void params_dump(struct lib_ccx_ctx *ctx);